pyobo 0.10.12__py3-none-any.whl → 0.11.1__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.
Files changed (153) hide show
  1. pyobo/__init__.py +0 -2
  2. pyobo/__main__.py +0 -2
  3. pyobo/api/__init__.py +0 -2
  4. pyobo/api/alts.py +6 -7
  5. pyobo/api/hierarchy.py +14 -15
  6. pyobo/api/metadata.py +3 -4
  7. pyobo/api/names.py +31 -32
  8. pyobo/api/properties.py +6 -7
  9. pyobo/api/relations.py +12 -11
  10. pyobo/api/species.py +5 -6
  11. pyobo/api/typedefs.py +1 -3
  12. pyobo/api/utils.py +61 -5
  13. pyobo/api/xrefs.py +4 -5
  14. pyobo/aws.py +3 -5
  15. pyobo/cli/__init__.py +0 -2
  16. pyobo/cli/aws.py +0 -2
  17. pyobo/cli/cli.py +0 -4
  18. pyobo/cli/database.py +1 -3
  19. pyobo/cli/lookup.py +0 -2
  20. pyobo/cli/utils.py +0 -2
  21. pyobo/constants.py +1 -33
  22. pyobo/getters.py +19 -26
  23. pyobo/gilda_utils.py +19 -17
  24. pyobo/identifier_utils.py +10 -10
  25. pyobo/mocks.py +5 -6
  26. pyobo/normalizer.py +24 -24
  27. pyobo/obographs.py +8 -5
  28. pyobo/plugins.py +3 -4
  29. pyobo/py.typed +0 -0
  30. pyobo/reader.py +19 -21
  31. pyobo/registries/__init__.py +0 -2
  32. pyobo/registries/metaregistry.py +6 -8
  33. pyobo/resource_utils.py +1 -3
  34. pyobo/resources/__init__.py +0 -2
  35. pyobo/resources/ncbitaxon.py +2 -3
  36. pyobo/resources/ro.py +2 -4
  37. pyobo/resources/so.py +55 -0
  38. pyobo/resources/so.tsv +2604 -0
  39. pyobo/sources/README.md +15 -0
  40. pyobo/sources/__init__.py +0 -2
  41. pyobo/sources/agrovoc.py +3 -3
  42. pyobo/sources/antibodyregistry.py +2 -3
  43. pyobo/sources/biogrid.py +4 -4
  44. pyobo/sources/ccle.py +3 -4
  45. pyobo/sources/cgnc.py +1 -3
  46. pyobo/sources/chebi.py +2 -4
  47. pyobo/sources/chembl.py +1 -3
  48. pyobo/sources/civic_gene.py +2 -3
  49. pyobo/sources/complexportal.py +57 -20
  50. pyobo/sources/conso.py +2 -4
  51. pyobo/sources/cpt.py +1 -3
  52. pyobo/sources/credit.py +1 -1
  53. pyobo/sources/cvx.py +1 -3
  54. pyobo/sources/depmap.py +3 -4
  55. pyobo/sources/dictybase_gene.py +15 -12
  56. pyobo/sources/drugbank.py +6 -7
  57. pyobo/sources/drugbank_salt.py +3 -4
  58. pyobo/sources/drugcentral.py +9 -8
  59. pyobo/sources/expasy.py +33 -16
  60. pyobo/sources/famplex.py +3 -5
  61. pyobo/sources/flybase.py +5 -6
  62. pyobo/sources/geonames.py +1 -1
  63. pyobo/sources/gmt_utils.py +5 -6
  64. pyobo/sources/go.py +4 -6
  65. pyobo/sources/gwascentral_phenotype.py +1 -3
  66. pyobo/sources/gwascentral_study.py +2 -3
  67. pyobo/sources/hgnc.py +30 -26
  68. pyobo/sources/hgncgenefamily.py +9 -11
  69. pyobo/sources/icd10.py +3 -4
  70. pyobo/sources/icd11.py +3 -4
  71. pyobo/sources/icd_utils.py +6 -7
  72. pyobo/sources/interpro.py +3 -5
  73. pyobo/sources/itis.py +1 -3
  74. pyobo/sources/kegg/__init__.py +0 -2
  75. pyobo/sources/kegg/api.py +3 -4
  76. pyobo/sources/kegg/genes.py +3 -4
  77. pyobo/sources/kegg/genome.py +19 -9
  78. pyobo/sources/kegg/pathway.py +5 -6
  79. pyobo/sources/mesh.py +19 -21
  80. pyobo/sources/mgi.py +1 -3
  81. pyobo/sources/mirbase.py +13 -9
  82. pyobo/sources/mirbase_constants.py +0 -2
  83. pyobo/sources/mirbase_family.py +1 -3
  84. pyobo/sources/mirbase_mature.py +1 -3
  85. pyobo/sources/msigdb.py +4 -5
  86. pyobo/sources/ncbigene.py +3 -5
  87. pyobo/sources/npass.py +2 -4
  88. pyobo/sources/omim_ps.py +1 -3
  89. pyobo/sources/pathbank.py +35 -28
  90. pyobo/sources/pfam.py +1 -3
  91. pyobo/sources/pfam_clan.py +1 -3
  92. pyobo/sources/pid.py +3 -5
  93. pyobo/sources/pombase.py +7 -6
  94. pyobo/sources/pubchem.py +2 -3
  95. pyobo/sources/reactome.py +30 -11
  96. pyobo/sources/rgd.py +3 -4
  97. pyobo/sources/rhea.py +7 -8
  98. pyobo/sources/ror.py +3 -2
  99. pyobo/sources/selventa/__init__.py +0 -2
  100. pyobo/sources/selventa/schem.py +1 -3
  101. pyobo/sources/selventa/scomp.py +1 -3
  102. pyobo/sources/selventa/sdis.py +1 -3
  103. pyobo/sources/selventa/sfam.py +1 -3
  104. pyobo/sources/sgd.py +1 -3
  105. pyobo/sources/slm.py +29 -17
  106. pyobo/sources/umls/__init__.py +0 -2
  107. pyobo/sources/umls/__main__.py +0 -2
  108. pyobo/sources/umls/get_synonym_types.py +1 -1
  109. pyobo/sources/umls/umls.py +2 -4
  110. pyobo/sources/uniprot/__init__.py +0 -2
  111. pyobo/sources/uniprot/uniprot.py +11 -10
  112. pyobo/sources/uniprot/uniprot_ptm.py +6 -5
  113. pyobo/sources/utils.py +3 -5
  114. pyobo/sources/wikipathways.py +1 -3
  115. pyobo/sources/zfin.py +20 -9
  116. pyobo/ssg/__init__.py +3 -2
  117. pyobo/struct/__init__.py +0 -2
  118. pyobo/struct/reference.py +22 -23
  119. pyobo/struct/struct.py +132 -116
  120. pyobo/struct/typedef.py +14 -10
  121. pyobo/struct/utils.py +0 -2
  122. pyobo/utils/__init__.py +0 -2
  123. pyobo/utils/cache.py +14 -6
  124. pyobo/utils/io.py +9 -10
  125. pyobo/utils/iter.py +5 -6
  126. pyobo/utils/misc.py +1 -3
  127. pyobo/utils/ndex_utils.py +6 -7
  128. pyobo/utils/path.py +4 -5
  129. pyobo/version.py +3 -5
  130. pyobo/xrefdb/__init__.py +0 -2
  131. pyobo/xrefdb/canonicalizer.py +27 -18
  132. pyobo/xrefdb/priority.py +0 -2
  133. pyobo/xrefdb/sources/__init__.py +3 -4
  134. pyobo/xrefdb/sources/biomappings.py +0 -2
  135. pyobo/xrefdb/sources/cbms2019.py +0 -2
  136. pyobo/xrefdb/sources/chembl.py +0 -2
  137. pyobo/xrefdb/sources/compath.py +1 -3
  138. pyobo/xrefdb/sources/famplex.py +3 -5
  139. pyobo/xrefdb/sources/gilda.py +0 -2
  140. pyobo/xrefdb/sources/intact.py +5 -5
  141. pyobo/xrefdb/sources/ncit.py +1 -3
  142. pyobo/xrefdb/sources/pubchem.py +2 -5
  143. pyobo/xrefdb/sources/wikidata.py +2 -4
  144. pyobo/xrefdb/xrefs_pipeline.py +15 -16
  145. {pyobo-0.10.12.dist-info → pyobo-0.11.1.dist-info}/LICENSE +1 -1
  146. pyobo-0.11.1.dist-info/METADATA +711 -0
  147. pyobo-0.11.1.dist-info/RECORD +173 -0
  148. {pyobo-0.10.12.dist-info → pyobo-0.11.1.dist-info}/WHEEL +1 -1
  149. pyobo-0.11.1.dist-info/entry_points.txt +2 -0
  150. pyobo-0.10.12.dist-info/METADATA +0 -499
  151. pyobo-0.10.12.dist-info/RECORD +0 -169
  152. pyobo-0.10.12.dist-info/entry_points.txt +0 -15
  153. {pyobo-0.10.12.dist-info → pyobo-0.11.1.dist-info}/top_level.txt +0 -0
@@ -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
5
  import pandas as pd
8
6
 
9
- from ...api.utils import get_version
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,8 +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 = get_version("pubchem")
22
- assert version is not None
19
+ version = safe_get_version("pubchem")
23
20
  cid_mesh_url = _get_pubchem_extras_url(version, "CID-MeSH")
24
21
  return pd.DataFrame(
25
22
  [
@@ -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 typing import Iterable, Tuple
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[Tuple[str, str]]:
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:
@@ -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 typing import Iterable, Optional, Tuple, cast
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[Tuple[str, str, str]]:
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[Tuple[str, str, str]]:
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[Tuple[str, str, str]]:
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[Tuple[str, str, str]]:
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[Tuple[str, str, str]]:
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[Tuple[str, str, str, str]]:
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(Tuple[str, str, str, str], (prefix, *t))
139
+ yield cast(tuple[str, str, str, str], (prefix, *t))
141
140
 
142
141
 
143
- def _iter_relations(**kwargs) -> Iterable[Tuple[str, str, str, str, str, str]]:
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(Tuple[str, str, str, str, str, str], (prefix, *t))
146
+ yield cast(tuple[str, str, str, str, str, str], (prefix, *t))
148
147
 
149
148
 
150
- def _iter_properties(**kwargs) -> Iterable[Tuple[str, str, str, str]]:
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(Tuple[str, str, str, str], (prefix, *t))
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[Tuple[str, str, str, str, str]]:
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(Tuple[str, str, str, str, str], (prefix, *row, prefix))
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)
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Charles Tapley Hoyt
3
+ Copyright (c) 2024 Charles Tapley Hoyt
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal