1. Getting started

1.1. Requirements

In order to install PTA you need:

  • Windows, Linux or OSX operating system.

  • Python 3.8 or newer.

  • One of the QP + MILP solvers supported by CVXPY. For models where all reaction directions are fixed, a QP solver is sufficient.

  • Optional (only for running the samplers):

    • A compiler supporting C++ 17.

    • The Gurobi solver (free for academia). Make sure you install the python bindings. On OSX systems you may need to manually set the environment variable GUROBI_HOME to /Library/gurobi<version>/<platform>, since the Gurobi installer does not do it automatically.

1.2. Installation

Once your system satisfies all the requirements, you can install PTA through the Python Package Index:

pip install pta

1.2.1. Installing PTA without samplers

You can install PTA without compiling the samplers by defining the PTA_NO_SAMPLERS environment variable:

PTA_NO_SAMPLERS=1 pip install pta             # Linux, OSX
set "PTA_NO_SAMPLERS=1" && pip install pta    # Windows

Installing PTA this way does not require Gurobi and the C++ compiler, but the functionalities will be limited to running PMO and model assessment methods. The sampler will not work.

1.3. Simple example

This example shows a basic workflow with PTA. First it loads a model and creates its thermodynamic space, then it runs PMO and TFS on it.

 1import enkie
 2import pta
 3
 4# Load a SBML model and set bounds on known rates (e.g. growth).
 5model = pta.load_example_model("e_coli_core")
 6model.reactions.BIOMASS_Ecoli_core_w_GAM.lower_bound = 0.5
 7
 8# Preprocess the model to make sure it is thermodynamically consistent.
 9pta.prepare_for_pta(model)
10
11# Construct the thermodynamic space of the model.
12thermodynamic_space = pta.ThermodynamicSpace.from_cobrapy_model(
13  model,
14  metabolites_namespace="bigg.metabolite",
15  parameters=enkie.CompartmentParameters.load("e_coli")
16)
17
18# Run PMO on the model (by default it maximizes the probability of concentrations
19# and reaction energies).
20problem = pta.PmoProblem(model, thermodynamic_space)
21problem.solve()
22
23# Analyze the predicted concentrations and reaction energies, revealing potential
24# knowledge gaps and inaccuracies in the model.
25pta.QuantitativeAssessment(problem).summary()
26
27# Sample the thermodynamic space of the network.
28tfs_model = pta.TFSModel(model, thermodynamic_space, solver="GUROBI")
29sampling_result = pta.sample_drg(tfs_model)
30# sampling_result now contains samples of reaction energies as well as the
31# probability of each orthant.

1.4. Expanding the example

The next pages of this documentation provide more details about each step and how to customize it for your work. You can also look at additional examples.

  • You can gain more control over the preprocessing step.

  • The thermodynamic space should be constructed using parameters (pH, ionic strength, …) and metabolite concentrations representative of the system you are modeling.

  • You can use different objectives for PMO and access the predicted values directly.

  • You can use the information provided by QuantitativeAssessment to curate your model.

  • TFS can be used to characterize the feasible thermodynamic and flux spaces of the network.