pub enum ScDataErrors {
Show 35 variants
Sparse(SparseErrors),
Core(CoreErrors),
InvalidArgument(String),
BinaryIo(Error),
NotRawCounts,
HeaderEncodeFailed,
HeaderDecodeFailed,
FileVersionMismatch {
expected: u32,
found: u32,
},
ChunkBufferTooSmall {
expected: usize,
found: usize,
},
ChunkDecompressionFailed(u64),
ChunkIndexNotFound(usize),
ReaderModeMismatch {
actual: &'static str,
requested: &'static str,
},
ChunkPayloadTruncated {
expected: usize,
found: usize,
},
RawElemSizeInvalid(u8),
V4ChunkCorrupt(String),
V4MissingCellLibraryTable,
ArchiveMagicMismatch,
ArchiveVersionMismatch {
expected: u32,
found: u32,
},
ArchiveCorrupt(String),
RawCountOverflow {
value: u32,
target_type: &'static str,
},
TargetSizeMismatch {
header: f32,
requested: f32,
},
FeatureTypeNotFound {
requested: String,
found: String,
},
H5UnexpectedStringType(String),
Hdf5(Error),
UnsupportH5ADFormat(String),
DuplicateColumnName(String),
UnsupportedH5Filter {
dataset: String,
filter_id: i32,
filter_name: String,
},
H5ChunkDecode(String),
ObsColumnMissing(String),
LibSizeLengthMismatch {
expected: usize,
found: usize,
},
MtxHeaderInvalid(&'static str),
MtxParseError {
field: &'static str,
},
MtxUnsupported(String),
MtxNotACount {
value: String,
},
UnknownSparseFormat(String),
}Expand description
Error variants raised by bixverse-sc-data.
Grouped by subsystem.
Variants§
Sparse(SparseErrors)
Propagates an error from bixverse-sparse.
Core(CoreErrors)
Propagates an error from bixverse-core.
InvalidArgument(String)
A caller-supplied argument is invalid.
BinaryIo(Error)
Wraps any std::io::Error encountered while reading or writing the
bixverse binary sparse format.
Covers file creation, seeks, buffered writes, and raw reads against
the memory-mapped region. Use #[from] conversion so ? works on
any io::Result.
NotRawCounts
Error if counts do not seem to be raw counts during i/o
HeaderEncodeFailed
Bincode failed to encode the FileHeader or SparseDataHeader.
Practically unreachable for the fixed-layout headers used here, but kept as a non-panicking path so the writer never aborts a long ingest.
HeaderDecodeFailed
Bincode failed to decode the FileHeader or SparseDataHeader.
Indicates the file is truncated, corrupt, or was not produced by bixverse. The 64-byte fixed file header is the first thing read, so most “wrong file type” errors surface here.
FileVersionMismatch
File version does not match the current SC_FILE_VERSION.
Returned on read when an older or newer binary is opened. The fix is to regenerate the file with the current bixverse version.
Fields
ChunkBufferTooSmall
A chunk buffer was shorter than the minimum header length.
Raised before any field is parsed from a decompressed chunk, so the reader can fail early instead of indexing out of bounds.
Fields
ChunkDecompressionFailed(u64)
LZ4 decompression of a chunk failed.
The offset is reported to make corrupt regions locatable. Usually indicates file truncation or a mismatched compressed-size prefix.
ChunkIndexNotFound(usize)
A caller-supplied original index was not present in the file’s index map.
Indicates either a bug in the calling code (asking for an index that was never written) or a file that was generated with a different set of cells/genes than the caller assumes.
ReaderModeMismatch
A cell-based reader method was called on a gene-based file, or vice versa.
Replaces the previous runtime asserts. The two string fields describe the file’s actual layout and the layout the caller requested.
Fields
ChunkPayloadTruncated
A chunk’s declared payload lengths exceed the bytes actually present.
The three length fields in a chunk header are untrusted input. This is raised after they have been parsed but before any payload slice is taken, so a corrupt length cannot index out of bounds.
Fields
RawElemSizeInvalid(u8)
The raw-count element-size discriminant was not recognised.
Valid values are RAW_ELEM_U16 (2), RAW_ELEM_U32 (4), and 0 for
legacy files where the byte was zero padding. Anything else means the
chunk is corrupt; reinterpreting it would misparse the whole payload.
V4ChunkCorrupt(String)
A v4 chunk is malformed: a bad codec byte, a bit width above 32, a body that ends before its own header says it should, or layers of unequal length handed to the encoder.
V4MissingCellLibraryTable
A v4 chunk drops its norm layer and recomputes it per entry, but the file carries no per-cell library-size table to recompute it from.
ArchiveMagicMismatch
The file is not a bixverse count archive.
ArchiveVersionMismatch
The archive was written by an incompatible archive format version.
Fields
ArchiveCorrupt(String)
The archive is truncated or corrupt, or a chunk cannot be archived.
RawCountOverflow
A raw count read from disk does not fit the requested numeric type.
Raised by from_gene_chunks / from_cell_chunks instead of silently
saturating. Pick a wider T (u32, f32, f64) for the affected
dataset.
Fields
TargetSizeMismatch
The target_size recorded in a file header disagrees with the one the
caller requested.
Undoing a file’s own library-size normalisation requires the exact
factor the writer used, so a mismatch always yields wrong numbers.
Files written before target_size entered the header report 0.0 and
are exempt from the check.
FeatureTypeNotFound
Error for h5 ingestion if feature type is not found
H5UnexpectedStringType(String)
Error if the h5 string type cannot be read
Hdf5(Error)
Wraps any error from the hdf5 crate.
Covers file open failures, missing datasets (X/data, X/indices,
X/indptr, obs/*), dtype mismatches, and slice reads. The wrapped
error carries the original HDF5 message.
UnsupportH5ADFormat(String)
Provide custom error message for unsupported file formats.
DuplicateColumnName(String)
Two columns of an obs / var table end up with the same name after snake_case. DuckDB rejects the table, so the export stops before writing anything.
UnsupportedH5Filter
A dataset is compressed with a filter this build cannot decode.
Raised before the first read, because HDF5 itself reports the missing
filter as a missing plugin directory: the path baked in at build time
is a cargo OUT_DIR that no longer exists. Either re-save the file
with compression="gzip", or build with the hdf5-filters feature,
which adds LZF and Blosc.
Fields
H5ChunkDecode(String)
A chunk read directly from an HDF5 file did not decode to the size its dataset says it should, or a read asked for elements past the end.
ObsColumnMissing(String)
A named obs column was requested but does not exist in the h5ad.
Primarily raised by write_h5_normalised_counts when the caller
passes an obs_lib_size_col that isn’t in the file.
LibSizeLengthMismatch
The library-size vector read from obs does not match the number of
cells in X.
Indicates a malformed h5ad — typical cause is a user-edited obs table whose row count drifted from the matrix.
Fields
MtxHeaderInvalid(&'static str)
The header of an MTX file is malformed.
The static string describes which part of the header failed (shape
line missing, wrong field count, unparseable counts). Comment lines
starting with % are skipped before this fires.
MtxParseError
A field of the MTX shape line could not be parsed as a number.
field names the offending column (“cell count”, “gene count”,
“entry count”) so that malformed inputs can be diagnosed without
quoting user data. Which of the first two fields is which depends on
the cells_as_rows orientation.
MtxUnsupported(String)
The MTX banner names something the loader does not read: an object
other than matrix, the dense array format, a complex field or a
symmetry other than general.
MtxNotACount
An MTX value is not a raw count: negative, non-integral, not a number
or beyond u32. The store holds raw counts, so a real file of
normalised values cannot be loaded.
UnknownSparseFormat(String)
The cs_type string did not match a known sparse format.
Accepted values are “csc” and “csr” (case-insensitive at the parser level). The unrecognised input is echoed back in the message.
Trait Implementations§
Source§impl Debug for ScDataErrors
impl Debug for ScDataErrors
Source§impl Display for ScDataErrors
impl Display for ScDataErrors
Source§impl Error for ScDataErrors
impl Error for ScDataErrors
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<CoreErrors> for ScDataErrors
impl From<CoreErrors> for ScDataErrors
Source§fn from(source: CoreErrors) -> ScDataErrors
fn from(source: CoreErrors) -> ScDataErrors
Source§impl From<Error> for ScDataErrors
impl From<Error> for ScDataErrors
Source§fn from(source: Error) -> ScDataErrors
fn from(source: Error) -> ScDataErrors
Source§impl From<Error> for ScDataErrors
impl From<Error> for ScDataErrors
Source§fn from(source: Error) -> ScDataErrors
fn from(source: Error) -> ScDataErrors
Source§impl From<ScDataErrors> for ScErrors
impl From<ScDataErrors> for ScErrors
Source§fn from(source: ScDataErrors) -> ScErrors
fn from(source: ScDataErrors) -> ScErrors
Source§impl From<SparseErrors> for ScDataErrors
impl From<SparseErrors> for ScDataErrors
Source§fn from(source: SparseErrors) -> ScDataErrors
fn from(source: SparseErrors) -> ScDataErrors
Auto Trait Implementations§
impl !RefUnwindSafe for ScDataErrors
impl !UnwindSafe for ScDataErrors
impl Freeze for ScDataErrors
impl Send for ScDataErrors
impl Sync for ScDataErrors
impl Unpin for ScDataErrors
impl UnsafeUnpin for ScDataErrors
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read moreSource§fn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Source§fn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Source§fn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Source§fn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.