pyobo 0.10.11__py3-none-any.whl → 0.11.0__py3-none-any.whl
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.
- pyobo/__init__.py +0 -2
- pyobo/__main__.py +0 -2
- pyobo/api/__init__.py +0 -2
- pyobo/api/alts.py +6 -7
- pyobo/api/hierarchy.py +14 -15
- pyobo/api/metadata.py +3 -4
- pyobo/api/names.py +51 -31
- pyobo/api/properties.py +6 -7
- pyobo/api/relations.py +12 -11
- pyobo/api/species.py +5 -6
- pyobo/api/typedefs.py +1 -3
- pyobo/api/utils.py +63 -2
- pyobo/api/xrefs.py +4 -5
- pyobo/aws.py +3 -5
- pyobo/cli/__init__.py +0 -2
- pyobo/cli/aws.py +0 -2
- pyobo/cli/cli.py +0 -4
- pyobo/cli/database.py +1 -3
- pyobo/cli/lookup.py +2 -4
- pyobo/cli/utils.py +0 -2
- pyobo/constants.py +0 -3
- pyobo/getters.py +19 -26
- pyobo/gilda_utils.py +28 -8
- pyobo/identifier_utils.py +32 -15
- pyobo/mocks.py +5 -6
- pyobo/normalizer.py +24 -24
- pyobo/obographs.py +3 -3
- pyobo/plugins.py +3 -4
- pyobo/py.typed +0 -0
- pyobo/reader.py +19 -21
- pyobo/registries/__init__.py +0 -2
- pyobo/registries/metaregistry.py +6 -8
- pyobo/resource_utils.py +1 -3
- pyobo/resources/__init__.py +0 -2
- pyobo/resources/ncbitaxon.py +2 -3
- pyobo/resources/ro.py +2 -4
- pyobo/sources/README.md +15 -0
- pyobo/sources/__init__.py +2 -2
- pyobo/sources/agrovoc.py +3 -3
- pyobo/sources/antibodyregistry.py +4 -5
- pyobo/sources/biogrid.py +7 -7
- pyobo/sources/ccle.py +3 -4
- pyobo/sources/cgnc.py +1 -3
- pyobo/sources/chebi.py +2 -4
- pyobo/sources/chembl.py +1 -3
- pyobo/sources/civic_gene.py +2 -3
- pyobo/sources/complexportal.py +3 -5
- pyobo/sources/conso.py +2 -4
- pyobo/sources/cpt.py +1 -3
- pyobo/sources/credit.py +68 -0
- pyobo/sources/cvx.py +1 -3
- pyobo/sources/depmap.py +3 -4
- pyobo/sources/dictybase_gene.py +1 -3
- pyobo/sources/drugbank.py +6 -7
- pyobo/sources/drugbank_salt.py +3 -4
- pyobo/sources/drugcentral.py +5 -7
- pyobo/sources/expasy.py +11 -12
- pyobo/sources/famplex.py +3 -5
- pyobo/sources/flybase.py +2 -4
- pyobo/sources/geonames.py +28 -10
- pyobo/sources/gmt_utils.py +5 -6
- pyobo/sources/go.py +4 -6
- pyobo/sources/gwascentral_phenotype.py +1 -3
- pyobo/sources/gwascentral_study.py +2 -3
- pyobo/sources/hgnc.py +8 -9
- pyobo/sources/hgncgenefamily.py +2 -4
- pyobo/sources/icd10.py +3 -4
- pyobo/sources/icd11.py +3 -4
- pyobo/sources/icd_utils.py +6 -7
- pyobo/sources/interpro.py +3 -5
- pyobo/sources/itis.py +1 -3
- pyobo/sources/kegg/__init__.py +0 -2
- pyobo/sources/kegg/api.py +3 -4
- pyobo/sources/kegg/genes.py +3 -4
- pyobo/sources/kegg/genome.py +1 -3
- pyobo/sources/kegg/pathway.py +5 -6
- pyobo/sources/mesh.py +19 -21
- pyobo/sources/mgi.py +1 -3
- pyobo/sources/mirbase.py +4 -6
- pyobo/sources/mirbase_constants.py +0 -2
- pyobo/sources/mirbase_family.py +1 -3
- pyobo/sources/mirbase_mature.py +1 -3
- pyobo/sources/msigdb.py +4 -5
- pyobo/sources/ncbigene.py +3 -5
- pyobo/sources/npass.py +2 -4
- pyobo/sources/omim_ps.py +1 -3
- pyobo/sources/pathbank.py +3 -5
- pyobo/sources/pfam.py +1 -3
- pyobo/sources/pfam_clan.py +1 -3
- pyobo/sources/pid.py +3 -5
- pyobo/sources/pombase.py +1 -3
- pyobo/sources/pubchem.py +5 -6
- pyobo/sources/reactome.py +2 -4
- pyobo/sources/rgd.py +3 -4
- pyobo/sources/rhea.py +9 -10
- pyobo/sources/ror.py +69 -22
- pyobo/sources/selventa/__init__.py +0 -2
- pyobo/sources/selventa/schem.py +1 -3
- pyobo/sources/selventa/scomp.py +1 -3
- pyobo/sources/selventa/sdis.py +1 -3
- pyobo/sources/selventa/sfam.py +1 -3
- pyobo/sources/sgd.py +1 -3
- pyobo/sources/slm.py +1 -3
- pyobo/sources/umls/__init__.py +0 -2
- pyobo/sources/umls/__main__.py +0 -2
- pyobo/sources/umls/get_synonym_types.py +1 -1
- pyobo/sources/umls/umls.py +2 -4
- pyobo/sources/uniprot/__init__.py +0 -2
- pyobo/sources/uniprot/uniprot.py +6 -6
- pyobo/sources/uniprot/uniprot_ptm.py +6 -5
- pyobo/sources/utils.py +3 -5
- pyobo/sources/wikipathways.py +1 -3
- pyobo/sources/zfin.py +2 -3
- pyobo/ssg/__init__.py +3 -2
- pyobo/struct/__init__.py +0 -2
- pyobo/struct/reference.py +13 -15
- pyobo/struct/struct.py +106 -99
- pyobo/struct/typedef.py +19 -10
- pyobo/struct/utils.py +0 -2
- pyobo/utils/__init__.py +0 -2
- pyobo/utils/cache.py +14 -6
- pyobo/utils/io.py +9 -10
- pyobo/utils/iter.py +5 -6
- pyobo/utils/misc.py +1 -3
- pyobo/utils/ndex_utils.py +6 -7
- pyobo/utils/path.py +5 -5
- pyobo/version.py +3 -5
- pyobo/xrefdb/__init__.py +0 -2
- pyobo/xrefdb/canonicalizer.py +27 -18
- pyobo/xrefdb/priority.py +0 -2
- pyobo/xrefdb/sources/__init__.py +9 -7
- pyobo/xrefdb/sources/biomappings.py +0 -2
- pyobo/xrefdb/sources/cbms2019.py +0 -2
- pyobo/xrefdb/sources/chembl.py +5 -7
- pyobo/xrefdb/sources/compath.py +1 -3
- pyobo/xrefdb/sources/famplex.py +3 -5
- pyobo/xrefdb/sources/gilda.py +0 -2
- pyobo/xrefdb/sources/intact.py +5 -5
- pyobo/xrefdb/sources/ncit.py +1 -3
- pyobo/xrefdb/sources/pubchem.py +2 -4
- pyobo/xrefdb/sources/wikidata.py +10 -5
- pyobo/xrefdb/xrefs_pipeline.py +15 -16
- {pyobo-0.10.11.dist-info → pyobo-0.11.0.dist-info}/LICENSE +1 -1
- pyobo-0.11.0.dist-info/METADATA +723 -0
- pyobo-0.11.0.dist-info/RECORD +171 -0
- {pyobo-0.10.11.dist-info → pyobo-0.11.0.dist-info}/WHEEL +1 -1
- pyobo-0.11.0.dist-info/entry_points.txt +2 -0
- pyobo/xrefdb/bengo.py +0 -44
- pyobo-0.10.11.dist-info/METADATA +0 -499
- pyobo-0.10.11.dist-info/RECORD +0 -169
- pyobo-0.10.11.dist-info/entry_points.txt +0 -15
- {pyobo-0.10.11.dist-info → pyobo-0.11.0.dist-info}/top_level.txt +0 -0
pyobo/xrefdb/sources/famplex.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
"""Get FamPlex xrefs."""
|
|
4
2
|
|
|
5
3
|
import logging
|
|
4
|
+
from collections.abc import Mapping
|
|
6
5
|
from functools import lru_cache
|
|
7
|
-
from typing import Mapping, Tuple
|
|
8
6
|
|
|
9
7
|
import bioregistry
|
|
10
8
|
import pandas as pd
|
|
@@ -50,8 +48,8 @@ def get_famplex_xrefs_df(force: bool = False) -> pd.DataFrame:
|
|
|
50
48
|
return df
|
|
51
49
|
|
|
52
50
|
|
|
53
|
-
@lru_cache
|
|
54
|
-
def get_remapping(force: bool = False) -> Mapping[
|
|
51
|
+
@lru_cache
|
|
52
|
+
def get_remapping(force: bool = False) -> Mapping[tuple[str, str], tuple[str, str, str]]:
|
|
55
53
|
"""Get a mapping from database/identifier pairs to famplex identifiers."""
|
|
56
54
|
df = _get_famplex_df(force=force)
|
|
57
55
|
rv = {}
|
pyobo/xrefdb/sources/gilda.py
CHANGED
pyobo/xrefdb/sources/intact.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
"""Get the xrefs from IntAct."""
|
|
4
2
|
|
|
5
|
-
from
|
|
3
|
+
from collections.abc import Mapping
|
|
6
4
|
|
|
7
5
|
import pandas as pd
|
|
8
6
|
|
|
@@ -49,7 +47,8 @@ def get_complexportal_mapping() -> Mapping[str, str]:
|
|
|
49
47
|
.. code-block:: python
|
|
50
48
|
|
|
51
49
|
from pyobo import get_filtered_xrefs
|
|
52
|
-
|
|
50
|
+
|
|
51
|
+
intact_complexportal_mapping = get_filtered_xrefs("intact", "complexportal")
|
|
53
52
|
"""
|
|
54
53
|
|
|
55
54
|
@cached_mapping(
|
|
@@ -87,7 +86,8 @@ def get_reactome_mapping() -> Mapping[str, str]:
|
|
|
87
86
|
.. code-block:: python
|
|
88
87
|
|
|
89
88
|
from pyobo import get_filtered_xrefs
|
|
90
|
-
|
|
89
|
+
|
|
90
|
+
intact_complexportal_mapping = get_filtered_xrefs("intact", "reactome")
|
|
91
91
|
"""
|
|
92
92
|
|
|
93
93
|
@cached_mapping(
|
pyobo/xrefdb/sources/ncit.py
CHANGED
pyobo/xrefdb/sources/pubchem.py
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
"""Get xrefs from PubChem Compound to MeSH."""
|
|
4
2
|
|
|
5
3
|
from typing import Optional
|
|
6
4
|
|
|
7
|
-
import bioversions
|
|
8
5
|
import pandas as pd
|
|
9
6
|
|
|
7
|
+
from ...api.utils import safe_get_version
|
|
10
8
|
from ...constants import XREF_COLUMNS
|
|
11
9
|
from ...sources.pubchem import _get_pubchem_extras_url, get_pubchem_id_to_mesh_id
|
|
12
10
|
|
|
@@ -18,7 +16,7 @@ __all__ = [
|
|
|
18
16
|
def get_pubchem_mesh_df(version: Optional[str] = None) -> pd.DataFrame:
|
|
19
17
|
"""Get PubChem Compound-MeSH xrefs."""
|
|
20
18
|
if version is None:
|
|
21
|
-
version =
|
|
19
|
+
version = safe_get_version("pubchem")
|
|
22
20
|
cid_mesh_url = _get_pubchem_extras_url(version, "CID-MeSH")
|
|
23
21
|
return pd.DataFrame(
|
|
24
22
|
[
|
pyobo/xrefdb/sources/wikidata.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
"""Get Wikidata xrefs.
|
|
4
2
|
|
|
5
3
|
Run with ``python -m pyobo.xrefdb.sources.wikidata``.
|
|
@@ -7,7 +5,7 @@ Run with ``python -m pyobo.xrefdb.sources.wikidata``.
|
|
|
7
5
|
|
|
8
6
|
import json
|
|
9
7
|
import logging
|
|
10
|
-
from
|
|
8
|
+
from collections.abc import Iterable
|
|
11
9
|
|
|
12
10
|
import bioregistry
|
|
13
11
|
import click
|
|
@@ -68,7 +66,7 @@ def get_wikidata_df(prefix: str, wikidata_property: str) -> pd.DataFrame:
|
|
|
68
66
|
|
|
69
67
|
def iter_wikidata_mappings(
|
|
70
68
|
wikidata_property: str, *, cache: bool = True
|
|
71
|
-
) -> Iterable[
|
|
69
|
+
) -> Iterable[tuple[str, str]]:
|
|
72
70
|
"""Iterate over Wikidata xrefs."""
|
|
73
71
|
path = WIKIDATA_MAPPING_DIRECTORY.join(name=f"{wikidata_property}.json")
|
|
74
72
|
if path.exists() and cache:
|
|
@@ -81,11 +79,18 @@ def iter_wikidata_mappings(
|
|
|
81
79
|
json.dump(rows, file, indent=2)
|
|
82
80
|
|
|
83
81
|
for row in rows:
|
|
84
|
-
wikidata_id = row["wikidata_id"]["value"]
|
|
82
|
+
wikidata_id = _removeprefix(row["wikidata_id"]["value"], "http://www.wikidata.org/entity/")
|
|
83
|
+
wikidata_id = _removeprefix(wikidata_id, "http://wikidata.org/entity/")
|
|
85
84
|
entity_id = row["id"]["value"]
|
|
86
85
|
yield wikidata_id, entity_id
|
|
87
86
|
|
|
88
87
|
|
|
88
|
+
def _removeprefix(s, prefix):
|
|
89
|
+
if s.startswith(prefix):
|
|
90
|
+
return s[len(prefix) :]
|
|
91
|
+
return s
|
|
92
|
+
|
|
93
|
+
|
|
89
94
|
HEADERS = {
|
|
90
95
|
"User-Agent": f"pyobo/{get_version()}",
|
|
91
96
|
}
|
pyobo/xrefdb/xrefs_pipeline.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
"""Pipeline for extracting all xrefs from OBO documents available."""
|
|
4
2
|
|
|
5
3
|
import gzip
|
|
6
4
|
import itertools as itt
|
|
7
5
|
import logging
|
|
8
|
-
from
|
|
6
|
+
from collections.abc import Iterable
|
|
7
|
+
from typing import Optional, cast
|
|
9
8
|
|
|
10
9
|
import bioregistry
|
|
11
10
|
import networkx as nx
|
|
@@ -83,7 +82,7 @@ def _iter_metadata(**kwargs):
|
|
|
83
82
|
yield prefix, version, data["date"], bioregistry.is_deprecated(prefix)
|
|
84
83
|
|
|
85
84
|
|
|
86
|
-
def _iter_names(leave: bool = False, **kwargs) -> Iterable[
|
|
85
|
+
def _iter_names(leave: bool = False, **kwargs) -> Iterable[tuple[str, str, str]]:
|
|
87
86
|
"""Iterate over all prefix-identifier-name triples we can get.
|
|
88
87
|
|
|
89
88
|
:param leave: should the tqdm be left behind?
|
|
@@ -100,13 +99,13 @@ def _iter_names(leave: bool = False, **kwargs) -> Iterable[Tuple[str, str, str]]
|
|
|
100
99
|
yield pubchem.PREFIX, identifier, name
|
|
101
100
|
|
|
102
101
|
|
|
103
|
-
def _iter_species(leave: bool = False, **kwargs) -> Iterable[
|
|
102
|
+
def _iter_species(leave: bool = False, **kwargs) -> Iterable[tuple[str, str, str]]:
|
|
104
103
|
"""Iterate over all prefix-identifier-species triples we can get."""
|
|
105
104
|
yield from iter_helper(get_id_species_mapping, leave=leave, **kwargs)
|
|
106
105
|
# TODO ncbigene
|
|
107
106
|
|
|
108
107
|
|
|
109
|
-
def _iter_definitions(leave: bool = False, **kwargs) -> Iterable[
|
|
108
|
+
def _iter_definitions(leave: bool = False, **kwargs) -> Iterable[tuple[str, str, str]]:
|
|
110
109
|
"""Iterate over all prefix-identifier-descriptions triples we can get."""
|
|
111
110
|
yield from iter_helper(get_id_definition_mapping, leave=leave, **kwargs)
|
|
112
111
|
yield from _iter_ncbigene(1, 8)
|
|
@@ -114,7 +113,7 @@ def _iter_definitions(leave: bool = False, **kwargs) -> Iterable[Tuple[str, str,
|
|
|
114
113
|
|
|
115
114
|
def _iter_alts(
|
|
116
115
|
leave: bool = False, strict: bool = True, **kwargs
|
|
117
|
-
) -> Iterable[
|
|
116
|
+
) -> Iterable[tuple[str, str, str]]:
|
|
118
117
|
for prefix, identifier, alts in iter_helper(
|
|
119
118
|
get_id_to_alts, leave=leave, strict=strict, **kwargs
|
|
120
119
|
):
|
|
@@ -122,7 +121,7 @@ def _iter_alts(
|
|
|
122
121
|
yield prefix, identifier, alt
|
|
123
122
|
|
|
124
123
|
|
|
125
|
-
def _iter_synonyms(leave: bool = False, **kwargs) -> Iterable[
|
|
124
|
+
def _iter_synonyms(leave: bool = False, **kwargs) -> Iterable[tuple[str, str, str]]:
|
|
126
125
|
"""Iterate over all prefix-identifier-synonym triples we can get.
|
|
127
126
|
|
|
128
127
|
:param leave: should the tqdm be left behind?
|
|
@@ -132,26 +131,26 @@ def _iter_synonyms(leave: bool = False, **kwargs) -> Iterable[Tuple[str, str, st
|
|
|
132
131
|
yield prefix, identifier, synonym
|
|
133
132
|
|
|
134
133
|
|
|
135
|
-
def _iter_typedefs(**kwargs) -> Iterable[
|
|
134
|
+
def _iter_typedefs(**kwargs) -> Iterable[tuple[str, str, str, str]]:
|
|
136
135
|
"""Iterate over all prefix-identifier-name triples we can get."""
|
|
137
136
|
for prefix, df in iter_helper_helper(get_typedef_df, **kwargs):
|
|
138
137
|
for t in df.values:
|
|
139
138
|
if all(t):
|
|
140
|
-
yield cast(
|
|
139
|
+
yield cast(tuple[str, str, str, str], (prefix, *t))
|
|
141
140
|
|
|
142
141
|
|
|
143
|
-
def _iter_relations(**kwargs) -> Iterable[
|
|
142
|
+
def _iter_relations(**kwargs) -> Iterable[tuple[str, str, str, str, str, str]]:
|
|
144
143
|
for prefix, df in iter_helper_helper(get_relations_df, **kwargs):
|
|
145
144
|
for t in df.values:
|
|
146
145
|
if all(t):
|
|
147
|
-
yield cast(
|
|
146
|
+
yield cast(tuple[str, str, str, str, str, str], (prefix, *t))
|
|
148
147
|
|
|
149
148
|
|
|
150
|
-
def _iter_properties(**kwargs) -> Iterable[
|
|
149
|
+
def _iter_properties(**kwargs) -> Iterable[tuple[str, str, str, str]]:
|
|
151
150
|
for prefix, df in iter_helper_helper(get_properties_df, **kwargs):
|
|
152
151
|
for t in df.values:
|
|
153
152
|
if all(t):
|
|
154
|
-
yield cast(
|
|
153
|
+
yield cast(tuple[str, str, str, str], (prefix, *t))
|
|
155
154
|
|
|
156
155
|
|
|
157
156
|
def _iter_xrefs(
|
|
@@ -161,7 +160,7 @@ def _iter_xrefs(
|
|
|
161
160
|
skip_below: Optional[str] = None,
|
|
162
161
|
strict: bool = True,
|
|
163
162
|
**kwargs,
|
|
164
|
-
) -> Iterable[
|
|
163
|
+
) -> Iterable[tuple[str, str, str, str, str]]:
|
|
165
164
|
it = iter_helper_helper(
|
|
166
165
|
get_xrefs_df,
|
|
167
166
|
use_tqdm=use_tqdm,
|
|
@@ -175,7 +174,7 @@ def _iter_xrefs(
|
|
|
175
174
|
for row in df.values:
|
|
176
175
|
if any(not element for element in row):
|
|
177
176
|
continue
|
|
178
|
-
yield cast(
|
|
177
|
+
yield cast(tuple[str, str, str, str, str], (prefix, *row, prefix))
|
|
179
178
|
for df in iter_xref_plugins(skip_below=skip_below):
|
|
180
179
|
df.dropna(inplace=True)
|
|
181
180
|
yield from tqdm(df.values, leave=False, total=len(df.index), unit_scale=True)
|