📖 Documentation: https://zaoqu-liu.github.io/METAFlux/
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:
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}$$
Reaction activity scores integrate gene expression with enzyme kinetics through:
where $e_i$ is gene expression and $w_i$ is the gene occurrence weight across the metabolic network.
For single-cell analysis, METAFLUX constructs a community stoichiometric matrix incorporating:
install.packages("METAFLUX", repos = "https://zaoqu-liu.r-universe.dev")
# install.packages("remotes")
remotes::install_github("Zaoqu-Liu/METAFLUX")
# 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"))
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), ]
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 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
|
human_blood: Human serum/plasma composition (for tissue samples)cell_medium: DMEM/F12 culture medium (for cell lines)| Value | Interpretation |
|---|---|
| Positive | Net production / forward reaction |
| Negative | Net consumption / uptake |
| Zero | Reaction inactive or at steady state |
# 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
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 |
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}
}
MIT License © 2024-2026 Zaoqu Liu
Original METAFlux © 2023 Yuefan Huang, Ken Chen Lab, MD Anderson Cancer Center
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.