pipeGEM


NamepipeGEM JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryProcessing and integrating data with genome-scale metabolic models (GEM)
upload_time2025-07-28 14:18:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords metabolism metabolic-model computational-biology system-biology cobra
VCS
bugtrack_url
requirements cobra numpy pandas scipy pytest matplotlib requests scikit-learn scikit-posthocs seaborn umap-learn setuptools biodbs tqdm optlang networkx zeep pint openpyxl anndata tomlkit pingouin scanpy dask
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PipeGEM v0.1.0
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pipeGEM.svg)](https://pypi.python.org/pypi/pipeGEM/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![ci](https://github.com/qwerty239qwe/pipeGEM/actions/workflows/ci.yml/badge.svg)
___
This is a package for visualizing and analyzing multiple metabolic models. 
It also allow users to integrate omic data, metabolic tasks, and medium data with GEMs. 

The flux analysis functions in the package are based on cobrapy: 
https://cobrapy.readthedocs.io/en/latest/
___
### How to get PipeGEM
To install directly from PyPI:
<br>
`pip install pipegem`
___
### How to use this package (Python API)
**single model**
```python
import pipeGEM as pg
from pipeGEM.utils import load_model

model = load_model("your_model_path")  # cobra.Model
pmodel = pg.Model(name_tag="model_name", 
                  model=model)

# Print out model information
print(pmodel)

# Do and plot pFBA result
flux_analysis = pmodel.do_flux_analysis("pFBA")
flux_analysis.plot(
    rxn_ids=['rxn_a', 'rxn_b'],
    file_name='pfba_flux.png'  # can be None if you don't want to save the figure
    )
```


**multiple models**
```python
import pipeGEM as pg
from pipeGEM.utils import load_model

model_a1 = load_model("your_model_path_1")
model_a2 = load_model("your_model_path_2")

model_b1 = load_model("your_model_path_3")
model_b2 = load_model("your_model_path_4")

group = pg.Group({
        "group_a": {
            "model_a_dmso": model_a1, 
            "model_a_metformin": model_a2
        },
        "group_b": {
            "model_b_dmso": model_b1, 
            "model_b_metformin": model_b2
        }
    }, 
    name_tag="my_group", 
    treatments={"model_a_dmso": "DMSO", 
                "model_b_dmso": "DMSO",
                "model_a_metformin": "metformin", 
                "model_b_metformin": "metformin"}
)

# Do and plot pFBA result
flux_analysis = group.do_flux_analysis("pFBA")
flux_analysis.plot(rxn_ids=['rxn_a', 'rxn_b'])
```

**Generate context-specific models**
```python
import numpy as np
import pipeGEM as pg
from pipeGEM.utils import load_model
from pipeGEM.data import GeneData, synthesis

# initialize model
mod = pg.Model(name_tag="model_name", 
               model=load_model("your_model_path_1"))

# create dummy transcriptomic data
dummy_data = synthesis.get_syn_gene_data(mod, n_sample=3)

# calculate reaction activity score
gene_data = GeneData(data=dummy_data["sample_0"], # pd.Series or a dict
                     data_transform=lambda x: np.log2(x), # callable
                     absent_expression=-np.inf) # value
mod.add_gene_data(name_or_prefix="sample_0",  # name of the data
                  data=gene_data, 
                  or_operation="nanmax",  # alternative: nansum
                  threshold=-np.inf, 
                  absent_value=-np.inf)

# apply GIMME algorithm on the model
gimme_result = mod.integrate_gene_data(data_name="sample_0", integrator="GIMME", high_exp=5*np.log10(2))
context_specific_gem = gimme_result.result_model

```

___

### Command-Line Interface (CLI) Quick Start

PipeGEM also provides a command-line interface for running predefined pipelines using configuration files.

1.  **Generate Template Configurations:**
    Start by generating template TOML configuration files for a specific pipeline (e.g., `integration`). Replace `integration` with the desired pipeline name if needed.

    ```bash
    python -m pipeGEM -n template -p integration -o ./configs
    ```
    This will create a `configs` directory (if it doesn't exist) containing template `.toml` files like `gene_data_conf.toml`, `model_conf.toml`, etc.

2.  **Modify Configurations (Optional):**
    Edit the generated `.toml` files in the `configs` directory to specify your input file paths, parameters, and desired settings. For example, in `model_conf.toml`, you might specify the path to your metabolic model file.

3.  **Run a Pipeline:**
    Execute a pipeline using the configuration files. For example, to run the model processing pipeline using the configuration in `configs/model_conf.toml`:

    ```bash
    python -m pipeGEM -n model_processing -t configs/model_conf.toml
    ```

    Or, to run the full integration pipeline:

    ```bash
    python -m pipeGEM -n integration \
        -g configs/gene_data_conf.toml \
        -t configs/model_conf.toml \
        -r configs/threshold_conf.toml \
        -m configs/mapping_conf.toml \
        -i configs/integration_conf.toml
    ```

    Refer to the generated template files and the specific pipeline documentation for details on required configurations.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pipeGEM",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "metabolism, metabolic-model, computational-biology, system-biology, cobra",
    "author": null,
    "author_email": "Yu-Te Lin <qwerty239qwe@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fd/13/2dac7c79d7a9e9dfd3189e4b97b27e0667eab440491840480ab85f623549/pipegem-0.1.1.tar.gz",
    "platform": null,
    "description": "# PipeGEM v0.1.0\r\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pipeGEM.svg)](https://pypi.python.org/pypi/pipeGEM/)\r\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\r\n![ci](https://github.com/qwerty239qwe/pipeGEM/actions/workflows/ci.yml/badge.svg)\r\n___\r\nThis is a package for visualizing and analyzing multiple metabolic models. \r\nIt also allow users to integrate omic data, metabolic tasks, and medium data with GEMs. \r\n\r\nThe flux analysis functions in the package are based on cobrapy: \r\nhttps://cobrapy.readthedocs.io/en/latest/\r\n___\r\n### How to get PipeGEM\r\nTo install directly from PyPI:\r\n<br>\r\n`pip install pipegem`\r\n___\r\n### How to use this package (Python API)\r\n**single model**\r\n```python\r\nimport pipeGEM as pg\r\nfrom pipeGEM.utils import load_model\r\n\r\nmodel = load_model(\"your_model_path\")  # cobra.Model\r\npmodel = pg.Model(name_tag=\"model_name\", \r\n                  model=model)\r\n\r\n# Print out model information\r\nprint(pmodel)\r\n\r\n# Do and plot pFBA result\r\nflux_analysis = pmodel.do_flux_analysis(\"pFBA\")\r\nflux_analysis.plot(\r\n    rxn_ids=['rxn_a', 'rxn_b'],\r\n    file_name='pfba_flux.png'  # can be None if you don't want to save the figure\r\n    )\r\n```\r\n\r\n\r\n**multiple models**\r\n```python\r\nimport pipeGEM as pg\r\nfrom pipeGEM.utils import load_model\r\n\r\nmodel_a1 = load_model(\"your_model_path_1\")\r\nmodel_a2 = load_model(\"your_model_path_2\")\r\n\r\nmodel_b1 = load_model(\"your_model_path_3\")\r\nmodel_b2 = load_model(\"your_model_path_4\")\r\n\r\ngroup = pg.Group({\r\n        \"group_a\": {\r\n            \"model_a_dmso\": model_a1, \r\n            \"model_a_metformin\": model_a2\r\n        },\r\n        \"group_b\": {\r\n            \"model_b_dmso\": model_b1, \r\n            \"model_b_metformin\": model_b2\r\n        }\r\n    }, \r\n    name_tag=\"my_group\", \r\n    treatments={\"model_a_dmso\": \"DMSO\", \r\n                \"model_b_dmso\": \"DMSO\",\r\n                \"model_a_metformin\": \"metformin\", \r\n                \"model_b_metformin\": \"metformin\"}\r\n)\r\n\r\n# Do and plot pFBA result\r\nflux_analysis = group.do_flux_analysis(\"pFBA\")\r\nflux_analysis.plot(rxn_ids=['rxn_a', 'rxn_b'])\r\n```\r\n\r\n**Generate context-specific models**\r\n```python\r\nimport numpy as np\r\nimport pipeGEM as pg\r\nfrom pipeGEM.utils import load_model\r\nfrom pipeGEM.data import GeneData, synthesis\r\n\r\n# initialize model\r\nmod = pg.Model(name_tag=\"model_name\", \r\n               model=load_model(\"your_model_path_1\"))\r\n\r\n# create dummy transcriptomic data\r\ndummy_data = synthesis.get_syn_gene_data(mod, n_sample=3)\r\n\r\n# calculate reaction activity score\r\ngene_data = GeneData(data=dummy_data[\"sample_0\"], # pd.Series or a dict\r\n                     data_transform=lambda x: np.log2(x), # callable\r\n                     absent_expression=-np.inf) # value\r\nmod.add_gene_data(name_or_prefix=\"sample_0\",  # name of the data\r\n                  data=gene_data, \r\n                  or_operation=\"nanmax\",  # alternative: nansum\r\n                  threshold=-np.inf, \r\n                  absent_value=-np.inf)\r\n\r\n# apply GIMME algorithm on the model\r\ngimme_result = mod.integrate_gene_data(data_name=\"sample_0\", integrator=\"GIMME\", high_exp=5*np.log10(2))\r\ncontext_specific_gem = gimme_result.result_model\r\n\r\n```\r\n\r\n___\r\n\r\n### Command-Line Interface (CLI) Quick Start\r\n\r\nPipeGEM also provides a command-line interface for running predefined pipelines using configuration files.\r\n\r\n1.  **Generate Template Configurations:**\r\n    Start by generating template TOML configuration files for a specific pipeline (e.g., `integration`). Replace `integration` with the desired pipeline name if needed.\r\n\r\n    ```bash\r\n    python -m pipeGEM -n template -p integration -o ./configs\r\n    ```\r\n    This will create a `configs` directory (if it doesn't exist) containing template `.toml` files like `gene_data_conf.toml`, `model_conf.toml`, etc.\r\n\r\n2.  **Modify Configurations (Optional):**\r\n    Edit the generated `.toml` files in the `configs` directory to specify your input file paths, parameters, and desired settings. For example, in `model_conf.toml`, you might specify the path to your metabolic model file.\r\n\r\n3.  **Run a Pipeline:**\r\n    Execute a pipeline using the configuration files. For example, to run the model processing pipeline using the configuration in `configs/model_conf.toml`:\r\n\r\n    ```bash\r\n    python -m pipeGEM -n model_processing -t configs/model_conf.toml\r\n    ```\r\n\r\n    Or, to run the full integration pipeline:\r\n\r\n    ```bash\r\n    python -m pipeGEM -n integration \\\r\n        -g configs/gene_data_conf.toml \\\r\n        -t configs/model_conf.toml \\\r\n        -r configs/threshold_conf.toml \\\r\n        -m configs/mapping_conf.toml \\\r\n        -i configs/integration_conf.toml\r\n    ```\r\n\r\n    Refer to the generated template files and the specific pipeline documentation for details on required configurations.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Processing and integrating data with genome-scale metabolic models (GEM)",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/qwerty239qwe/pipeGEM"
    },
    "split_keywords": [
        "metabolism",
        " metabolic-model",
        " computational-biology",
        " system-biology",
        " cobra"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "656a160f59bb26d420f431520d7dc4909f04ee3256319460450ace1a93f8edd5",
                "md5": "d6ff9660c7edcdffef163df6ac549b6b",
                "sha256": "f6b7bc101b26e6259b00942f1a5358d1a9d85a481bcb75592af85a34744c526e"
            },
            "downloads": -1,
            "filename": "pipegem-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6ff9660c7edcdffef163df6ac549b6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4504026,
            "upload_time": "2025-07-28T14:18:29",
            "upload_time_iso_8601": "2025-07-28T14:18:29.843590Z",
            "url": "https://files.pythonhosted.org/packages/65/6a/160f59bb26d420f431520d7dc4909f04ee3256319460450ace1a93f8edd5/pipegem-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fd132dac7c79d7a9e9dfd3189e4b97b27e0667eab440491840480ab85f623549",
                "md5": "776021c99cc7f56c9c3f79a66d839194",
                "sha256": "0da7de7b08315bd1cf63130604098caed7b67d8711f2e33317d006a28b2f52b9"
            },
            "downloads": -1,
            "filename": "pipegem-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "776021c99cc7f56c9c3f79a66d839194",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4484357,
            "upload_time": "2025-07-28T14:18:32",
            "upload_time_iso_8601": "2025-07-28T14:18:32.674055Z",
            "url": "https://files.pythonhosted.org/packages/fd/13/2dac7c79d7a9e9dfd3189e4b97b27e0667eab440491840480ab85f623549/pipegem-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 14:18:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "qwerty239qwe",
    "github_project": "pipeGEM",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "cobra",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "scikit-learn",
            "specs": []
        },
        {
            "name": "scikit-posthocs",
            "specs": []
        },
        {
            "name": "seaborn",
            "specs": []
        },
        {
            "name": "umap-learn",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "biodbs",
            "specs": []
        },
        {
            "name": "tqdm",
            "specs": []
        },
        {
            "name": "optlang",
            "specs": []
        },
        {
            "name": "networkx",
            "specs": []
        },
        {
            "name": "zeep",
            "specs": []
        },
        {
            "name": "pint",
            "specs": []
        },
        {
            "name": "openpyxl",
            "specs": []
        },
        {
            "name": "anndata",
            "specs": []
        },
        {
            "name": "tomlkit",
            "specs": []
        },
        {
            "name": "pingouin",
            "specs": []
        },
        {
            "name": "scanpy",
            "specs": []
        },
        {
            "name": "dask",
            "specs": []
        }
    ],
    "lcname": "pipegem"
}
        
Elapsed time: 1.43370s