ontologize


Nameontologize JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryBuild annotated ontologies for BioCyc objects
upload_time2024-10-29 22:50:53
maintainerNone
docs_urlNone
authorMica Yang
requires_python>=3.10
licenseMIT License Copyright (c) [2024] [Mica Yang] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords biocyc ecocyc metacyc ontology genes
VCS
bugtrack_url
requirements certifi charset-normalizer et-xmlfile idna networkx numpy openpyxl pandas python-dateutil pytz requests six tqdm tzdata urllib3 xmltodict
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Setup

```console
python -m pip install ontologize
```

# Usage

## Vignette: Genes

Suppose we have a list of genes, perhaps ones that are upregulated in a certain environment, and we wish to understand the functional changes in the cell.

We can first build an `Ontology` object from a list of the genes' BioCyc IDs:

```python
from ontologize.ontology import build_ontology

# cadA EG10131
# lacA EG10524 
# xylA EG11074 
ont = build_ontology(objects=["EG10131", "EG10524", "EG11074"], schema_type="Gene")
```

`Ontology` objects store an annotated ontology graph, as a networkX DiGraph:

```python
import networkx as nx
assert isinstance(ont.graph, nx.DiGraph)
```

Rich printing options are supported, including truncation of the graph at a given depth, inclusion/exclusion of leaf nodes, whether to color by depth.

```python
print(ont.to_string(max_depth=None, include_leaves=False, colors=True))
```

<!-- ![alt text](vignette_1.png) -->
![alt text](https://github.com/Robotato/ontologize/blob/main/vignette_1.png?raw=true)

In this example, we see that lacA and xylA are both involved in carbon utilization, while cadA is related to pH adaptation.

## Command-Line Interface

Once exposed, `ontologize` exposes a runnable script, and can also be called as a module:

```console
ontologize <file> <schema_type> [flags]
python -m ontologize <file> <schema_type> [flags]
```

The required arguments are given as follows:

- `file`: Path to a `.csv`, `.tsv`, or `.xlsx` file with BioCyc object IDs to ontologize. By default, assumes a (header-less, if `.csv` or `.tsv`) first column containing the IDs to be ontologized. If a `.xlsx` file is given, then by default, IDs are assumed to be in the first sheet in the first column, treating the first entry as a header.

- `schema_type` : Type of the objects (or properties) to be ontologized in the [Biocyc Schema](https://biocyc.org/schema.shtml). For example, this might be `Gene`, `Pathway`, `Compound`, etc. 

> Note that `schema_type` uses the singular form of the class name!

### Example:

```python
# TODO
```

### Flags

Ontology-building options:
- `-s <sheet_name>, --sheet <sheet_name>`: For a `.xlsx` file, the name of the sheet containing BioCyc IDs. Ignored if `file` is not a `.xlsx` file.
- `-o <objects>, --objects <objects>`: For a multi-column `file`, the name of the column containing BioCyc IDs for the objects to ontologize. Requires a header row containing column names.
- `-p <objects>, --property <objects>`: For a multi-column `file`, the name of the column containing BioCyc IDs for the property to ontologize. Requires a header row containing column names. When using this option, the objects must also be specified using the `-o` option. 
- > **WARNING: `-p, --property` NOT YET IMPLEMENTED**
- `--database <orgid>`: BioCyc organism ID, used to specify the organism-specific database within to search. [ECOLI](https://ecocyc.org/) by default.

Printing options:
- `--depth <depth>`: Maximum depth of the ontology to print. No limit by default.
- `--leaves`: Whether to show leaf nodes, i.e., the ontologized objects themselves. Not shown by default.
- `--coloroff`: Turns off colorful printing.

> TODO: graph options (not implemented), pkl options, --interactive (allows maintaining session)


# References

[BioCyc19] Karp, P.D., et al., The BioCyc collection of microbial genomes and metabolic pathways
Briefings in Bioinformatics (2019).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ontologize",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "biocyc, ecocyc, metacyc, ontology, genes",
    "author": "Mica Yang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/bc/d5/2faadf22d6ea767902d1c4b82803ea2f4b091f93fbf9a9cb49e65f942a6d/ontologize-0.2.0.tar.gz",
    "platform": null,
    "description": "# Setup\n\n```console\npython -m pip install ontologize\n```\n\n# Usage\n\n## Vignette: Genes\n\nSuppose we have a list of genes, perhaps ones that are upregulated in a certain environment, and we wish to understand the functional changes in the cell.\n\nWe can first build an `Ontology` object from a list of the genes' BioCyc IDs:\n\n```python\nfrom ontologize.ontology import build_ontology\n\n# cadA EG10131\n# lacA EG10524 \n# xylA EG11074 \nont = build_ontology(objects=[\"EG10131\", \"EG10524\", \"EG11074\"], schema_type=\"Gene\")\n```\n\n`Ontology` objects store an annotated ontology graph, as a networkX DiGraph:\n\n```python\nimport networkx as nx\nassert isinstance(ont.graph, nx.DiGraph)\n```\n\nRich printing options are supported, including truncation of the graph at a given depth, inclusion/exclusion of leaf nodes, whether to color by depth.\n\n```python\nprint(ont.to_string(max_depth=None, include_leaves=False, colors=True))\n```\n\n<!-- ![alt text](vignette_1.png) -->\n![alt text](https://github.com/Robotato/ontologize/blob/main/vignette_1.png?raw=true)\n\nIn this example, we see that lacA and xylA are both involved in carbon utilization, while cadA is related to pH adaptation.\n\n## Command-Line Interface\n\nOnce exposed, `ontologize` exposes a runnable script, and can also be called as a module:\n\n```console\nontologize <file> <schema_type> [flags]\npython -m ontologize <file> <schema_type> [flags]\n```\n\nThe required arguments are given as follows:\n\n- `file`: Path to a `.csv`, `.tsv`, or `.xlsx` file with BioCyc object IDs to ontologize. By default, assumes a (header-less, if `.csv` or `.tsv`) first column containing the IDs to be ontologized. If a `.xlsx` file is given, then by default, IDs are assumed to be in the first sheet in the first column, treating the first entry as a header.\n\n- `schema_type` : Type of the objects (or properties) to be ontologized in the [Biocyc Schema](https://biocyc.org/schema.shtml). For example, this might be `Gene`, `Pathway`, `Compound`, etc. \n\n> Note that `schema_type` uses the singular form of the class name!\n\n### Example:\n\n```python\n# TODO\n```\n\n### Flags\n\nOntology-building options:\n- `-s <sheet_name>, --sheet <sheet_name>`: For a `.xlsx` file, the name of the sheet containing BioCyc IDs. Ignored if `file` is not a `.xlsx` file.\n- `-o <objects>, --objects <objects>`: For a multi-column `file`, the name of the column containing BioCyc IDs for the objects to ontologize. Requires a header row containing column names.\n- `-p <objects>, --property <objects>`: For a multi-column `file`, the name of the column containing BioCyc IDs for the property to ontologize. Requires a header row containing column names. When using this option, the objects must also be specified using the `-o` option. \n- > **WARNING: `-p, --property` NOT YET IMPLEMENTED**\n- `--database <orgid>`: BioCyc organism ID, used to specify the organism-specific database within to search. [ECOLI](https://ecocyc.org/) by default.\n\nPrinting options:\n- `--depth <depth>`: Maximum depth of the ontology to print. No limit by default.\n- `--leaves`: Whether to show leaf nodes, i.e., the ontologized objects themselves. Not shown by default.\n- `--coloroff`: Turns off colorful printing.\n\n> TODO: graph options (not implemented), pkl options, --interactive (allows maintaining session)\n\n\n# References\n\n[BioCyc19] Karp, P.D., et al., The BioCyc collection of microbial genomes and metabolic pathways\nBriefings in Bioinformatics (2019).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) [2024] [Mica Yang]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Build annotated ontologies for BioCyc objects",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Robotato/ontologize"
    },
    "split_keywords": [
        "biocyc",
        " ecocyc",
        " metacyc",
        " ontology",
        " genes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0fb4b53b62a9d775cb710bd8fa839fd0bb6972f7c64d985f4d572ed4c0d4d08",
                "md5": "dff8a3cbc7e772548c7399cd4066fcee",
                "sha256": "2e615fa28a6ef34b5d4825f2b5c428fe9095dba21aeb6ab982a536f808dbf157"
            },
            "downloads": -1,
            "filename": "ontologize-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dff8a3cbc7e772548c7399cd4066fcee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12910,
            "upload_time": "2024-10-29T22:50:51",
            "upload_time_iso_8601": "2024-10-29T22:50:51.735836Z",
            "url": "https://files.pythonhosted.org/packages/c0/fb/4b53b62a9d775cb710bd8fa839fd0bb6972f7c64d985f4d572ed4c0d4d08/ontologize-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bcd52faadf22d6ea767902d1c4b82803ea2f4b091f93fbf9a9cb49e65f942a6d",
                "md5": "e00e00d3c9b070c958c3d23683f22696",
                "sha256": "6c6cac698bb96636b47c31f771068a67fed65fe09b97d98fd005c1086fa9ae0d"
            },
            "downloads": -1,
            "filename": "ontologize-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e00e00d3c9b070c958c3d23683f22696",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 13873,
            "upload_time": "2024-10-29T22:50:53",
            "upload_time_iso_8601": "2024-10-29T22:50:53.095245Z",
            "url": "https://files.pythonhosted.org/packages/bc/d5/2faadf22d6ea767902d1c4b82803ea2f4b091f93fbf9a9cb49e65f942a6d/ontologize-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 22:50:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Robotato",
    "github_project": "ontologize",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.7.4"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "et-xmlfile",
            "specs": [
                [
                    "==",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.7"
                ]
            ]
        },
        {
            "name": "networkx",
            "specs": [
                [
                    "==",
                    "3.3"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.26.4"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    "==",
                    "3.1.5"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2024.1"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "==",
                    "4.66.4"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2024.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "xmltodict",
            "specs": [
                [
                    "==",
                    "0.13.0"
                ]
            ]
        }
    ],
    "lcname": "ontologize"
}
        
Elapsed time: 0.41542s