Skip to content

Commit

Permalink
update to use refactored print_clonotypes function (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
macklin-10x authored Mar 28, 2024
1 parent 367e338 commit 1389bc9
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 49 deletions.
58 changes: 29 additions & 29 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ permutation = "0.4"
petgraph = "0.6"
plotters = { version = "0.3", default_features = false, features = ["svg_backend", "point_series"] }
png-decoder = "0.1"
pretty_trace = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main", features = ["pprof"]}
procfs = { version = "0.12", default_features = false }
# prost: enclone will compile without the std and prost-derive features, but other things
# (such as enclone_proto) break.
Expand Down
55 changes: 38 additions & 17 deletions enclone_main/src/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::opt_d_val::make_opt_d_val;
use crate::subset::subset_json;
use enclone_core::defs::ColInfo;
use enclone_core::enclone_structs::*;
use enclone_print::print_clonotypes::print_clonotypes;
use enclone_print::print_clonotypes::{print_clonotypes, PrintClonotypesResult};
use enclone_tail::grouper::grouper;
use enclone_tail::tail::tail_code;
use io_utils::{dir_list, open_for_read, path_exists};
Expand Down Expand Up @@ -116,14 +116,6 @@ pub fn main_enclone_stop(mut inter: EncloneIntermediates) -> Result<EncloneState
});

// Find and print clonotypes. (But we don't actually print them here.)

let mut pics = Vec::<String>::new();
let mut exacts = Vec::<Vec<usize>>::new(); // ugly reuse of name
let mut in_center = Vec::<bool>::new();
let mut rsi = Vec::<ColInfo>::new(); // ditto
let mut out_datas = Vec::<Vec<HashMap<String, String>>>::new();
let mut tests = Vec::<usize>::new();
let mut controls = Vec::<usize>::new();
if !ctl.gen_opt.trace_barcode.is_empty() {
for u in 0..exact_clonotypes.len() {
let ex = &exact_clonotypes[u];
Expand All @@ -138,7 +130,15 @@ pub fn main_enclone_stop(mut inter: EncloneIntermediates) -> Result<EncloneState
}
}
}
print_clonotypes(

let PrintClonotypesResult {
mut pics,
mut exacts,
in_center,
mut rsi,
mut out_datas,
gene_scan_result,
} = print_clonotypes(
is_bcr,
to_bc,
sr,
Expand All @@ -154,17 +154,38 @@ pub fn main_enclone_stop(mut inter: EncloneIntermediates) -> Result<EncloneState
&d_readers,
&ind_readers,
&h5_data,
&mut pics,
&mut exacts,
&mut in_center,
&mut rsi,
&mut out_datas,
&mut tests,
&mut controls,
fate,
allele_data,
)?;

// Gather some data for gene scan.
let (mut tests, mut controls) = (vec![], vec![]);
if ctl.gen_opt.gene_scan.is_some() {
if !ctl.gen_opt.gene_scan_exact {
for (i, in_sets) in gene_scan_result.iter().enumerate() {
for in_set in in_sets {
if in_set.test {
tests.push(i);
}
if in_set.control {
controls.push(i);
}
}
}
} else {
for (in_sets, e) in gene_scan_result.iter().zip(exacts.iter()) {
for (&ej, in_set) in e.iter().zip(in_sets) {
if in_set.test {
tests.push(ej);
}
if in_set.control {
controls.push(ej);
}
}
}
}
}

// Process the SUBSET_JSON option.

subset_json(ctl, exact_clonotypes, &exacts, ann)?;
Expand Down
4 changes: 2 additions & 2 deletions enclone_tail/src/tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn tail_code(

// Do gene scan.

if ctl.gen_opt.gene_scan_test.is_some() {
if ctl.gen_opt.gene_scan.is_some() {
println!("\nFEATURE SCAN\n");
let mut test_cells = 0;
if !ctl.gen_opt.gene_scan_exact {
Expand Down Expand Up @@ -279,7 +279,7 @@ pub fn tail_code(
}
control_mean /= control_values.len() as f64;
let mut vals = Vec::<f64>::new();
let threshold = ctl.gen_opt.gene_scan_threshold.clone().unwrap();
let threshold = ctl.gen_opt.gene_scan.as_ref().unwrap().threshold.clone();
for i in 0..threshold.var.len() {
if threshold.var[i] == *"t" {
vals.push(test_mean);
Expand Down

0 comments on commit 1389bc9

Please sign in to comment.