METAFLUX is a high-performance R package for genome-scale metabolic flux analysis (MFA) from transcriptomic data. This package implements the METAFlux algorithm (Huang et al., Nature Communications, 2023) with significant computational optimizations.
# Load example data
data("bulk_test_example")
data("human_blood")
# Step 1: Calculate Metabolic Reaction Activity Scores (MRAS)
mras <- calculate_reaction_score(bulk_test_example)
# Step 2: Compute metabolic fluxes
flux <- compute_flux(mras = mras, medium = human_blood)
# View results
dim(flux) # 13082 reactions × n samples# Load data
data("sc_test_example")
data("human_blood")
# Step 1: Bootstrap aggregation
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: Community flux calculation
fractions <- as.numeric(table(sc_test_example$Cell_type) / ncol(sc_test_example))
flux <- compute_sc_flux(
num_cell = length(unique(sc_test_example$Cell_type)),
fraction = fractions,
fluxscore = mras,
medium = human_blood
)┌─────────────────────────────────────────────────────────────────┐
│ METAFLUX Workflow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Gene Expression Data │
│ │ │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ calculate_reaction_score() │ → MRAS (13,082 reactions) │
│ └─────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ compute_flux() │ → Bulk RNA-seq │
│ │ compute_sc_flux() │ → Single-cell │
│ └─────────────────────────────┘ │
│ │ │
│ ▼ │
│ Metabolic Flux Matrix │
│ │
└─────────────────────────────────────────────────────────────────┘
| Data Type | Format | Requirements |
|---|---|---|
| Bulk RNA-seq | Matrix | Rows: HGNC symbols, Columns: samples |
| Single-cell | Seurat object | RNA assay with cell type annotations |
| Medium | Data frame | Columns: metabolite, reaction_name |
If you use METAFLUX in your research, please cite:
Huang Y, et al. 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