NMF

A_preprocessing.nmf_clustering(adata, n_components=10, random_state=42, max_iter=1000, verbose=0, n_top_genes=2000)

Performs NMF clustering on AnnData object.

Parameters:
  • adata – AnnData object containing gene expression data

  • n_components – Number of NMF components to extract

  • random_state – Random seed for reproducibility

  • max_iter – Maximum number of iterations for NMF

  • verbose – Verbosity level

  • n_top_genes – Number of highly variable genes to use

Returns:

AnnData object with NMF results in .obsm[‘X_nmf’] and .uns[‘X_nmf_components’]

A_preprocessing.nmf_consensus(adata, min_clusters=4, max_clusters=10, n_resamples=100, resample_frac=0.8, random_state=42, n_cluster_genes=50)

Performs consensus clustering on NMF results.

Parameters:
  • adata – AnnData object with NMF results

  • min_clusters – Minimum number of clusters to try

  • max_clusters – Maximum number of clusters to try

  • n_resamples – Number of resampling iterations

  • resample_frac – Fraction of samples to use in each resample

  • random_state – Random seed for reproducibility

  • n_cluster_genes – Number of top genes to use per cluster

Returns:

AnnData object with cluster scores in .obs