SPECTRA is a unified, scalable framework for reconstructing metabolic models from multi-omics data. It integrates diverse optimization strategies (linear and mixed-integer linear programming) to extract metabolic networks at multiple biological scales-from minimal reactomes and context-specific models (CSMs) to microbial community models and multi-tissue models.
- MATLAB
- COBRA toolbox
- CPLEX or Gurobi (for optimization)
git clone https://github.com/NiravBhattLab/SPECTRA.git
cd SPECTRAThis repository contains the code necessary to reproduce the results and figures presented in the main manuscript and supplementary information. The scripts are organized into corresponding folders.
Located in BuildCancerModels/
Build context-specific models using DepMap transcriptomics data.
- Workflow:
DepMapModels_Recon/PrepareDepMapData.m: Extract transcriptomics data.DepMapModels_Recon/modGenesIDConv.m: Convert gene IDs inUpdatedRecon3D.mat.DepMapModels_Recon/GiniReactionImportance.m: Obtain core reactions from transcriptomics.DepMapModels_Recon/BuildDepMapModels.m: Build models using fastcore, swiftcore, and SPECTRA methods.
- Analysis:
coverage_core/Cancerrxnscoverage.m: to calculate the count of cancer hallmark reactions captured by the models.flux_results/andfva/: Evaluate FVA span ratios and flux enrichment analysis.
Located in Recon3D+/
Contains the updated version of Recon3D (UpdatedRecon3D.mat) file with manually curated reactions
Located in RuntimeComparisons/
Use these scripts to benchmark the runtime performance of SPECTRA formulations.
ForSPECTRA_CCResults.m: Efficiency comparison for Consistency Checking.ForSPECTRA_MEResults.m: Efficiency comparison for model building with an input consistent universal model.ForSPECTRA_CC_MEResults.m: Efficiency comparison for model building with an input inconsistent universal model.checkModelQuality.m: Helper script to evaluate output models to check if the core reactions are present and to confirm if the model is consistent.
Located in RandomReactionRemovalAGORA/ and gapFilledAGORA_DB/
Evaluates the SPECTRA for random reaction removal and gapfilling entire AGORA2 database.
RandomReactionRemovalAGORA/GapFillAGORADraftModels.m: gapfills the draft models generated by randomly removing a certain percent of reactions in the AGORA2 modelsRandomReactionRemovalAGORA/getResultsOnGapfill30_LP_MILP_DC.m: Evaluates the built models using distinct metrics like Recall, Precision and F1 score.gapFilledAGORA_DB/BuildUmodelFromAGORAdb.m: To build an uninversal model for AGORA2 modelsgapFilledAGORA_DB/GetGapFilledAGORAmodel.m: To get the gapfilled AGORA2 models
Located in Verify_new_reactions_AGORA_using_DL/
Verify the biological viability of the new reactions.
getECmatch.m: Matches deep-learning-based Enzyme Commission (EC) numbers with newly obtained reactions.
Located in LP7_vs_LPf/
Evaluates efficiency of LPforwardCC against LP7 of fastcore.
LP7_LPf.m: Benchmarking and demonstrating the efficiency of SPECTRA LP-based fast consistency checker vs existing tool.
Located in hCOM_community/
To build microbial community model.
RandomDeletion_AGORA/: Codes required for random reactions removal from AGORA2 database and community scale gapfillingCommunityGapFilling/: Codes for building a community scale model using carveme's unviversal model.
Located in Visualisations/
Contains Python Notebooks (.ipynb) and MATLAB .mat files that were used to plot the final paper figures.
The omics data can be used to derive the following three inputs to SPECTRA.
| Parameter | Purpose |
|---|---|
| Core reactions | These reactions will be present in the final model |
| Weights | Numbers that determine the relative importance of the reactions to be included (or excluded) |
| Box contraints | Lower and upper bounds to the reactions in the universal model |
The following code demonstrates the same for a toy network model:
% loading the universal model
model = three_pathway_toy_model(); % A toy model with eight metabolites and eleven reactions
% defining the box constraints
model.ub(:) = 10;
model.ub([1,6,9]) = 1; % constraining the media reactions
% defining the core reactions
core = 5; % the reaction indices of the core reactions
% defining the weights of the reactions (For this example, we are using tradeOff as the network inference method)
weights = [1,1,-2,-1,1,1,2,-1,-2,0,1]'; % Same size as the number of reactions| Formulation | Objective | Use Case | Input Weights |
|---|---|---|---|
| minNetLP | Minimize total flux | Extracting minimal networks preserving core reactions | Non-negative weights |
| minNetMILP | Minimize reaction count | Extracting minimal networks preserving core reactions | Non-negative weights |
| minNetDC | Cardinality minimization | Extracting minimal networks preserving core reactions | Non-negative weights |
| tradeOff | Maximize weighted reactions | Balancing positive vs. negative evidence | Any real values |
| optimBiomass | Maximize biomass + minimize flux | Biological growth optimization | Non-negative weights |
% For flux consistent universal models
consType = 'stoichiometry'; % to use stoichiometric constraints or topology constraints
probType = 'tradeOff'; % network inference method
altSolMethod = {}; % method to obtain alternate solutions
nSol = 1; % number of alternate solutions required
solveTime = 7200; % maximum time for solving MILP problem
tol = 1e-5; % defining the small positive number
[Model_tradeOff] = spectraME(model,core,tol,consType,weights,nSol,altSolMethod,probType,solveTime);
% For flux inconsistent universal models (simultaneous consistency checking + extraction)
[Model_tradeOff] = spectraCCME(model,core,tol,consType,weights,nSol,altSolMethod,probType,solveTime); % Pathway exclusion (for MILP formulations like tradeOff and minNetMILP)
altSolMethod = 'pathwayExclusion'; % method to obtain alternate solutions
nSol = 5; % number of alternate solutions required
[Model_tradeoff_altSols] = spectraME(model,core,tol,consType,weights,nSol,altSolMethod,probType,solveTime); 