scib.preprocessing.reduce_data

scib.preprocessing.reduce_data(adata, batch_key=None, flavor='cell_ranger', n_top_genes=2000, n_bins=20, pca=True, pca_comps=50, overwrite_hvg=True, neighbors=True, use_rep='X_pca', umap=False)

Apply feature selection and dimensionality reduction steps.

Wrapper function of feature selection (highly variable genes), PCA, neighbours computation and dimensionality reduction. Highly variable gene selection is batch-aware, when a batch key is given.

Parameters:
  • adataanndata object with normalised and log-transformed data in adata.X

  • batch_key – column in adata.obs containing batch assignment

  • flavor – parameter for scanpy.pp.highly_variable_genes

  • n_top_genes – parameter for scanpy.pp.highly_variable_genes

  • n_bins – parameter for scanpy.pp.highly_variable_genes

  • pca – whether to compute PCA

  • pca_comps – number of principal components

  • overwrite_hvg – if True, ignores any pre-existing ‘highly_variable’ column in adata.var and recomputes it if n_top_genes is specified else calls PCA on full features. if False, skips HVG computation even if n_top_genes is specified and uses pre-existing HVG column for PCA

  • neighbors – whether to compute neighbours graph

  • use_rep – embedding to use for neighbourhood graph

  • umap – whether to compute UMAP representation