gedi2py.io.read_10x_h5

gedi2py.io.read_10x_h5(filename, *, genome=None, gex_only=True)[source]

Read 10X Genomics H5 file.

Reads gene expression data from 10X Genomics HDF5 format files, including those from Cell Ranger.

Parameters:
  • filename (str | Path) – Path to the 10X H5 file.

  • genome (str | None, default: None) – Genome name to read (for multi-genome references). If None, reads the first available genome.

  • gex_only (bool, default: True) – If True, only read gene expression features (exclude antibody capture, CRISPR, etc. for multi-modal data).

Returns:

  • X: Sparse count matrix (cells × genes)

  • obs: Cell barcodes

  • var: Gene information (id, name, feature_type)

Return type:

Annotated data matrix with

Notes

Compatible with:
  • Cell Ranger v2 (matrix.h5)

  • Cell Ranger v3+ (filtered_feature_bc_matrix.h5)

  • Multi-modal outputs

Examples

>>> import gedi2py as gd
>>> adata = gd.read_10x_h5("filtered_feature_bc_matrix.h5")
>>> adata
AnnData object with n_obs × n_vars = 5000 × 20000