Skip to content

Commit

Permalink
feat: add hidden large PUG threshold cmd line option
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed May 31, 2022
1 parent 745eb4a commit 383eac9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ fn main() -> anyhow::Result<()> {
])
.required(false)
.hide(true))
.arg(arg!(--"large-graph-thresh" <NVERT> "the order (number of nodes) of a PUG above which the alternative resolution strategy will be applied")
.default_value_ifs(&[
("resolution", Some("parsimony-gene-em"), Some("1000")),
("resolution", Some("parsimony"), Some("1000")),
("resolution", Some("full"), Some("1000")),
("resolution", Some("parsimony-gene"), Some("1000")),
("resolution", Some("parsimony-gene"), Some("1000")),
])
.default_value("0") // for any other mode
.required(false)
.hide(true))
.arg(arg!(--"small-thresh" <SMALLTHRESH> "cells with fewer than these many reads will be resolved using a custom approach").default_value("10")
.hide(true));

Expand Down Expand Up @@ -398,6 +409,8 @@ fn main() -> anyhow::Result<()> {
let sa_model: SplicedAmbiguityModel = t.value_of_t("sa-model").unwrap();
let small_thresh = t.value_of_t("small-thresh").unwrap();
let filter_list = t.value_of("quant-subset");
let large_graph_thresh: usize = t.value_of_t("large-graph-thresh").unwrap();
crit!(log, "large graph thresh = {}", large_graph_thresh);
let umi_edit_dist: u32 = t.value_of_t("umi-edit-dist").unwrap();
let mut pug_exact_umi = false;

Expand Down Expand Up @@ -544,6 +557,7 @@ fn main() -> anyhow::Result<()> {
pug_exact_umi,
sa_model,
small_thresh,
large_graph_thresh,
filter_list,
&cmdline,
VERSION,
Expand Down
3 changes: 2 additions & 1 deletion src/pugutils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ pub fn get_num_molecules(
tid_to_gid: &[u32],
gene_eqclass_hash: &mut HashMap<Vec<u32>, u32, ahash::RandomState>,
hasher_state: &ahash::RandomState,
large_graph_thresh: usize,
log: &slog::Logger,
) -> PugResolutionStatistics
//,)
Expand Down Expand Up @@ -919,7 +920,7 @@ pub fn get_num_molecules(
// are very large. For components with > 1000 vertices
// (this should be _very_ rare) we will instead resolve
// the UMIs in the component using a simpler algorithm.
if comp_verts.len() > 1000 {
if comp_verts.len() > large_graph_thresh {
get_num_molecules_large_component(
g,
eqmap,
Expand Down
5 changes: 5 additions & 0 deletions src/quant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ pub fn quantify(
pug_exact_umi: bool,
sa_model: SplicedAmbiguityModel,
small_thresh: usize,
large_graph_thresh: usize,
filter_list: Option<&str>,
cmdline: &str,
version: &str,
Expand Down Expand Up @@ -354,6 +355,7 @@ pub fn quantify(
pug_exact_umi,
sa_model,
small_thresh,
large_graph_thresh,
filter_list,
cmdline,
version,
Expand Down Expand Up @@ -384,6 +386,7 @@ pub fn quantify(
pug_exact_umi,
sa_model,
small_thresh,
large_graph_thresh,
filter_list,
cmdline,
version,
Expand All @@ -410,6 +413,7 @@ pub fn do_quantify<T: Read>(
pug_exact_umi: bool,
mut sa_model: SplicedAmbiguityModel,
small_thresh: usize,
large_graph_thresh: usize,
filter_list: Option<&str>,
cmdline: &str,
version: &str,
Expand Down Expand Up @@ -924,6 +928,7 @@ pub fn do_quantify<T: Read>(
&tid_to_gid,
&mut gene_eqc,
&s,
large_graph_thresh,
&log,
);
alt_resolution = pug_stats.used_alternative_strategy; // alt_res;
Expand Down

0 comments on commit 383eac9

Please sign in to comment.