Community level microbiome metabolic modeling in Python
Project description
pymgpipe |
Coverage Report
File | Stmts | Miss | Cover | Missing |
---|---|---|---|---|
pymgpipe | ||||
coupling.py | 39 | 6 | 85% | 20, 43, 46–47, 52, 67 |
diet.py | 103 | 19 | 82% | 16, 22, 396–397, 437–453, 466–477, 482–485, 494, 496, 525 |
fva.py | 144 | 59 | 59% | 32, 36, 88–92, 98, 107–113, 116–117, 120–121, 139–149, 165, 174–235, 244 |
io.py | 106 | 37 | 65% | 17, 55, 61–66, 80–81, 95–96, 108, 111, 117–120, 125–133, 142, 146–147, 152–157, 161–167, 176–177 |
main.py | 148 | 44 | 70% | 112, 115, 167, 210–212, 243–297, 304, 309–310, 323 |
metrics.py | 24 | 21 | 12% | 5–35 |
modeling.py | 145 | 7 | 95% | 36, 39, 54–57, 129, 131 |
nmpc.py | 64 | 5 | 92% | 95, 132–134, 136 |
utils.py | 235 | 107 | 54% | 45–46, 49, 52, 67, 73, 83, 87, 102–105, 111, 115–117, 120–138, 142–152, 160, 173–174, 176–177, 199–200, 205–207, 245–248, 250–264, 270, 281–286, 289–293, 313–314, 325–367 |
pymgpipe/tests | ||||
test_e2e.py | 90 | 1 | 99% | 197 |
TOTAL | 1309 | 306 | 77% |
API Docs
https://korem-lab.github.io/pymgpipe/
Installation
pympgipe has been built and tested with python 3.10+. To install and use our PyPi package, run pip install pymgpipe
Additional Dependencies
Need at least one of the following solvers (requirements.txt includes gurobi)-
In order to install the solver interfaces in python, you can use pip install cplex
or pip install gurobipy
. This does not actually create a license, it just installs the python interface to interact with these solvers. Both gurobipy and cplex offer free academic licenses. To install the licenses themselves, refer to the links provided above.
Inputs
To create multi-species community models with pymgpipe, you need two things to start-
- Folder with individual taxa models (either in
.mat
or.xml
format) - Relative abundance matrix (as a
.csv
) with samples as columns and taxa as rows. Taxa names should correspond to file names within taxa folder (excluding extension)
Examples of both can be found in the examples/
folder. Individual models for thousands of bacteria can be found and downloaded here.
Outputs
The exact location and names of output files will vary depending on the parameters you pass into each function. However, the default output for pymgpipe's build_models function will look something like this-
* pymgpipe input*
.
├── taxaModels/
│ ├── taxa1.xml
│ ├── taxa2.xml
│ └── ...
├── abundances.csv
# pymgpipe output*
.
├── out/
├── reaction_content.csv
├── reaction_abundance.csv
├── sample_label_conversion.csv
├── metabolic_diversity.png
├── problems/
│ ├── mc1.mps.gz
│ ├── mc2.mps.gz
│ └── ...
└── models/
├── mc1.xml.gz
├── mc2.xml.gz
└── ...
Here is a breakdown of each output files/directory and their descriptions-
File | Type | Description |
---|---|---|
reaction_content | CSV | Matrix showing binary presence/absence of all reactions within each sample |
reaction_abundance | CSV | Matrix showing scaled abundance (between 0 and 1) of all reactions within each sample |
sample_label_conversion | CSV | Dictionary with conversion between original sample names and model names (default sample_prefix is 'mc') |
metabolic_diversity | PNG | Plot depicting # of unique reactions & taxa present within each sample |
problems | dir | Directory containing LP problems (default format is .mps, with compressed set to True) |
models | dir | Directory containing COBRA moddels (default format is .xml, with compressed set to True) |
Examples
Clone and run through workflow.ipynb
in the examples/ folder (see below)
Attribution
When using pymgpipe please cite-
Baldini, F., Heinken, A., Heirendt, L., Magnusdottir, S., Fleming, R. M. T., & Thiele, I. (2019). The Microbiome Modeling Toolbox: from microbial interactions to personalized microbial communities. Bioinformatics (Oxford, England), 35(13), 2332–2334. https://doi.org/10.1093/bioinformatics/bty941
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pymgpipe-0.16.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44c7c8acdfa79abe87c2c2554f84d37622897eb4702bcc8c96b3d49bd7c2edee |
|
MD5 | ac47ec109087d7c4b1abb7684bdbc335 |
|
BLAKE2b-256 | 163a8a8a019f6dd30293cfa0aaf6b5bdfe1ff05eb35ce05a5becd4d5ac8598a1 |