# pandasaurus_cxg
STATUS: early Beta
A library for retrieving and leveraging the semantic context of ontology annotation in [CxG standard](https://github.com/chanzuckerberg/single-cell-curation/blob/main/schema/3.0.0/schema.md) [AnnData files](https://anndata.readthedocs.io/en/latest/).
Slide summarising intended functionality
![image](https://github.com/INCATools/pandasaurus_cxg/assets/112839/3082dcd2-dd2f-469d-9076-4eabcc83130d)
## Installation
Available on [PyPi](https://pypi.org/project/pandasaurus-cxg)
$ pip3 install pandasaurus_cxg
#### Detailed installation guide for pygraphviz issue
During package installation, sometimes the pygraphviz package installation is failing on **macOS** due to Graphviz may be
installed in a location that is not on the default search path. In this case, it may be necessary to manually
specify the path to the graphviz include and/or library directories. To do that use following instructions and install
pygraphviz manually.
```
brew install graphviz
export CFLAGS="-I$(brew --prefix graphviz)/include"
export LDFLAGS="-L$(brew --prefix graphviz)/lib"
pip install pygraphviz
```
## Usage
The `AnndataEnricher` and `AnndataAnalyzer` classes can be used both individually and in conjunction with the `AnndataEnrichmentAnalyzer` wrapper class. The `AnndataEnrichmentAnalyzer` class serves as a convenient way to leverage the functionalities of both `AnndataEnricher` and `AnndataAnalyzer`.
### Using AnndataEnricher and AnndataAnalyzer Individually
You can use the `AnndataEnricher` and `AnndataAnalyzer` classes separately to perform specific tasks on your data. For instance, `AnndataEnricher` facilitates data enrichment, while `AnndataAnalyzer` provides various analysis tools for Anndata objects.
```python
from pandasaurus_cxg.anndata_enricher import AnndataEnricher
ade = AnndataEnricher.from_file_path("test/data/modified_human_kidney.h5ad")
ade.simple_enrichment()
ade.minimal_slim_enrichment(["blood_and_immune_upper_slim"])
```
```python
from pandasaurus_cxg.anndata_analyzer import AnndataAnalyzer
ada = AnndataAnalyzer.from_file_path("./immune_example.h5ad", author_cell_type_list = ['subclass.full', 'subclass.l3', 'subclass.l2', 'subclass.l1', 'class', 'author_cell_type'])
ada.co_annotation_report()
```
### Using AnndataEnrichmentAnalyzer Wrapper
The AnndataEnrichmentAnalyzer class wraps the functionality of both AnndataEnricher and AnndataAnalyzer, offering a seamless way to perform enrichment and analysis in one go.
```python
from pandasaurus_cxg.enrichment_analysis import AnndataEnrichmentAnalyzer
from pandasaurus_cxg.graph_generator.graph_generator import GraphGenerator
aea = AnndataEnrichmentAnalyzer("test/data/modified_human_kidney.h5ad")
aea.contextual_slim_enrichment()
aea.co_annotation_report()
gg = GraphGenerator(aea)
gg.generate_rdf_graph()
gg.set_label_adding_priority(["class", "cell_type", "subclass.l1", "subclass.l1", "subclass.full", "subclass.l2", "subclass.l3"])
gg.add_label_to_terms()
gg.enrich_rdf_graph()
gg.save_rdf_graph(file_name="kidney_new", _format="ttl")
```
More examples and detailed explanation can be found in jupyter notebook given in [Snippets](#Snippets)
## Snippets
https://github.com/INCATools/pandasaurus_cxg/blob/main/walkthrough.ipynb
## Library Documentation
https://incatools.github.io/pandasaurus_cxg/
## Roadmap
https://github.com/INCATools/pandasaurus_cxg/blob/main/ROADMAP.md
Raw data
{
"_id": null,
"home_page": null,
"name": "pandasaurus-cxg",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Ugur Bayindir",
"author_email": "ugur@ebi.ac.uk",
"download_url": "https://files.pythonhosted.org/packages/40/5e/58aa7441e8ebafb92bfba2b980fced4124dec05c3f3a180d1237513f6b10/pandasaurus_cxg-0.2.3.tar.gz",
"platform": null,
"description": "# pandasaurus_cxg\n\nSTATUS: early Beta\n\nA library for retrieving and leveraging the semantic context of ontology annotation in [CxG standard](https://github.com/chanzuckerberg/single-cell-curation/blob/main/schema/3.0.0/schema.md) [AnnData files](https://anndata.readthedocs.io/en/latest/).\n\nSlide summarising intended functionality\n![image](https://github.com/INCATools/pandasaurus_cxg/assets/112839/3082dcd2-dd2f-469d-9076-4eabcc83130d)\n\n## Installation\n\nAvailable on [PyPi](https://pypi.org/project/pandasaurus-cxg)\n\n$ pip3 install pandasaurus_cxg\n\n#### Detailed installation guide for pygraphviz issue\n\nDuring package installation, sometimes the pygraphviz package installation is failing on **macOS** due to Graphviz may be \ninstalled in a location that is not on the default search path. In this case, it may be necessary to manually \nspecify the path to the graphviz include and/or library directories. To do that use following instructions and install \npygraphviz manually.\n\n```\nbrew install graphviz\nexport CFLAGS=\"-I$(brew --prefix graphviz)/include\"\nexport LDFLAGS=\"-L$(brew --prefix graphviz)/lib\"\npip install pygraphviz\n```\n\n## Usage\n\nThe `AnndataEnricher` and `AnndataAnalyzer` classes can be used both individually and in conjunction with the `AnndataEnrichmentAnalyzer` wrapper class. The `AnndataEnrichmentAnalyzer` class serves as a convenient way to leverage the functionalities of both `AnndataEnricher` and `AnndataAnalyzer`.\n\n### Using AnndataEnricher and AnndataAnalyzer Individually\n\nYou can use the `AnndataEnricher` and `AnndataAnalyzer` classes separately to perform specific tasks on your data. For instance, `AnndataEnricher` facilitates data enrichment, while `AnndataAnalyzer` provides various analysis tools for Anndata objects.\n\n```python\nfrom pandasaurus_cxg.anndata_enricher import AnndataEnricher\nade = AnndataEnricher.from_file_path(\"test/data/modified_human_kidney.h5ad\")\nade.simple_enrichment()\nade.minimal_slim_enrichment([\"blood_and_immune_upper_slim\"])\n```\n\n```python\nfrom pandasaurus_cxg.anndata_analyzer import AnndataAnalyzer\nada = AnndataAnalyzer.from_file_path(\"./immune_example.h5ad\", author_cell_type_list = ['subclass.full', 'subclass.l3', 'subclass.l2', 'subclass.l1', 'class', 'author_cell_type'])\nada.co_annotation_report()\n```\n\n### Using AnndataEnrichmentAnalyzer Wrapper\n\nThe AnndataEnrichmentAnalyzer class wraps the functionality of both AnndataEnricher and AnndataAnalyzer, offering a seamless way to perform enrichment and analysis in one go.\n\n```python\nfrom pandasaurus_cxg.enrichment_analysis import AnndataEnrichmentAnalyzer\nfrom pandasaurus_cxg.graph_generator.graph_generator import GraphGenerator\naea = AnndataEnrichmentAnalyzer(\"test/data/modified_human_kidney.h5ad\")\naea.contextual_slim_enrichment()\naea.co_annotation_report()\ngg = GraphGenerator(aea)\ngg.generate_rdf_graph()\ngg.set_label_adding_priority([\"class\", \"cell_type\", \"subclass.l1\", \"subclass.l1\", \"subclass.full\", \"subclass.l2\", \"subclass.l3\"])\ngg.add_label_to_terms()\ngg.enrich_rdf_graph()\ngg.save_rdf_graph(file_name=\"kidney_new\", _format=\"ttl\")\n```\nMore examples and detailed explanation can be found in jupyter notebook given in [Snippets](#Snippets)\n\n## Snippets\n\nhttps://github.com/INCATools/pandasaurus_cxg/blob/main/walkthrough.ipynb\n\n## Library Documentation\n\nhttps://incatools.github.io/pandasaurus_cxg/\n\n## Roadmap\n\nhttps://github.com/INCATools/pandasaurus_cxg/blob/main/ROADMAP.md\n\n",
"bugtrack_url": null,
"license": "http://www.apache.org/licenses/LICENSE-2.0",
"summary": "Ontology enrichment tool for CxG standard AnnData files.",
"version": "0.2.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "72ccc7f89d23f04cf16f6cf3f071dbd21d925480ab86708671d80ede94180b48",
"md5": "40657b0cb95bf2c9b5899ef404b8be7d",
"sha256": "9f12e03fda1e7a2fcb2dc81ae10acf943f880fe91c7bea44e1724dd554b51888"
},
"downloads": -1,
"filename": "pandasaurus_cxg-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "40657b0cb95bf2c9b5899ef404b8be7d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 27979,
"upload_time": "2024-12-10T13:52:50",
"upload_time_iso_8601": "2024-12-10T13:52:50.579498Z",
"url": "https://files.pythonhosted.org/packages/72/cc/c7f89d23f04cf16f6cf3f071dbd21d925480ab86708671d80ede94180b48/pandasaurus_cxg-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "405e58aa7441e8ebafb92bfba2b980fced4124dec05c3f3a180d1237513f6b10",
"md5": "7d60ce2b62f4e610d209e82928c4bde0",
"sha256": "e66931f17aeed9c9ec188fb0e46ed2b1ad978171cb3628ba1efeae0077897afc"
},
"downloads": -1,
"filename": "pandasaurus_cxg-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "7d60ce2b62f4e610d209e82928c4bde0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 22855,
"upload_time": "2024-12-10T13:52:52",
"upload_time_iso_8601": "2024-12-10T13:52:52.860495Z",
"url": "https://files.pythonhosted.org/packages/40/5e/58aa7441e8ebafb92bfba2b980fced4124dec05c3f3a180d1237513f6b10/pandasaurus_cxg-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 13:52:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pandasaurus-cxg"
}