bioalpha.singlecell.read_10x_mtx

bioalpha.singlecell.read_10x_mtx(path: Path | str, var_names: Literal['gene_symbols', 'gene_ids'] = 'gene_symbols', make_unique: bool = True, gex_only: bool = True, *, prefix: str | None = None) AnnData

Fast read 10x-Genomics-formatted mtx directory.

Parameters:
  • path (Union[Path, str]) – Path to directory for .mtx and .tsv files, e.g. “./filtered_gene_bc_matrices/hg19/”.

  • var_names (Literal["gene_symbols", "gene_ids"], default = “gene_symbols”) – The variables index.

  • make_unique (bool: default = True) – Whether to make the variables index unique by appending "-1", "-2" etc. or not.

  • gex_only (bool, default = True) – Only keep "Gene Expression" data and ignore other feature types, e.g. "Antibody Capture", "CRISPR Guide Capture", or "Custom"

  • prefix (str, default = None) – Any prefix before matrix.mtx, genes.tsv and barcodes.tsv (matrix.mtx.gz, features.tsv.gz and barcodes.tsv.gz for Cell Ranger v3 or later). For instance, if the files are named patientA_matrix.mtx, patientA_genes.tsv and patientA_barcodes.tsv the prefix is patientA_. (Default: no prefix)

Returns:

adata – The annotated data matrix of shape n_obs x n_vars. Rows correspond to cells and columns to genes.

Return type:

AnnData