Skip to main content

bixverse_sc_data/
lib.rs

1//! The single cell data layer: the bixverse binary sparse format, its
2//! streaming readers and writers, and ingestion from h5ad, 10x h5 (feature
3//! `h5`) and MTX.
4//!
5//! ## Feature flags
6#![doc = document_features::document_features!()]
7#![allow(clippy::needless_range_loop)]
8#![warn(missing_docs)]
9
10/// Version of this crate.
11///
12/// Exposed so a dependent can report which version of the numerics it was
13/// built against. The Python bindings version independently and vendor this
14/// crate through a path dependency, so their own version number says nothing
15/// about what is inside the wheel; this does.
16pub const VERSION: &str = env!("CARGO_PKG_VERSION");
17
18pub mod archive_io;
19pub mod bin_merge_io;
20pub mod data_io;
21pub mod errors;
22pub mod gene_file_io;
23#[cfg(feature = "h5")]
24pub mod h5_10x_adt_io;
25#[cfg(feature = "h5")]
26pub mod h5_10x_io;
27#[cfg(feature = "h5")]
28pub mod h5_10x_multifile_io;
29#[cfg(feature = "h5")]
30pub mod h5_filters;
31#[cfg(feature = "h5")]
32pub mod h5ad_io;
33#[cfg(feature = "h5")]
34pub mod h5ad_multifile_io;
35pub mod in_memory_io;
36pub mod mtx_io;
37pub mod mtx_multifile_io;
38#[cfg(feature = "analysis")]
39pub mod plotting;
40pub mod prelude;
41pub mod r_obj_io;
42#[cfg(feature = "analysis")]
43pub mod sc_synthetic_data;
44pub mod sc_traits;
45pub mod v4_io;
46
47/// How many cells to read in per given batch - global constant
48pub const CELL_BATCH_SIZE: usize = 50_000;
49
50/// Version of the single cell files writers emit: delta bit-packed chunks with
51/// the normalised layer recomputed on read.
52pub const SC_FILE_VERSION: u32 = 4;
53
54/// Previous file version: absolute `u32` indices, normalised layer stored.
55/// Readers still open it; `v4_io::upgrade_store_to_v4` converts it.
56pub const SC_FILE_VERSION_V3: u32 = 3;
57
58/// Number of cell rows requested per HDF5 hyperslab read.
59///
60/// This is a slice height for the h5 layer, not a cell batch size: it bounds
61/// how much of a dataset is materialised at once during ingest. Deliberately
62/// far smaller than [`CELL_BATCH_SIZE`], which sizes reads against the
63/// bixverse binary format.
64#[cfg(feature = "h5")]
65pub(crate) const H5_CELL_SLICE_SIZE: usize = 1_000;