pub trait CollapsingOps {
// Required methods
fn collapse_columns(
&self,
knn_batches: Option<usize>,
knn_cells: Option<usize>,
reference_batch_names: Option<&[Box<str>]>,
num_opt_iter: Option<usize>,
) -> Result<CollapsedOut>;
fn build_hnsw_per_batch<T>(
&mut self,
proj_kn: &DMatrix<f32>,
col_to_batch: &[T],
) -> Result<()>
where T: Sync + Send + Hash + Eq + Clone + ToString;
fn collect_basic_stat(&self, stat: &mut CollapsedStat) -> Result<()>;
fn collect_batch_stat(&self, stat: &mut CollapsedStat) -> Result<()>;
fn collect_matched_stat(
&self,
knn_batches: usize,
knn_cols: usize,
reference_indices: Option<&[usize]>,
stat: &mut CollapsedStat,
) -> Result<()>;
}Expand description
Given a feature/projection matrix (factor x cells), we assign each cell to a sample and return pseudobulk (collapsed) matrices
(1) Register batches if needed (2) collapse columns/cells into samples
Required Methods§
Sourcefn collapse_columns(
&self,
knn_batches: Option<usize>,
knn_cells: Option<usize>,
reference_batch_names: Option<&[Box<str>]>,
num_opt_iter: Option<usize>,
) -> Result<CollapsedOut>
fn collapse_columns( &self, knn_batches: Option<usize>, knn_cells: Option<usize>, reference_batch_names: Option<&[Box<str>]>, num_opt_iter: Option<usize>, ) -> Result<CollapsedOut>
Collapse columns/cells into samples as allocated by
assign_columns_to_samples
§Arguments
cells_per_group- number of cells per sample (None: no down sampling)knn_batches- number of nearest neighbour batchesknn_cells- number of nearest neighbors for building HNSW (default: 10)reference- reference batch for counterfactual inferencenum_opt_iter- number of optimization iterations (default: 100)
Sourcefn build_hnsw_per_batch<T>(
&mut self,
proj_kn: &DMatrix<f32>,
col_to_batch: &[T],
) -> Result<()>
fn build_hnsw_per_batch<T>( &mut self, proj_kn: &DMatrix<f32>, col_to_batch: &[T], ) -> Result<()>
Register batch information and build a HnswMap object for
each batch for fast nearest neighbor search within each batch
and store them in the SparseIoVec
§Arguments
proj_kn- random projection matrixcol_to_batch- map: cell -> batch
fn collect_basic_stat(&self, stat: &mut CollapsedStat) -> Result<()>
fn collect_batch_stat(&self, stat: &mut CollapsedStat) -> Result<()>
fn collect_matched_stat( &self, knn_batches: usize, knn_cols: usize, reference_indices: Option<&[usize]>, stat: &mut CollapsedStat, ) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".