smurf.singlecellanalysis

smurf.singlecellanalysis(adata, save=False, iter=None, path=None, resolution=2, regress_out=True, random_state=0, show=True)

Performs standard single-cell RNA-seq analysis, including preprocessing, dimensionality reduction, clustering, and visualization.

This function takes an AnnData object containing single-cell gene expression data and performs a series of standard analysis steps:

  • Filters genes expressed in a minimum number of cells.

  • Calculates quality control (QC) metrics, including mitochondrial gene content.

  • Normalizes and log-transforms the data.

  • Identifies highly variable genes.

  • Regresses out effects of total counts and mitochondrial gene expression (optional).

  • Scales the data.

  • Performs principal component analysis (PCA).

  • Computes the neighborhood graph and UMAP embedding.

  • Performs Leiden clustering.

  • Optionally visualizes the UMAP embedding colored by cluster assignments.

Parameters:
  • adata (anndata.AnnData) – An AnnData object containing single-cell gene expression data.

  • save (bool or str, optional) – Whether to save the UMAP plot. If True, saves the plot with a default filename. If a string is provided, saves the plot with the given filename. Defaults to False.

  • iter (default: None) – An iteration or index number used in saving the plot filename. Only used if save is True. Defaults to None.

  • path (str or None, optional) – The directory path where the plot will be saved. Not used in the current implementation. Defaults to None.

  • resolution (float, optional) – The resolution parameter for Leiden clustering, controlling the granularity of the clusters. Defaults to 2.

  • regress_out (bool, optional) – Whether to regress out effects of total counts and mitochondrial percentage during preprocessing. Defaults to True.

  • random_state (int, optional) – The seed for random number generators to ensure reproducibility. Defaults to 0.

  • show (bool, optional) – Whether to print progress messages and show plots. Defaults to True.

Returns:

The AnnData object after processing, including clustering results and UMAP embeddings.

Return type:

anndata.AnnData