Skip to content

Trying to get CsrMatrix from AnnData #2

@allan2

Description

@allan2

Hi Kai,

I'm trying to read CSR from a .h5ad file in Rust. It works with anndata. I'm using the Git versions from this repo.

I'm doing something like this:

let file = H5::open(path)?;
let adata = AnnData::<H5>::open(file)?;
let slot = adata.get_x();

let mut inner = slot.extract().unwrap();
println!("{}", inner.dtype());
println!("{}", inner.shape());

let data = inner.data::<CsrMatrix<f32>>()?;
println!("{:?}", data);
CsrMatrix(f32)
54220 x 20845
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SparseFormatError { kind: InvalidStructure, error: "Column indices are not monotonically increasing (sorted) within each row." }'

InnerArrayElem requires specifying type D. Is it possible that I'm missing a step before getting the CsrMatrix?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions