Skip to content

Commit

Permalink
tweak around
Browse files Browse the repository at this point in the history
  • Loading branch information
an-altosian committed Dec 21, 2024
1 parent 446cc5d commit e06c4d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/simpleaf_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ pub struct ChemistryAddOpts {
/// the geometry to which the chemistry maps, wrapped in quotes.
#[arg(short, long)]
pub geometry: String,
/// the expected orientation indicating the direction to the reference sequences.
/// the expected orientation indicating the direction of biological reads to reference sequences.
#[arg(short, long, value_parser = clap::builder::PossibleValuesParser::new(["fw", "rc", "both"]))]
pub expected_ori: String,
/// the (fully-qualified) path to a local file that will be copied into
Expand Down
4 changes: 2 additions & 2 deletions src/simpleaf_commands/quant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ pub fn map_and_quant(af_home_path: &Path, opts: MapQuantOpts) -> anyhow::Result<
let ori: ExpectedOri;
// if the user set the orientation, then
// use that explicitly
if let Some(o) = opts.expected_ori.clone() {
ori = ExpectedOri::from_str(&o).with_context(|| {
if let Some(o) = &opts.expected_ori {
ori = ExpectedOri::from_str(o).with_context(|| {
format!(
"Could not parse orientation {}. It must be one of the following: {:?}",
o,
Expand Down
5 changes: 3 additions & 2 deletions src/utils/af_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use strum_macros::EnumIter;
use tracing::{error, info, warn};

use crate::atac::commands::AtacChemistry;
use crate::utils::chem_utils::CustomChemistry;
use crate::utils::chem_utils::{get_single_custom_chem_from_file, CustomChemistry};
use crate::utils::{self, prog_utils};

use super::chem_utils::{QueryInRegistry, LOCAL_PL_PATH_KEY, REMOTE_PL_URL_KEY};
Expand Down Expand Up @@ -201,6 +201,7 @@ impl Chemistry {
// and when we propagate more information about paired-end mappings.
ExpectedOri::Forward
}
Chemistry::Rna(RnaChemistry::Other(_)) => ExpectedOri::default(),
_ => ExpectedOri::default(),
}
}
Expand All @@ -225,7 +226,7 @@ impl Chemistry {
s => {
// first, we check if the chemistry is a known chemistry for the given mapper
// Second, we check if its a registered custom chemistry
// Third, we check if its a custom chemistry string
// Third, we check if its a custom geometry string
if index_type.is_known_chem(s) {
Chemistry::Rna(RnaChemistry::Other(s.to_string()))
} else if let Some(chem) =
Expand Down
7 changes: 1 addition & 6 deletions src/utils/chem_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,8 @@ impl CustomChemistry {
}

/// Parse the value that corresponds to a key in the top-level custom chemistry JSON object.
/// The key ONLY is used for error messages and assigning the name field of the CustomChemistry struct.
/// The key is ONLY used for error messages and assigning the name field of the CustomChemistry struct.
/// The value must be an json value object with a valid geometry field that can be parsed into a CustomChemistry struct.
/// The value corresponding to this key can be either
/// 1. An object having the associated / expected keys
/// 2. A string representing the geometry
/// The second case here is legacy from older versions of simpleaf and deprecated, so we should
/// warn by default when we see it.
pub fn from_value(key: &str, value: &Value) -> Result<CustomChemistry> {
match value {
// deprecated case. Need to warn and return an error
Expand Down

0 comments on commit e06c4d9

Please sign in to comment.