PlanesLab / gMCSpy

Efficient calculation of gMCS in python.
https://planeslab.github.io/gMCSpy/
MIT License
6 stars 1 forks source link
genetic-minimal-cut-sets gmcs gmcspy metabolism

gMCSpy

Python versions Downloads Tests

gMCSpy is a python package for the calculation of Genetic Minimal Cut sets (GMCS). In simple terms the idea is to take a metabolic model and calculate the genetic vulnerabilities that will render the biomass production impossible. This is done through a Mixed-Integer Linear problem (MILP) formultion and the use of a linear solver.
The models must come from the cobrapy package and a linear solver must be installed. The package has been design to be used with Gurobi, CPLEX and SCIP.

Documentation

Documentation

Installation

Install gmcspy from pip

  pip install gmcspy

Quick Start

Calculating Genetic Minimal Interventions

Genetic Minimal Intervention Sets

E. coli core

#Read the model 
from pathlib import Path
from cobra.io import load_model
model = load_model("textbook")

To calculate all the GMCS of length 3 or less; using gurobi as solver

#Calculate the genetic minimal cut sets
from gMCSpy import calculateGeneMCS

calculateGeneMCS(
        cobraModel=model,
        maxKOLength=3,
        solver='gurobi'
)

### Using CPLEX

calculateGeneMCS(
        cobraModel=model,
        maxKOLength=3,
        solver='cplex'
)

Human-GEM (*Requires License Activation: CPLEX and Gurobi)

Using HUMAN GEM (v16) from here.

mkdir data
curl -o data/Human-GEM16.mat --location --remote-header-name https://github.com/SysBioChalmers/Human-GEM/raw/v1.16.0/model/Human-GEM.mat
#Read the model 
from pathlib import Path
from cobra.io import load_matlab_model

mini_mat_path = Path(".") / "./data/Human-GEM16.mat"
model = load_matlab_model(str(mini_mat_path.resolve()))

To calculate all the GMCS of length 3 or less; using gurobi as solver

#Calculate the genetic minimal cut sets
from gMCSpy import calculateGeneMCS

calculateGeneMCS(
        cobraModel=model,
        maxKOLength=3,
        solver='gurobi'
)

Table with the results:

Order Solution
order1_0 frozenset({'ENSG00000106105'})
order1_1 frozenset({'ENSG00000084774'})
... ...
order3_159 frozenset({'ENSG00000156471', 'ENSG00000185813', 'ENSG00000213930'})

Authors