Skip to content

Commit

Permalink
Restore the previous default for empty gex data.
Browse files Browse the repository at this point in the history
  • Loading branch information
macklin-10x committed Mar 30, 2024
1 parent eaa992d commit 531c8d0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions enclone_print/src/print_utils2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use vector_utils::next_diff12_4;
use vector_utils::{bin_member, bin_position, unique_sort};

/// This is just loaded GEX data.
#[derive(Default)]
pub struct RowFillGexData {
pub d_all: Vec<Vec<u32>>,
pub ind_all: Vec<Vec<u32>>,
Expand Down Expand Up @@ -166,11 +165,7 @@ pub fn row_fill(
gex_data,
gex_mean,
gex_sum,
} = if need_gex {
get_gex_info(gex_info, ctl, ex, gex_readers)
} else {
Default::default()
};
} = get_gex_info(need_gex, gex_info, ctl, ex, gex_readers);
// Borrow these values to ensure immutability in the rest of this function.
let gex_counts_unsorted = &gex_counts_unsorted;
let gex_fcounts_unsorted = &gex_fcounts_unsorted;
Expand Down Expand Up @@ -625,7 +620,6 @@ pub fn row_fill(
Ok(gex_data)
}

#[derive(Default)]
struct RowFillGexInfo {
gex_counts_unsorted: Vec<usize>,
gex_fcounts_unsorted: Vec<f64>,
Expand All @@ -636,19 +630,30 @@ struct RowFillGexInfo {
}

fn get_gex_info(
need_gex: bool,
gex_info: &GexInfo,
ctl: &EncloneControl,
ex: &ExactClonotype,
gex_readers: &[Option<GexReaders<'_>>],
) -> RowFillGexInfo {
let mut gex_data = RowFillGexData::new(ex.clones.len());
if !need_gex {
return RowFillGexInfo {
gex_data,
gex_counts_unsorted: Vec::new(),
gex_fcounts_unsorted: Vec::new(),
n_gexs: Vec::new(),
gex_mean: 0.,
gex_sum: 0.,
};
}
let mut counts = Vec::<usize>::new();
let mut gex_fcounts_unsorted = Vec::<f64>::new();
let mut n_gexs = Vec::<usize>::new();

// It might be possible to speed this up a lot by pulling part of the "let d" and
// "let ind" constructs out of the loop.

let mut gex_data = RowFillGexData::new(ex.clones.len());
for l in 0..ex.clones.len() {
let li = ex.clones[l][0].dataset_index;
let bc = ex.clones[l][0].barcode.clone();
Expand Down

0 comments on commit 531c8d0

Please sign in to comment.