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_chunked;
31#[cfg(feature = "h5")]
32pub mod h5_filters;
33#[cfg(feature = "h5")]
34pub mod h5ad_io;
35#[cfg(feature = "h5")]
36pub mod h5ad_multifile_io;
37pub mod in_memory_io;
38pub mod mtx_io;
39pub mod mtx_multifile_io;
40#[cfg(feature = "parquet")]
41pub mod obs_var_io;
42#[cfg(feature = "analysis")]
43pub mod plotting;
44pub mod prelude;
45pub mod r_obj_io;
46#[cfg(feature = "analysis")]
47pub mod sc_synthetic_data;
48pub mod sc_traits;
49pub mod v4_io;
50
51/// How many cells to read in per given batch - global constant
52pub const CELL_BATCH_SIZE: usize = 50_000;
53
54/// Version of the single cell files writers emit: delta bit-packed chunks with
55/// the normalised layer recomputed on read.
56pub const SC_FILE_VERSION: u32 = 4;
57
58/// Previous file version: absolute `u32` indices, normalised layer stored.
59/// Readers still open it; `v4_io::upgrade_store_to_v4` converts it.
60pub const SC_FILE_VERSION_V3: u32 = 3;
61
62/// Number of cell rows requested per HDF5 hyperslab read.
63///
64/// This is a slice height for the h5 layer, not a cell batch size: it bounds
65/// how much of a dataset is materialised at once during ingest. Deliberately
66/// far smaller than [`CELL_BATCH_SIZE`], which sizes reads against the
67/// bixverse binary format.
68#[cfg(feature = "h5")]
69pub(crate) const H5_CELL_SLICE_SIZE: usize = 1_000;