Skip to content

Commit

Permalink
feat: added ability to set expected-ori in quant
Browse files Browse the repository at this point in the history
This commit adds the ability to set the `--expected-ori` option
that is passed to the `generate-permit-list` command of `alevin-fry`.

This is an "optional" option.  If it is not provided explicitly, it
is set to "both" (allowing reads aligning in both orientations to pass
through), unless the chemistry is set as 10xv2 or 10xv3, in which
case it is set as "fw".  Regardless of the chemistry, if the user sets
this option explicitly, their choice is respected.
  • Loading branch information
Rob Patro committed Aug 21, 2022
1 parent 5d0f6ad commit 66aab95
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ categories = ["command-line-utilities", "science"]

[dependencies]
anyhow = "^1.0"
clap = { version = ">=3.2.15", features = ["derive", "wrap_help", "cargo", "deprecated", "wrap_help"]}
clap = { version = ">=3.2.17", features = ["derive", "wrap_help", "cargo", "deprecated", "wrap_help"]}
cmd_lib = "^1.3.0"
env_logger = "^0.9.0"
log = "^0.4.17"
Expand Down
27 changes: 26 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ enum Commands {
#[clap(short = 's', long, help_heading = "mapping options", action)]
use_selective_alignment: bool,

/// The expected direction/orientation of alignments in the chemistry being processed. If
/// not provided, will default to `fw` for 10xv2/10xv3, otherwise `both`.
#[clap(short = 'd', long, help_heading="permit list generation options", value_parser = clap::builder::PossibleValuesParser::new(["fw", "rc", "both"]))]
expected_ori: Option<String>,

/// use knee filtering mode
#[clap(short, long, help_heading = "permit list generation options", action)]
knee: bool,
Expand Down Expand Up @@ -584,6 +589,7 @@ fn main() -> anyhow::Result<()> {
reads2,
mut threads,
use_selective_alignment,
expected_ori,
knee,
unfiltered_pl,
explicit_pl,
Expand Down Expand Up @@ -646,6 +652,25 @@ fn main() -> anyhow::Result<()> {
}
};

let ori;
// if the user set the orientation, then
// use that explicitly
if let Some(o) = expected_ori {
ori = o;
} else {
// otherwise, this was not set explicitly. In that case
// if we have 10xv2 or 10xv3 chemistry, set ori = "fw"
// otherwise set ori = "both"
match chem {
Chemistry::TenxV2 | Chemistry::TenxV3 => {
ori = "fw".to_string();
}
_ => {
ori = "both".to_string();
}
}
}

let mut filter_meth_opt = None;

// based on the filtering method
Expand Down Expand Up @@ -796,7 +821,7 @@ fn main() -> anyhow::Result<()> {

alevin_gpl_cmd.arg("generate-permit-list");
alevin_gpl_cmd.arg("-i").arg(&map_output);
alevin_gpl_cmd.arg("-d").arg("fw");
alevin_gpl_cmd.arg("-d").arg(&ori);

// add the filter mode
add_to_args(&filter_meth, &mut alevin_gpl_cmd);
Expand Down

0 comments on commit 66aab95

Please sign in to comment.