Skip to content

Commit

Permalink
Lift the rest of lvar pass processing up into row_fill.
Browse files Browse the repository at this point in the history
  • Loading branch information
macklin-10x committed Mar 30, 2024
1 parent 541344e commit 409b5d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 72 deletions.
48 changes: 22 additions & 26 deletions enclone_print/src/print_utils2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use crate::print_utils1::color_codon;
use crate::proc_cvar_auto::proc_cvar_auto;
use crate::proc_lvar2::proc_lvar2;
use crate::proc_lvar2::{proc_lvar2_outs, proc_lvar2_stats};
use crate::proc_lvar_auto::{
proc_lvar_auto_read_only, proc_lvar_auto_res_outs, proc_lvar_auto_res_stats,
};
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn row_fill(
stats_pass1: &[Vec<(String, Vec<String>)>],
vdj_cells: &[Vec<String>],
n_vdj_gex: &[usize],
lvarsc: &[String],
lvars: &[String],
lvarsh: &HashSet<String>,
nd_fields: &[String],
peer_groups: &[Vec<(usize, u8, u32)>],
Expand All @@ -87,9 +87,7 @@ pub fn row_fill(

let mat = &rsi.mat;
let cvars = &ctl.clono_print_opt.cvars;
let lvars = lvarsc;
let clonotype_id = exacts[u];
let ex = &exact_clonotypes[clonotype_id];
let ex = &exact_clonotypes[exacts[u]];
let mut pcols_sort = ctl.parseable_opt.pcols_sort.clone();
for pcol in &mut pcols_sort {
*pcol = pcol.replace("_Σ", "_sum").replace("_μ", "_mean");
Expand Down Expand Up @@ -329,30 +327,29 @@ pub fn row_fill(
gex_readers,
&alt_bcs,
) {
proc_lvar_auto_res_stats(x, &exact_clonotypes[exacts[u]], &res, stats);
proc_lvar_auto_res_stats(x, ex, &res, stats);
if pass == 2 {
proc_lvar_auto_res_outs(i, x, u, ctl, extra_args, lvars, &res, row, out_data);
}
} else {
proc_lvar2(
i,
x,
pass,
u,
ctl,
exacts,
exact_clonotypes,
gex_info,
row,
out_data,
&gex_data,
stats,
lvars,
gex_mean,
gex_sum,
gex_fcounts_unsorted,
extra_args,
);
proc_lvar2_stats(i, x, ctl, ex, gex_info, &gex_data, lvars, gex_mean, stats);
if pass == 2 {
proc_lvar2_outs(
i,
x,
u,
ctl,
ex,
gex_info,
&gex_data,
lvars,
gex_sum,
gex_fcounts_unsorted,
extra_args,
row,
out_data,
);
}
}
}
}
Expand Down Expand Up @@ -453,7 +450,6 @@ pub fn row_fill(
// Keep going.

let mid = mid.unwrap();
let ex = &exact_clonotypes[clonotype_id];
let seq_amino = rsi.seqss_amino[col][u].clone();

// Speak some other column entries.
Expand Down
41 changes: 0 additions & 41 deletions enclone_print/src/proc_lvar2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,6 @@ use std::collections::HashMap;
use string_utils::TextUtils;
use vector_utils::{bin_member, bin_position};

pub fn proc_lvar2(
i: usize,
x: &str,
pass: usize,
u: usize,
ctl: &EncloneControl,
exacts: &[usize],
exact_clonotypes: &[ExactClonotype],
gex_info: &GexInfo,
row: &mut Vec<String>,
out_data: &mut [HashMap<String, String>],
gex_data: &RowFillGexData,
stats: &mut Vec<(String, Vec<String>)>,
lvars: &[String],
gex_mean: f64,
gex_sum: f64,
gex_fcounts_unsorted: &[f64],
extra_args: &[String],
) {
let clonotype_id = exacts[u];
let ex = &exact_clonotypes[clonotype_id];
if pass == 2 {
proc_lvar2_outs(
i,
x,
u,
ctl,
ex,
gex_info,
gex_data,
lvars,
gex_sum,
gex_fcounts_unsorted,
extra_args,
row,
out_data,
);
}
proc_lvar2_stats(i, x, ctl, ex, gex_info, gex_data, lvars, gex_mean, stats);
}

pub fn proc_lvar2_outs(
i: usize,
x: &str,
Expand Down
6 changes: 1 addition & 5 deletions enclone_print/src/proc_lvar_auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,11 +1304,7 @@ pub fn proc_lvar_auto_read_only(
} else if vname == "nchains" {
(format!("{}", rsi.mat.len()), Vec::new(), "clono")
} else if vname == "nchains_present" {
(
format!("{}", exact_clonotypes[exacts[u]].share.len()),
Vec::new(),
"exact",
)
(format!("{}", ex.share.len()), Vec::new(), "exact")
} else if vname == "near" {
let mut dist = 1_000_000;
for i2 in 0..varmat.len() {
Expand Down

0 comments on commit 409b5d5

Please sign in to comment.