Skip to content

Commit 0febb0c

Browse files
author
Ian
committed
more efficient subsetting..finally
1 parent b8c6d6c commit 0febb0c

File tree

4 files changed

+998
-146
lines changed

4 files changed

+998
-146
lines changed

src/ad/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,25 @@ impl IMAnnData {
464464
layers,
465465
})
466466
}
467+
468+
#[cfg(test)]
469+
pub fn debug_info(&self) -> anyhow::Result<()> {
470+
println!("AnnData Debug Info:");
471+
println!(" Dimensions: {} obs x {} vars", self.n_obs(), self.n_vars());
472+
473+
let x_shape = self.x().get_shape()?;
474+
println!(" X matrix shape: {:?}", x_shape);
475+
476+
let obs_df_shape = self.obs().get_data().shape();
477+
let var_df_shape = self.var().get_data().shape();
478+
println!(" obs DataFrame shape: {:?}", obs_df_shape);
479+
println!(" var DataFrame shape: {:?}", var_df_shape);
480+
481+
println!(" First 3 obs names: {:?}", &self.obs_names()[..self.n_obs().min(3)]);
482+
println!(" First 3 var names: {:?}", &self.var_names()[..self.n_vars().min(3)]);
483+
484+
Ok(())
485+
}
467486
}
468487

469488
use std::fmt;

src/utils/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ pub(crate) fn select_info_elem_to_indices(
5151
}
5252
}
5353

54+
// ####################################################################################################
55+
// Subsetting
56+
// ####################################################################################################
57+
58+
5459
pub(crate) fn subset_dyn_csc_matrix(
5560
dyn_csc: DynCscMatrix,
5661
s: &[&SelectInfoElem],
@@ -311,7 +316,6 @@ pub fn read_array_as_usize_optimized<B: Backend>(
311316
}
312317

313318
pub fn read_array_as_usize<B: Backend>(dataset: &B::Dataset) -> anyhow::Result<Vec<usize>> {
314-
println!("Dtype: {}", dataset.dtype()?);
315319
match dataset.dtype()? {
316320
ScalarType::U64 => {
317321
let arr = dataset.read_array::<u64, ndarray::Ix1>()?;

0 commit comments

Comments
 (0)