phenocor 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phenocor-0.2.0/LICENSE +28 -0
- phenocor-0.2.0/PKG-INFO +127 -0
- phenocor-0.2.0/README.md +58 -0
- phenocor-0.2.0/pyproject.toml +90 -0
- phenocor-0.2.0/setup.cfg +4 -0
- phenocor-0.2.0/src/phenocor/__init__.py +12 -0
- phenocor-0.2.0/src/phenocor/analysis/__init__.py +5 -0
- phenocor-0.2.0/src/phenocor/analysis/hpo_correlation_analyzer.py +1115 -0
- phenocor-0.2.0/src/phenocor/core/__init__.py +8 -0
- phenocor-0.2.0/src/phenocor/core/builder.py +273 -0
- phenocor-0.2.0/src/phenocor/core/dataset.py +143 -0
- phenocor-0.2.0/src/phenocor/ontology/__init__.py +5 -0
- phenocor-0.2.0/src/phenocor/ontology/_hpo_hierarchy.py +307 -0
- phenocor-0.2.0/src/phenocor/ontology/_term_manager.py +214 -0
- phenocor-0.2.0/src/phenocor.egg-info/PKG-INFO +127 -0
- phenocor-0.2.0/src/phenocor.egg-info/SOURCES.txt +18 -0
- phenocor-0.2.0/src/phenocor.egg-info/dependency_links.txt +1 -0
- phenocor-0.2.0/src/phenocor.egg-info/not-zip-safe +1 -0
- phenocor-0.2.0/src/phenocor.egg-info/requires.txt +22 -0
- phenocor-0.2.0/src/phenocor.egg-info/top_level.txt +1 -0
phenocor-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Monarch Initiative and contributors
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
phenocor-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phenocor
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python package for correlation analysis of HPO annotations in GA4GH phenopacket cohorts
|
|
5
|
+
Author-email: Jing Chen <jing.chen@bih-charite.de>
|
|
6
|
+
Maintainer-email: Peter Robinson <peter.robinson@bih-charite.de>, Daniel Danis <daniel.danis@bih-charite.de>
|
|
7
|
+
License: BSD 3-Clause License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024, Monarch Initiative and contributors
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
22
|
+
contributors may be used to endorse or promote products derived from
|
|
23
|
+
this software without specific prior written permission.
|
|
24
|
+
|
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
26
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
27
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
28
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
29
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
30
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
31
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
32
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
33
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
|
|
36
|
+
Project-URL: homepage, https://github.com/P2GX/phenocor
|
|
37
|
+
Project-URL: repository, https://github.com/P2GX/phenocor.git
|
|
38
|
+
Project-URL: documentation, https://P2GX.github.io/phenocor/
|
|
39
|
+
Project-URL: bugtracker, https://github.com/P2GX/phenocor/issues
|
|
40
|
+
Keywords: Global Alliance for Genomics and Health,GA4GH Phenopacket Schema,Human Phenotype Ontology,GA4GH,HPO
|
|
41
|
+
Classifier: Development Status :: 3 - Alpha
|
|
42
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
43
|
+
Classifier: Operating System :: OS Independent
|
|
44
|
+
Classifier: Programming Language :: Python :: 3
|
|
45
|
+
Requires-Python: >=3.10
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
License-File: LICENSE
|
|
48
|
+
Requires-Dist: hpo-toolkit<0.6,>=0.5.0
|
|
49
|
+
Requires-Dist: phenopackets<3.0,>=2.0.2
|
|
50
|
+
Requires-Dist: scikit-learn<2.0,>=1.6.1
|
|
51
|
+
Requires-Dist: numpy<3.0,>=1.26.4
|
|
52
|
+
Requires-Dist: pandas<3.0,>=2.2.3
|
|
53
|
+
Requires-Dist: plotly>=6.1.1
|
|
54
|
+
Requires-Dist: kaleido>=1.0.0
|
|
55
|
+
Requires-Dist: scipy<2.0,>=1.15.1
|
|
56
|
+
Requires-Dist: joblib<2.0,>=1.4.2
|
|
57
|
+
Requires-Dist: tqdm<5.0,>=4.67.1
|
|
58
|
+
Requires-Dist: statsmodels<1.0,>=0.14.4
|
|
59
|
+
Provides-Extra: test
|
|
60
|
+
Requires-Dist: pytest<8.0.0,>=7.0.0; extra == "test"
|
|
61
|
+
Provides-Extra: docs
|
|
62
|
+
Requires-Dist: mkdocs-material[imaging]<10,>=9.5.10; extra == "docs"
|
|
63
|
+
Requires-Dist: mkdocs-material-extensions<2.0,>=1.3; extra == "docs"
|
|
64
|
+
Requires-Dist: mkdocstrings[python]<1.0,>=0.22; extra == "docs"
|
|
65
|
+
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "docs"
|
|
66
|
+
Requires-Dist: pillow; extra == "docs"
|
|
67
|
+
Requires-Dist: cairosvg; extra == "docs"
|
|
68
|
+
Dynamic: license-file
|
|
69
|
+
|
|
70
|
+
# phenocor
|
|
71
|
+
|
|
72
|
+
**phenocor** is a Python library for analyzing pairwise relationships between Human Phenotype Ontology (HPO) features in [GA4GH Phenopacket](https://www.ga4gh.org/product/phenopackets/) cohorts.
|
|
73
|
+
|
|
74
|
+
It provides **Pairwise association analysis**, which measures associations between binary phenotype annotations using the phi coefficient and Fisher's exact test.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install phenocor
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Features
|
|
87
|
+
|
|
88
|
+
* Construction of phenotype matrices from GA4GH Phenopackets, with separate representation of observed, excluded, and unreported HPO annotations
|
|
89
|
+
* Ontology-aware propagation of phenotype annotations
|
|
90
|
+
* Pairwise phenotype association analysis using the phi coefficient, Fisher's exact test, and Benjamini–Hochberg correction, with exclusion of ancestor–descendant HPO term pairs
|
|
91
|
+
* Tabular results and interactive heatmaps, including contingency counts, effective sample sizes, adjusted p-values, and publication provenance where available
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Quickstart
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from pathlib import Path
|
|
98
|
+
from google.protobuf.json_format import Parse
|
|
99
|
+
from phenopackets import Phenopacket
|
|
100
|
+
from phenocor import (
|
|
101
|
+
PhenotypeDatasetBuilder,
|
|
102
|
+
HPOCorrelationAnalyzer,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# Load phenopackets
|
|
106
|
+
phenopacket_dir = Path("path/to/your/fbn1_phenopackets/")
|
|
107
|
+
|
|
108
|
+
phenopackets = []
|
|
109
|
+
for file_path in sorted(phenopacket_dir.glob("*.json")):
|
|
110
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
|
111
|
+
data: str = f.read()
|
|
112
|
+
phenopacket: Phenopacket = Parse(data, Phenopacket())
|
|
113
|
+
phenopackets.append(phenopacket)
|
|
114
|
+
|
|
115
|
+
# Build dataset
|
|
116
|
+
dataset = PhenotypeDatasetBuilder(phenopackets).build()
|
|
117
|
+
|
|
118
|
+
# Run correlation analysis
|
|
119
|
+
analyzer = HPOCorrelationAnalyzer(dataset)
|
|
120
|
+
results = analyzer.compute_correlation_matrix()
|
|
121
|
+
results.correlation_results.head()
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For complete workflows, visualization options, and API details, see the [Documentation](https://phenocor.readthedocs.io/).
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
phenocor-0.2.0/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# phenocor
|
|
2
|
+
|
|
3
|
+
**phenocor** is a Python library for analyzing pairwise relationships between Human Phenotype Ontology (HPO) features in [GA4GH Phenopacket](https://www.ga4gh.org/product/phenopackets/) cohorts.
|
|
4
|
+
|
|
5
|
+
It provides **Pairwise association analysis**, which measures associations between binary phenotype annotations using the phi coefficient and Fisher's exact test.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install phenocor
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
* Construction of phenotype matrices from GA4GH Phenopackets, with separate representation of observed, excluded, and unreported HPO annotations
|
|
20
|
+
* Ontology-aware propagation of phenotype annotations
|
|
21
|
+
* Pairwise phenotype association analysis using the phi coefficient, Fisher's exact test, and Benjamini–Hochberg correction, with exclusion of ancestor–descendant HPO term pairs
|
|
22
|
+
* Tabular results and interactive heatmaps, including contingency counts, effective sample sizes, adjusted p-values, and publication provenance where available
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
from google.protobuf.json_format import Parse
|
|
30
|
+
from phenopackets import Phenopacket
|
|
31
|
+
from phenocor import (
|
|
32
|
+
PhenotypeDatasetBuilder,
|
|
33
|
+
HPOCorrelationAnalyzer,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Load phenopackets
|
|
37
|
+
phenopacket_dir = Path("path/to/your/fbn1_phenopackets/")
|
|
38
|
+
|
|
39
|
+
phenopackets = []
|
|
40
|
+
for file_path in sorted(phenopacket_dir.glob("*.json")):
|
|
41
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
|
42
|
+
data: str = f.read()
|
|
43
|
+
phenopacket: Phenopacket = Parse(data, Phenopacket())
|
|
44
|
+
phenopackets.append(phenopacket)
|
|
45
|
+
|
|
46
|
+
# Build dataset
|
|
47
|
+
dataset = PhenotypeDatasetBuilder(phenopackets).build()
|
|
48
|
+
|
|
49
|
+
# Run correlation analysis
|
|
50
|
+
analyzer = HPOCorrelationAnalyzer(dataset)
|
|
51
|
+
results = analyzer.compute_correlation_matrix()
|
|
52
|
+
results.correlation_results.head()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For complete workflows, visualization options, and API details, see the [Documentation](https://phenocor.readthedocs.io/).
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# pyproject.toml
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["setuptools>=65.6.3", "wheel"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "phenocor"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
description = "A Python package for correlation analysis of HPO annotations in GA4GH phenopacket cohorts"
|
|
11
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Jing Chen", email="jing.chen@bih-charite.de"},
|
|
14
|
+
]
|
|
15
|
+
maintainers =[{name = "Peter Robinson", email="peter.robinson@bih-charite.de"},
|
|
16
|
+
{name = "Daniel Danis", email="daniel.danis@bih-charite.de"},]
|
|
17
|
+
license = { file = "LICENSE" }
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"License :: OSI Approved :: BSD License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
]
|
|
24
|
+
keywords = [
|
|
25
|
+
"Global Alliance for Genomics and Health",
|
|
26
|
+
"GA4GH Phenopacket Schema",
|
|
27
|
+
"Human Phenotype Ontology",
|
|
28
|
+
"GA4GH",
|
|
29
|
+
"HPO"]
|
|
30
|
+
|
|
31
|
+
# version in __init__
|
|
32
|
+
dynamic = ["version"]
|
|
33
|
+
|
|
34
|
+
dependencies = [
|
|
35
|
+
"hpo-toolkit>=0.5.0,<0.6",
|
|
36
|
+
"phenopackets>=2.0.2,<3.0",
|
|
37
|
+
"scikit-learn>=1.6.1,<2.0",
|
|
38
|
+
"numpy>=1.26.4,<3.0",
|
|
39
|
+
"pandas>=2.2.3,<3.0",
|
|
40
|
+
"plotly>=6.1.1",
|
|
41
|
+
"kaleido>=1.0.0",
|
|
42
|
+
"scipy>=1.15.1,<2.0",
|
|
43
|
+
"joblib>=1.4.2,<2.0",
|
|
44
|
+
"tqdm>=4.67.1,<5.0",
|
|
45
|
+
"statsmodels>=0.14.4,<1.0"
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
test = ["pytest>=7.0.0,<8.0.0"]
|
|
50
|
+
docs = [
|
|
51
|
+
'mkdocs-material[imaging]>=9.5.10,<10',
|
|
52
|
+
'mkdocs-material-extensions>=1.3,<2.0',
|
|
53
|
+
'mkdocstrings[python]>=0.22,<1.0',
|
|
54
|
+
'mkdocs-gen-files>=0.5.0',
|
|
55
|
+
'pillow',
|
|
56
|
+
'cairosvg',
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
[project.urls]
|
|
62
|
+
homepage = "https://github.com/P2GX/phenocor"
|
|
63
|
+
repository = "https://github.com/P2GX/phenocor.git"
|
|
64
|
+
documentation = "https://P2GX.github.io/phenocor/"
|
|
65
|
+
bugtracker = "https://github.com/P2GX/phenocor/issues"
|
|
66
|
+
|
|
67
|
+
[tool.setuptools]
|
|
68
|
+
package-dir = { "" = "src" }
|
|
69
|
+
zip-safe = false
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.dynamic]
|
|
72
|
+
version = { attr = "phenocor.__version__" }
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
[tool.yapf]
|
|
77
|
+
blank_line_before_nested_class_or_def = true
|
|
78
|
+
column_limit = 88
|
|
79
|
+
|
|
80
|
+
[tool.pylint]
|
|
81
|
+
max-line-length = 88
|
|
82
|
+
disable = [
|
|
83
|
+
"C0103", # (invalid-name)
|
|
84
|
+
"C0114", # (missing-module-docstring)
|
|
85
|
+
"C0115", # (missing-class-docstring)
|
|
86
|
+
"C0116", # (missing-function-docstring)
|
|
87
|
+
"R0903", # (too-few-public-methods)
|
|
88
|
+
"R0913", # (too-many-arguments)
|
|
89
|
+
"W0105", # (pointless-string-statement)
|
|
90
|
+
]
|
phenocor-0.2.0/setup.cfg
ADDED