
bixverse single cell subset class
SingleCellsSubset.RdSubset view onto a SingleCells() object, restricted to cells
belonging to a single level of a grouping variable. The Rust count
connection is shared with the parent (no data copy). obs_table and
var_table are held in memory; sc_map is rebuilt to point only at the
subset cells but stays in the original index space so Rust calls remain
valid without further translation.
Arguments
- sc_object
A
SingleCells()object to subset.- grouping_column
String. Column in the obs table that defines the grouping.
- group
String. Level of
grouping_columnto retain.
Properties
- count_connection
Shared Rust pointer to the on-disk counts.
- dir_data
Directory holding the binary count files.
- obs_table
Subset obs (rows for the chosen group only).
cell_idxkeeps the original 1-indexed position in the parent.- var_table
Variable/feature table (unchanged from parent).
- grouping_column
Column in obs used to define the subset.
- group
Value of
grouping_columnrepresented by this subset.- sc_cache
Fresh
ScCachefor subset-specific PCA, kNN, sNN, embeddings.- sc_map
ScMaprestricted to the subset cells.cell_mappingstays 1-indexed andcells_to_keep_idxstays 0-indexed, both in the original parent index space.- subset_to_original
Integer vector. 1-indexed original cell positions, in subset row order.
subset_to_original[i]is the parent position of subset rowi.- dims
c(n_cells_subset, n_genes).
Examples
# a view onto one cell type, sharing the parent's counts on disk
sc <- demo_single_cells(prepped = FALSE)
subset_obj <- SingleCellsSubset(
sc_object = sc,
grouping_column = "cell_grp",
group = "cell_type_1"
)
dim(subset_obj)
#> [1] 167 50
unlink(sc@dir_data, recursive = TRUE, force = TRUE)