GeneNMF R Package

repository·master·Indexed 41 days ago

https://github.com/carmonalab/genenmf

An R package for the discovery of recurrent gene programs in multi-sample single-cell omics data using Non-negative Matrix Factorization (NMF). It provides tools to reduce dimensionality via `runNMF()`, extract robust meta-programs across multiple samples using `multiNMF()` and `getMetaPrograms()`, and tune decomposition sparsity through parameters like `specificity.weight`.

Tokens
753
Snippets
4
Records
5
Agent score
3%

What's inside GeneNMF

  1. Discover meta-programs using `multiNMF()` and `getMetaPrograms()`

    master

    GeneNMF provides a workflow to extract robust gene programs (meta-programs) across multiple samples and different NMF factor counts ($k$).

    1. multiNMF(sampleObj.list, k): Performs NMF over a list of Seurat objects for multiple values of $k$.
    2. getMetaPrograms(geneNMF.programs, nMP): Clusters the resulting gene programs into consensus meta-programs (MPs). It computes MP metrics and identifies the most influential MP genes.

    Example workflow:

    # 1. Split a Seurat object into a list (e.g., by donor)
    sampleObj.list <- Seurat::SplitObject(sampleObj, split.by = "donor")
    
    # 2. Run NMF for a range of k values
    geneNMF.programs <- multiNMF(sampleObj.list, k=4:9)
    
    # 3. Extract consensus meta-programs
    geneNMF.metaprograms <- getMetaPrograms(geneNMF.programs, nMP=5)
    sampleObj.list <- Seurat::SplitObject(sampleObj, split.by = "donor")
    geneNMF.programs <- multiNMF(sampleObj.list, k=4:9)
    geneNMF.metaprograms <- getMetaPrograms(geneNMF.programs, nMP=5)
  2. Install GeneNMF

    master

    You can install the stable release of GeneNMF from CRAN or the latest development version from GitHub using the remotes package.

    # Install release version from CRAN
    install.packages("GeneNMF")
    
    # Or for the latest version, install from GitHub
    library(remotes)
    remotes::install_github("carmonalab/GeneNMF")
  3. Configure GeneNMF parameters for sparsity and meta-program extraction

    master

    GeneNMF includes several parameters to tune the decomposition and the identification of meta-programs:

    Decomposition Parameters

    • specificity.weight: Used to re-normalize NMF loadings to impose sparsity in the decomposition based on how specific a gene is for a given program.
    • scale: Boolean to determine if expression matrices should be scaled (default behavior is not scaled).
    • center: Boolean to determine if expression matrices should be centered (default behavior is not centered).

    Meta-program (MP) Parameters

    • nMP: The number of meta-programs to extract (formerly nprograms).
    • weight.explained: A fraction of the total weight used to determine which genes are included in an MP. Only genes that cumulatively explain up to this fraction are included.
    • min.confidence: Defines the confidence of a gene in an MP. Confidence is calculated as the fraction of individual programs in which the gene is determined to be part of the program (using weight.explained=0.8).