scMetabolism

repository·main·Indexed 41 days ago

https://github.com/wu-yc/scmetabolism

An R package for quantifying metabolic activity at single-cell resolution using scRNA-seq data. It supports human data, Seurat objects, and standard count matrices, utilizing scoring methods such as VISION, AUCell, ssgsea, and gsva. It integrates with KEGG and REACTOME pathway databases and provides visualization tools including DimPlot.metabolism, DotPlot.metabolism, and BoxPlot.metabolism.

Tokens
1.4K
Snippets
6
Records
6
Agent score
2%

What's inside scMetabolism

  1. Install scMetabolism and its dependencies

    main

    To use scMetabolism, you must first install several R dependencies and the VISION package. Follow these steps in your R environment:

    1. Install required CRAN packages.
    2. Install VISION from GitHub (version v3.0.2 is recommended to avoid dependency issues in newer R environments).
    3. Install scMetabolism from GitHub.

    Note: scMetabolism currently supports human scRNA-seq data.

    # 1. Install dependencies
    install.packages(c("devtools", "data.table", "wesanderson", "Seurat", "AUCell", "GSEABase", "GSVA", "ggplot2", "rsvd"))
    
    # 2. Install VISION
    devtools::install_github("YosefLab/VISION@v3.0.2")
    
    # 3. Install scMetabolism
    devtools::install_github("wu-yc/scMetabolism")
  2. Visualize metabolism with BoxPlot.metabolism

    main

    Use BoxPlot.metabolism to create box plots of metabolic pathway activity across different cell phenotypes.

    Parameters:

    • obj: A Seurat object containing the UMI count matrix and metabolism scores.
    • pathway: A character vector of pathway names.
    • phenotype: String; the name of the metadata feature to group by (e.g., "ident").
    • ncol: Integer; the number of columns per row in the plot layout.

    Returns a ggplot object.

    input.pathway <- c("Glycolysis / Gluconeogenesis", "Oxidative phosphorylation", "Citrate cycle (TCA cycle)")
    BoxPlot.metabolism(obj = countexp.Seurat, pathway = input.pathway, phenotype = "ident", ncol = 1)
  3. Quantify single-cell metabolism without Seurat

    main

    If you are not using Seurat, you can quantify metabolism using a standard data frame.

    Parameters:

    • countexp: A data frame of the UMI count matrix where columns are Cell IDs and rows are Gene names.
    • method: The scoring algorithm. Supports VISION (default), AUCell, ssgsea, and gsva.
    • imputation: Boolean; whether to impute data before scoring.
    • ncores: Integer; number of threads for parallel computation.
    • metabolism.type: The pathway database. Supports KEGG and REACTOME.

    Returns a metabolism.matrix.

    metabolism.matrix <- sc.metabolism(countexp = countexp, method = "AUCell", imputation = F, ncores = 2, metabolism.type = "KEGG")
  4. Visualize metabolism with DimPlot.metabolism

    main

    Use DimPlot.metabolism to visualize a specific metabolic pathway on a dimensionality reduction plot (e.g., UMAP or t-SNE).

    Parameters:

    • obj: A Seurat object containing the UMI count matrix and metabolism scores.
    • pathway: String; the name of the pathway of interest.
    • dimention.reduction.type: String; either umap or tsne.
    • dimention.reduction.run: Boolean; whether to re-run the dimensionality reduction.
    • size: Numeric; the dot size in the plot.

    Returns a ggplot object.

    DimPlot.metabolism(obj = countexp.Seurat, pathway = "Glycolysis / Gluconeogenesis", dimention.reduction.type = "umap", dimention.reduction.run = F, size = 1)
  5. Visualize metabolism with DotPlot.metabolism

    main

    Use DotPlot.metabolism to create a dot plot showing metabolic pathway activity across different cell phenotypes.

    Parameters:

    • obj: A Seurat object containing the UMI count matrix and metabolism scores.
    • pathway: A character vector of pathway names.
    • phenotype: String; the name of the metadata feature to group by (e.g., "ident").
    • norm: String; scaling method for values. Supports "x", "y", and "na".

    Returns a ggplot object.

    input.pathway <- c("Glycolysis / Gluconeogenesis", "Oxidative phosphorylation", "Citrate cycle (TCA cycle)")
    DotPlot.metabolism(obj = countexp.Seurat, pathway = input.pathway, phenotype = "ident", norm = "y")
  6. Quantify single-cell metabolism using Seurat (Recommended)

    main

    The recommended way to quantify metabolism is by using a Seurat object. Use the sc.metabolism.Seurat function to calculate scores for metabolic pathways.

    Parameters:

    • obj: A Seurat object containing the UMI count matrix.
    • method: The scoring algorithm. Supports VISION (default), AUCell, ssgsea, and gsva.
    • imputation: Boolean; whether to impute data before scoring.
    • ncores: Integer; number of threads for parallel computation.
    • metabolism.type: The pathway database. Supports KEGG (85 pathways) and REACTOME (82 pathways).

    To retrieve the resulting scores, access the METABOLISM assay in the Seurat object.

    countexp.Seurat <- sc.metabolism.Seurat(obj = countexp.Seurat, method = "AUCell", imputation = F, ncores = 2, metabolism.type = "KEGG")
    
    # Extract the metabolism score matrix
    metabolism.matrix <- countexp.Seurat@assays$METABOLISM$score