Skip to content

Zaoqu-Liu/METAFlux

 
 

Repository files navigation

METAFLUX METAFLUX logo

High-Performance Genome-Scale Metabolic Flux Analysis for Bulk and Single-Cell Transcriptomics

R-universe CRAN status License: MIT Nature Communications

📖 Documentation: https://zaoqu-liu.github.io/METAFlux/


Abstract

METAFLUX is a computationally optimized R package for genome-scale metabolic flux analysis (MFA) from bulk and single-cell RNA sequencing data. Building upon the theoretical framework of METAFlux (Huang et al., Nature Communications, 2023), this implementation leverages the Human Genome-scale Metabolic model (Human-GEM) to infer 13,082 intracellular metabolic reaction fluxes through constraint-based flux balance analysis (FBA).

The package provides:

  • Metabolic Reaction Activity Scores (MRAS) derived from gene expression profiles
  • Flux Balance Analysis (FBA) via quadratic programming optimization
  • Community metabolic modeling for single-cell tumor microenvironment analysis
  • Cross-platform compatibility with optimized parallel computing

Theoretical Background

Flux Balance Analysis

METAFLUX employs constraint-based metabolic modeling to predict intracellular fluxes. The steady-state assumption yields:

$$\mathbf{S} \cdot \mathbf{v} = 0$$

where $\mathbf{S}$ is the stoichiometric matrix (8,378 metabolites × 13,082 reactions) and $\mathbf{v}$ is the flux vector. The optimization objective maximizes biomass production:

$$\max_{\mathbf{v}} \quad c^T \mathbf{v} \quad \text{subject to} \quad \mathbf{S} \cdot \mathbf{v} = 0, \quad \mathbf{lb} \leq \mathbf{v} \leq \mathbf{ub}$$

Gene-Protein-Reaction Mapping

Reaction activity scores integrate gene expression with enzyme kinetics through:

  • Isoenzyme (OR): $\text{Score} = \sum_i \frac{e_i}{w_i}$ (additive expression)
  • Enzyme complex (AND): $\text{Score} = \min_i \frac{e_i}{w_i}$ (rate-limiting subunit)

where $e_i$ is gene expression and $w_i$ is the gene occurrence weight across the metabolic network.

Community Modeling

For single-cell analysis, METAFLUX constructs a community stoichiometric matrix incorporating:

  • Intracellular metabolism within each cell type
  • Intercellular metabolite exchange
  • Competition for shared extracellular nutrients

Installation

From R-universe (Recommended)

install.packages("METAFLUX", repos = "https://zaoqu-liu.r-universe.dev")

From GitHub

# install.packages("remotes")
remotes::install_github("Zaoqu-Liu/METAFLUX")

Dependencies

# Core dependencies
install.packages(c("osqp", "Matrix", "dplyr", "stringr", "stringi"))

# For single-cell analysis
install.packages("Seurat")  # Version ≥ 4.0.0

# For parallel computing
install.packages(c("parallel", "foreach", "doParallel"))

Quick Start

Bulk RNA-seq Pipeline

library(METAFLUX)

# Load example data
data("bulk_test_example")  # Gene expression matrix
data("human_blood")        # Nutrient medium composition

# Step 1: Calculate Metabolic Reaction Activity Scores (MRAS)
mras <- calculate_reaction_score(bulk_test_example)

# Step 2: Compute metabolic fluxes via FBA
flux <- compute_flux(mras = mras, medium = human_blood)

# Analyze specific pathways
glycolysis_flux <- flux[grep("glycolysis", rownames(flux), ignore.case = TRUE), ]

Single-Cell RNA-seq Pipeline

library(METAFLUX)

# Load Seurat object and medium
data("sc_test_example")
data("human_blood")

# Step 1: Bootstrap aggregation for noise reduction
avg_expr <- calculate_avg_exp(
  myseurat = sc_test_example,
  myident = "Cell_type",
  n_bootstrap = 100,
  seed = 42
)

# Step 2: Calculate MRAS
mras <- calculate_reaction_score(avg_expr)

# Step 3: Define cell type fractions
fractions <- as.numeric(table(sc_test_example$Cell_type) / ncol(sc_test_example))

# Step 4: Community-based flux calculation
flux <- compute_sc_flux(
  num_cell = length(unique(sc_test_example$Cell_type)),
  fraction = fractions,
  fluxscore = mras,
  medium = human_blood,
  parallel = TRUE,
  n_cores = 4
)

Data Requirements

Input Data

Data Type Format Requirements
Bulk RNA-seq Matrix/Data frame Rows: HGNC gene symbols; Columns: samples; Values: normalized expression (TPM/FPKM)
Single-cell Seurat object RNA assay with normalized counts; metadata with cell type annotations
Medium Data frame Columns: metabolite, reaction_name

Available Medium Profiles

  • human_blood: Human serum/plasma composition (for tissue samples)
  • cell_medium: DMEM/F12 culture medium (for cell lines)

Output Interpretation

Flux Values

Value Interpretation
Positive Net production / forward reaction
Negative Net consumption / uptake
Zero Reaction inactive or at steady state

Key Reactions

# Biomass production (growth rate)
flux["biomass_human", ]

# Glucose uptake
flux["HMR_9034", ]  # Should be negative (consumption)

# Lactate secretion (Warburg effect)
flux["HMR_9135", ]  # Positive in cancer cells

Performance

Computational benchmarks on Intel i7-10700K (8 cores), 32GB RAM:

Analysis Type Dataset Size Execution Time
Bulk RNA-seq 100 samples ~2 min
Bulk RNA-seq 500 samples ~10 min
Single-cell 5,000 cells × 4 types ~4 min
Single-cell 10,000 cells × 8 types ~15 min

Citation

If you use METAFLUX in your research, please cite:

Huang Y, Mohanty V, Dede M, Tsai K, Daher M, Li L, Rezvani K, Chen K. Characterizing cancer metabolism from bulk and single-cell RNA-seq data using METAFlux. Nature Communications 14, 4883 (2023). https://doi.org/10.1038/s41467-023-40457-w

@article{huang2023metaflux,
  title={Characterizing cancer metabolism from bulk and single-cell RNA-seq data using METAFlux},
  author={Huang, Yuefan and Mohanty, Vakul and Dede, Merve and Tsai, Kyle and Daher, May and Li, Li and Rezvani, Katayoun and Chen, Ken},
  journal={Nature Communications},
  volume={14},
  number={1},
  pages={4883},
  year={2023},
  publisher={Nature Publishing Group},
  doi={10.1038/s41467-023-40457-w}
}

Related Resources

License

MIT License © 2024-2026 Zaoqu Liu

Original METAFlux © 2023 Yuefan Huang, Ken Chen Lab, MD Anderson Cancer Center

Acknowledgments

This package builds upon the foundational work of the Ken Chen Laboratory at MD Anderson Cancer Center. We acknowledge the Human-GEM consortium for providing the genome-scale metabolic model.


GitHub R-universe

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • R 90.8%
  • C++ 9.2%