pyobo 0.10.12__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.
Files changed (151) 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 +0 -33
  22. pyobo/getters.py +19 -26
  23. pyobo/gilda_utils.py +9 -10
  24. pyobo/identifier_utils.py +10 -10
  25. pyobo/mocks.py +5 -6
  26. pyobo/normalizer.py +24 -24
  27. pyobo/obographs.py +3 -3
  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/sources/README.md +15 -0
  38. pyobo/sources/__init__.py +0 -2
  39. pyobo/sources/agrovoc.py +3 -3
  40. pyobo/sources/antibodyregistry.py +2 -3
  41. pyobo/sources/biogrid.py +4 -4
  42. pyobo/sources/ccle.py +3 -4
  43. pyobo/sources/cgnc.py +1 -3
  44. pyobo/sources/chebi.py +2 -4
  45. pyobo/sources/chembl.py +1 -3
  46. pyobo/sources/civic_gene.py +2 -3
  47. pyobo/sources/complexportal.py +3 -5
  48. pyobo/sources/conso.py +2 -4
  49. pyobo/sources/cpt.py +1 -3
  50. pyobo/sources/credit.py +1 -1
  51. pyobo/sources/cvx.py +1 -3
  52. pyobo/sources/depmap.py +3 -4
  53. pyobo/sources/dictybase_gene.py +1 -3
  54. pyobo/sources/drugbank.py +6 -7
  55. pyobo/sources/drugbank_salt.py +3 -4
  56. pyobo/sources/drugcentral.py +5 -7
  57. pyobo/sources/expasy.py +11 -12
  58. pyobo/sources/famplex.py +3 -5
  59. pyobo/sources/flybase.py +2 -4
  60. pyobo/sources/geonames.py +1 -1
  61. pyobo/sources/gmt_utils.py +5 -6
  62. pyobo/sources/go.py +4 -6
  63. pyobo/sources/gwascentral_phenotype.py +1 -3
  64. pyobo/sources/gwascentral_study.py +2 -3
  65. pyobo/sources/hgnc.py +6 -7
  66. pyobo/sources/hgncgenefamily.py +2 -4
  67. pyobo/sources/icd10.py +3 -4
  68. pyobo/sources/icd11.py +3 -4
  69. pyobo/sources/icd_utils.py +6 -7
  70. pyobo/sources/interpro.py +3 -5
  71. pyobo/sources/itis.py +1 -3
  72. pyobo/sources/kegg/__init__.py +0 -2
  73. pyobo/sources/kegg/api.py +3 -4
  74. pyobo/sources/kegg/genes.py +3 -4
  75. pyobo/sources/kegg/genome.py +1 -3
  76. pyobo/sources/kegg/pathway.py +5 -6
  77. pyobo/sources/mesh.py +19 -21
  78. pyobo/sources/mgi.py +1 -3
  79. pyobo/sources/mirbase.py +4 -6
  80. pyobo/sources/mirbase_constants.py +0 -2
  81. pyobo/sources/mirbase_family.py +1 -3
  82. pyobo/sources/mirbase_mature.py +1 -3
  83. pyobo/sources/msigdb.py +4 -5
  84. pyobo/sources/ncbigene.py +3 -5
  85. pyobo/sources/npass.py +1 -3
  86. pyobo/sources/omim_ps.py +1 -3
  87. pyobo/sources/pathbank.py +3 -5
  88. pyobo/sources/pfam.py +1 -3
  89. pyobo/sources/pfam_clan.py +1 -3
  90. pyobo/sources/pid.py +3 -5
  91. pyobo/sources/pombase.py +1 -3
  92. pyobo/sources/pubchem.py +2 -3
  93. pyobo/sources/reactome.py +2 -4
  94. pyobo/sources/rgd.py +2 -3
  95. pyobo/sources/rhea.py +7 -8
  96. pyobo/sources/ror.py +3 -2
  97. pyobo/sources/selventa/__init__.py +0 -2
  98. pyobo/sources/selventa/schem.py +1 -3
  99. pyobo/sources/selventa/scomp.py +1 -3
  100. pyobo/sources/selventa/sdis.py +1 -3
  101. pyobo/sources/selventa/sfam.py +1 -3
  102. pyobo/sources/sgd.py +1 -3
  103. pyobo/sources/slm.py +1 -3
  104. pyobo/sources/umls/__init__.py +0 -2
  105. pyobo/sources/umls/__main__.py +0 -2
  106. pyobo/sources/umls/get_synonym_types.py +1 -1
  107. pyobo/sources/umls/umls.py +2 -4
  108. pyobo/sources/uniprot/__init__.py +0 -2
  109. pyobo/sources/uniprot/uniprot.py +4 -4
  110. pyobo/sources/uniprot/uniprot_ptm.py +6 -5
  111. pyobo/sources/utils.py +3 -5
  112. pyobo/sources/wikipathways.py +1 -3
  113. pyobo/sources/zfin.py +2 -3
  114. pyobo/ssg/__init__.py +3 -2
  115. pyobo/struct/__init__.py +0 -2
  116. pyobo/struct/reference.py +13 -15
  117. pyobo/struct/struct.py +102 -96
  118. pyobo/struct/typedef.py +9 -10
  119. pyobo/struct/utils.py +0 -2
  120. pyobo/utils/__init__.py +0 -2
  121. pyobo/utils/cache.py +14 -6
  122. pyobo/utils/io.py +9 -10
  123. pyobo/utils/iter.py +5 -6
  124. pyobo/utils/misc.py +1 -3
  125. pyobo/utils/ndex_utils.py +6 -7
  126. pyobo/utils/path.py +4 -5
  127. pyobo/version.py +3 -5
  128. pyobo/xrefdb/__init__.py +0 -2
  129. pyobo/xrefdb/canonicalizer.py +27 -18
  130. pyobo/xrefdb/priority.py +0 -2
  131. pyobo/xrefdb/sources/__init__.py +3 -4
  132. pyobo/xrefdb/sources/biomappings.py +0 -2
  133. pyobo/xrefdb/sources/cbms2019.py +0 -2
  134. pyobo/xrefdb/sources/chembl.py +0 -2
  135. pyobo/xrefdb/sources/compath.py +1 -3
  136. pyobo/xrefdb/sources/famplex.py +3 -5
  137. pyobo/xrefdb/sources/gilda.py +0 -2
  138. pyobo/xrefdb/sources/intact.py +5 -5
  139. pyobo/xrefdb/sources/ncit.py +1 -3
  140. pyobo/xrefdb/sources/pubchem.py +2 -5
  141. pyobo/xrefdb/sources/wikidata.py +2 -4
  142. pyobo/xrefdb/xrefs_pipeline.py +15 -16
  143. {pyobo-0.10.12.dist-info → pyobo-0.11.0.dist-info}/LICENSE +1 -1
  144. pyobo-0.11.0.dist-info/METADATA +723 -0
  145. pyobo-0.11.0.dist-info/RECORD +171 -0
  146. {pyobo-0.10.12.dist-info → pyobo-0.11.0.dist-info}/WHEEL +1 -1
  147. pyobo-0.11.0.dist-info/entry_points.txt +2 -0
  148. pyobo-0.10.12.dist-info/METADATA +0 -499
  149. pyobo-0.10.12.dist-info/RECORD +0 -169
  150. pyobo-0.10.12.dist-info/entry_points.txt +0 -15
  151. {pyobo-0.10.12.dist-info → pyobo-0.11.0.dist-info}/top_level.txt +0 -0
pyobo/sources/mgi.py CHANGED
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for MGI."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
7
- from typing import Iterable
5
+ from collections.abc import Iterable
8
6
 
9
7
  import pandas as pd
10
8
  from tqdm.auto import tqdm
pyobo/sources/mirbase.py CHANGED
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for miRBase."""
4
2
 
5
3
  import gzip
6
4
  import logging
7
- from typing import Iterable, List, Mapping
5
+ from collections.abc import Iterable, Mapping
8
6
 
9
7
  from tqdm.auto import tqdm
10
8
 
@@ -48,7 +46,7 @@ def get_obo(force: bool = False) -> Obo:
48
46
  return MiRBaseGetter(force=force)
49
47
 
50
48
 
51
- def get_terms(version: str, force: bool = False) -> List[Term]:
49
+ def get_terms(version: str, force: bool = False) -> list[Term]:
52
50
  """Parse miRNA data from filepath and convert it to dictionary."""
53
51
  _assert_frozen_version(version)
54
52
  url = f"{BASE_URL}/miRNA.dat.gz"
@@ -77,7 +75,7 @@ def _prepare_organisms(version: str, force: bool = False):
77
75
  return {division: (taxonomy_id, name) for _, division, name, _tree, taxonomy_id in df.values}
78
76
 
79
77
 
80
- def _prepare_aliases(version: str, force: bool = False) -> Mapping[str, List[str]]:
78
+ def _prepare_aliases(version: str, force: bool = False) -> Mapping[str, list[str]]:
81
79
  _assert_frozen_version(version)
82
80
  url = f"{BASE_URL}/aliases.txt.gz"
83
81
  df = ensure_df(PREFIX, url=url, sep="\t", version=version, force=force)
@@ -94,7 +92,7 @@ def _process_definitions_lines(
94
92
  organisms = _prepare_organisms(version, force=force)
95
93
  aliases = _prepare_aliases(version, force=force)
96
94
 
97
- groups: List[List[str]] = []
95
+ groups: list[list[str]] = []
98
96
 
99
97
  for line in lines: # TODO replace with itertools.groupby
100
98
  if line.startswith("ID"):
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Constants for miRBase."""
4
2
 
5
3
  import pandas as pd
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for miRBase Families."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
  from tqdm.auto import tqdm
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for miRBase Mature."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
  from tqdm.auto import tqdm
pyobo/sources/msigdb.py CHANGED
@@ -1,11 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Parsers for MSig."""
4
2
 
5
3
  import logging
6
- from typing import Iterable, Optional
7
- from xml.etree import ElementTree
4
+ from collections.abc import Iterable
5
+ from typing import Optional
8
6
 
7
+ from lxml.etree import ElementTree
9
8
  from tqdm.auto import tqdm
10
9
 
11
10
  from ..struct import Obo, Reference, Term, has_participant
@@ -137,7 +136,7 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
137
136
  def _get_definition(attrib) -> Optional[str]:
138
137
  rv = attrib["DESCRIPTION_FULL"].strip() or attrib["DESCRIPTION_BRIEF"].strip() or None
139
138
  if rv is not None:
140
- return rv.replace(r"\d", "").replace(r"\s", "") # noqa: W605
139
+ return rv.replace(r"\d", "").replace(r"\s", "")
141
140
  return None
142
141
 
143
142
 
pyobo/sources/ncbigene.py CHANGED
@@ -1,9 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for Entrez."""
4
2
 
5
3
  import logging
6
- from typing import Iterable, List, Mapping, Set
4
+ from collections.abc import Iterable, Mapping
7
5
 
8
6
  import bioregistry
9
7
  import pandas as pd
@@ -47,7 +45,7 @@ GENE_INFO_COLUMNS = [
47
45
  ]
48
46
 
49
47
 
50
- def get_ncbigene_ids() -> Set[str]:
48
+ def get_ncbigene_ids() -> set[str]:
51
49
  """Get the Entrez name mapping."""
52
50
  df = _get_ncbigene_subset(["GeneID"])
53
51
  return set(df["GeneID"])
@@ -68,7 +66,7 @@ def _get_ncbigene_info_subset(usecols) -> Mapping[str, str]:
68
66
  return dict(df.values)
69
67
 
70
68
 
71
- def _get_ncbigene_subset(usecols: List[str]) -> pd.DataFrame:
69
+ def _get_ncbigene_subset(usecols: list[str]) -> pd.DataFrame:
72
70
  df = ensure_df(
73
71
  PREFIX,
74
72
  url=GENE_INFO_URL,
pyobo/sources/npass.py CHANGED
@@ -1,9 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for NPASS."""
4
2
 
5
3
  import logging
6
- from typing import Iterable
4
+ from collections.abc import Iterable
7
5
 
8
6
  import pandas as pd
9
7
  from tqdm.auto import tqdm
pyobo/sources/omim_ps.py CHANGED
@@ -1,9 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for OMIM Phenotypic Series."""
4
2
 
5
3
  import logging
6
- from typing import Iterable
4
+ from collections.abc import Iterable
7
5
 
8
6
  from bioversions.utils import get_soup
9
7
 
pyobo/sources/pathbank.py CHANGED
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for PathBank."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
7
- from typing import Iterable, Mapping, Set
5
+ from collections.abc import Iterable, Mapping
8
6
 
9
7
  import pandas as pd
10
8
  from tqdm.auto import tqdm
@@ -98,7 +96,7 @@ def get_proteins_df(version: str, force: bool = False) -> pd.DataFrame:
98
96
  return proteins_df
99
97
 
100
98
 
101
- def get_protein_mapping(version: str, force: bool = False) -> Mapping[str, Set[Reference]]:
99
+ def get_protein_mapping(version: str, force: bool = False) -> Mapping[str, set[Reference]]:
102
100
  """Make the protein mapping."""
103
101
  proteins_df = get_proteins_df(version=version, force=force)
104
102
  smpdb_id_to_proteins = defaultdict(set)
@@ -122,7 +120,7 @@ def get_metabolite_df(version: str, force: bool = False) -> pd.DataFrame:
122
120
  )
123
121
 
124
122
 
125
- def get_metabolite_mapping(version: str, force: bool = False) -> Mapping[str, Set[Reference]]:
123
+ def get_metabolite_mapping(version: str, force: bool = False) -> Mapping[str, set[Reference]]:
126
124
  """Make the metabolite mapping."""
127
125
  metabolites_df = get_metabolite_df(version=version, force=force)
128
126
  smpdb_id_to_metabolites = defaultdict(set)
pyobo/sources/pfam.py CHANGED
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Convert PFAM to OBO."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
 
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Convert PFAM Clans to OBO."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  from tqdm.auto import tqdm
8
6
 
pyobo/sources/pid.py CHANGED
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for NCI PID."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
7
- from typing import Iterable, List, Mapping, Tuple
5
+ from collections.abc import Iterable, Mapping
8
6
 
9
7
  import pandas as pd
10
8
 
@@ -45,7 +43,7 @@ def get_obo() -> Obo:
45
43
  return PIDGetter()
46
44
 
47
45
 
48
- def iter_networks(use_tqdm: bool = False, force: bool = False) -> Iterable[Tuple[str, CX]]:
46
+ def iter_networks(use_tqdm: bool = False, force: bool = False) -> Iterable[tuple[str, CX]]:
49
47
  """Iterate over NCI PID networks."""
50
48
  yield from ensure_ndex_network_set(
51
49
  PREFIX, NDEX_NETWORK_SET_UUID, use_tqdm=use_tqdm, force=force
@@ -117,7 +115,7 @@ def get_curation_df() -> pd.DataFrame:
117
115
  return df[["Text from NDEx", "Type", "Namespace", "Identifier"]]
118
116
 
119
117
 
120
- def get_remapping() -> Mapping[str, List[Tuple[str, str]]]:
118
+ def get_remapping() -> Mapping[str, list[tuple[str, str]]]:
121
119
  """Get a mapping from text to list of HGNC id/symbols."""
122
120
  curation_df = get_curation_df()
123
121
  rv = defaultdict(list)
pyobo/sources/pombase.py CHANGED
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for PomBase."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
7
- from typing import Iterable
5
+ from collections.abc import Iterable
8
6
 
9
7
  import pandas as pd
10
8
  from tqdm.auto import tqdm
pyobo/sources/pubchem.py CHANGED
@@ -1,9 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for PubChem Compound."""
4
2
 
5
3
  import logging
6
- from typing import Iterable, Mapping, Optional
4
+ from collections.abc import Iterable, Mapping
5
+ from typing import Optional
7
6
 
8
7
  import pandas as pd
9
8
  from bioregistry.utils import removeprefix
pyobo/sources/reactome.py CHANGED
@@ -1,11 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for Reactome."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
5
+ from collections.abc import Iterable, Mapping
7
6
  from functools import lru_cache
8
- from typing import Iterable, Mapping, Set
9
7
 
10
8
  import pandas as pd
11
9
  from tqdm.auto import tqdm
@@ -122,7 +120,7 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
122
120
 
123
121
 
124
122
  @lru_cache(maxsize=1)
125
- def get_protein_to_pathways() -> Mapping[str, Set[str]]:
123
+ def get_protein_to_pathways() -> Mapping[str, set[str]]:
126
124
  """Get a mapping from proteins to the pathways they're in."""
127
125
  protein_to_pathways = defaultdict(set)
128
126
  x = get_id_multirelations_mapping("reactome", has_participant)
pyobo/sources/rgd.py CHANGED
@@ -1,9 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for RGD."""
4
2
 
5
3
  import logging
6
- from typing import Iterable, Optional
4
+ from collections.abc import Iterable
5
+ from typing import Optional
7
6
 
8
7
  import pandas as pd
9
8
  from tqdm.auto import tqdm
pyobo/sources/rhea.py CHANGED
@@ -1,9 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for Rhea."""
4
2
 
5
3
  import logging
6
- from typing import TYPE_CHECKING, Dict, Iterable, Optional
4
+ from collections.abc import Iterable
5
+ from typing import TYPE_CHECKING, Optional
7
6
 
8
7
  import pystow
9
8
 
@@ -71,7 +70,7 @@ def ensure_rhea_rdf(version: Optional[str] = None, force: bool = False) -> "rdfl
71
70
  version,
72
71
  url=RHEA_RDF_GZ_URL,
73
72
  force=force,
74
- parse_kwargs=dict(format="xml"),
73
+ parse_kwargs={"format": "xml"},
75
74
  )
76
75
 
77
76
 
@@ -103,10 +102,10 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
103
102
  )
104
103
  names = {str(identifier): str(name) for _, identifier, name in result}
105
104
 
106
- terms: Dict[str, Term] = {}
107
- master_to_left: Dict[str, str] = {}
108
- master_to_right: Dict[str, str] = {}
109
- master_to_bi: Dict[str, str] = {}
105
+ terms: dict[str, Term] = {}
106
+ master_to_left: dict[str, str] = {}
107
+ master_to_right: dict[str, str] = {}
108
+ master_to_bi: dict[str, str] = {}
110
109
 
111
110
  directions = ensure_df(
112
111
  PREFIX,
pyobo/sources/ror.py CHANGED
@@ -4,7 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import zipfile
7
- from typing import Any, Iterable
7
+ from collections.abc import Iterable
8
+ from typing import Any
8
9
 
9
10
  import bioregistry
10
11
  import zenodo_client
@@ -62,7 +63,7 @@ class RORGetter(Obo):
62
63
  "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
63
64
  }
64
65
 
65
- def __post_init__(self): # noqa: D105
66
+ def __post_init__(self):
66
67
  self.data_version, _url, _path = _get_info()
67
68
  super().__post_init__()
68
69
 
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Importers for selventa terminologies."""
4
2
 
5
3
  from .schem import SCHEMGetter
@@ -1,11 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Selventa chemicals.
4
2
 
5
3
  .. seealso:: https://github.com/pyobo/pyobo/issues/27
6
4
  """
7
5
 
8
- from typing import Iterable
6
+ from collections.abc import Iterable
9
7
 
10
8
  import pandas as pd
11
9
 
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Selventa complexes."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
 
@@ -1,11 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Selventa diseases.
4
2
 
5
3
  .. seealso:: https://github.com/pyobo/pyobo/issues/26
6
4
  """
7
5
 
8
- from typing import Iterable
6
+ from collections.abc import Iterable
9
7
 
10
8
  import pandas as pd
11
9
 
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Selventa families."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
 
pyobo/sources/sgd.py CHANGED
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for SGD."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
  from urllib.parse import unquote_plus
7
5
 
8
6
  from ..struct import Obo, Reference, Synonym, Term, from_species
pyobo/sources/slm.py CHANGED
@@ -1,8 +1,6 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Swisslipids."""
4
2
 
5
- from typing import Iterable
3
+ from collections.abc import Iterable
6
4
 
7
5
  import pandas as pd
8
6
  from tqdm.auto import tqdm
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for UMLS."""
4
2
 
5
3
  from .umls import UMLSGetter, get_obo # noqa: F401
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """CLI for UMLS exporter."""
4
2
 
5
3
  from .umls import UMLSGetter
@@ -1,7 +1,7 @@
1
1
  """Utilities for UMLS synonyms."""
2
2
 
3
+ from collections.abc import Mapping
3
4
  from pathlib import Path
4
- from typing import Mapping
5
5
 
6
6
  import requests
7
7
  from bs4 import BeautifulSoup
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for UMLS.
4
2
 
5
3
  Run with ``python -m pyobo.sources.umls``
@@ -8,7 +6,7 @@ Run with ``python -m pyobo.sources.umls``
8
6
  import itertools as itt
9
7
  import operator
10
8
  from collections import defaultdict
11
- from typing import Iterable, Mapping, Set
9
+ from collections.abc import Iterable, Mapping
12
10
 
13
11
  import bioregistry
14
12
  import pandas as pd
@@ -67,7 +65,7 @@ def get_obo() -> Obo:
67
65
  return UMLSGetter()
68
66
 
69
67
 
70
- def get_semantic_types() -> Mapping[str, Set[str]]:
68
+ def get_semantic_types() -> Mapping[str, set[str]]:
71
69
  """Get UMLS semantic types for each term."""
72
70
  dd = defaultdict(set)
73
71
  with open_umls_semantic_types() as file:
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converters for UniProt resources."""
4
2
 
5
3
  from .uniprot import PREFIX, UniProtGetter
@@ -1,10 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for UniProt."""
4
2
 
3
+ from collections.abc import Iterable
5
4
  from operator import attrgetter
6
5
  from pathlib import Path
7
- from typing import Iterable, List, Optional, cast
6
+ from typing import Optional, cast
8
7
 
9
8
  from tqdm.auto import tqdm
10
9
 
@@ -57,6 +56,7 @@ class UniProtGetter(Obo):
57
56
  gene_product_of,
58
57
  molecularly_interacts_with,
59
58
  derives_from,
59
+ located_in,
60
60
  ]
61
61
 
62
62
  def iter_terms(self, force: bool = False) -> Iterable[Term]:
@@ -154,7 +154,7 @@ def iter_terms(version: Optional[str] = None) -> Iterable[Term]:
154
154
  yield term
155
155
 
156
156
 
157
- def _parse_go(go_terms) -> List[Reference]:
157
+ def _parse_go(go_terms) -> list[Reference]:
158
158
  rv = []
159
159
  if go_terms:
160
160
  for go_term in go_terms.split(";"):
@@ -27,7 +27,8 @@ DR Cross-reference to external Optional; once or more
27
27
 
28
28
  import itertools as itt
29
29
  from collections import defaultdict
30
- from typing import DefaultDict, Iterable, List, Mapping, Optional, Tuple
30
+ from collections.abc import Iterable, Mapping
31
+ from typing import Optional
31
32
 
32
33
  from tqdm.auto import tqdm
33
34
 
@@ -63,18 +64,18 @@ def iter_terms(force: bool = False) -> Iterable[Term]:
63
64
  path = ensure_path(PREFIX, url=URL, force=force)
64
65
  with open(path) as file:
65
66
  lines = list(file)
66
- it: Iterable[Tuple[str, str]] = ((line[:2], line[2:].strip()) for line in lines[47:-5])
67
+ it: Iterable[tuple[str, str]] = ((line[:2], line[2:].strip()) for line in lines[47:-5])
67
68
  for i, (_, term_lines) in enumerate(itt.groupby(it, key=lambda p: p[0] == "//")):
68
69
  term = _parse(i, term_lines)
69
70
  if term:
70
71
  yield term
71
72
 
72
73
 
73
- def _parse(i, lines: Iterable[Tuple[str, str]]) -> Optional[Term]:
74
- dd_: DefaultDict[str, List[str]] = defaultdict(list)
74
+ def _parse(i, lines: Iterable[tuple[str, str]]) -> Optional[Term]:
75
+ dd_: defaultdict[str, list[str]] = defaultdict(list)
75
76
  for key, value in lines:
76
77
  dd_[key].append(value)
77
- dd: Mapping[str, List[str]] = dict(dd_)
78
+ dd: Mapping[str, list[str]] = dict(dd_)
78
79
 
79
80
  if "//" in dd:
80
81
  return None
pyobo/sources/utils.py CHANGED
@@ -1,9 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Utilities for converters."""
4
2
 
5
3
  import logging
6
- from typing import Mapping, Set, Tuple
4
+ from collections.abc import Mapping
7
5
 
8
6
  from ..utils.io import multisetdict
9
7
 
@@ -15,7 +13,7 @@ __all__ = [
15
13
  logger = logging.getLogger(__name__)
16
14
 
17
15
 
18
- def get_go_mapping(path: str, prefix: str) -> Mapping[str, Set[Tuple[str, str]]]:
16
+ def get_go_mapping(path: str, prefix: str) -> Mapping[str, set[tuple[str, str]]]:
19
17
  """Get a GO mapping file."""
20
18
  with open(path) as file:
21
19
  return multisetdict(
@@ -23,7 +21,7 @@ def get_go_mapping(path: str, prefix: str) -> Mapping[str, Set[Tuple[str, str]]]
23
21
  )
24
22
 
25
23
 
26
- def process_go_mapping_line(line: str, prefix: str) -> Tuple[str, Tuple[str, str]]:
24
+ def process_go_mapping_line(line: str, prefix: str) -> tuple[str, tuple[str, str]]:
27
25
  """Process a GO mapping line."""
28
26
  line1 = line[len(f"{prefix}:") :]
29
27
  line2, go_id = line1.rsplit(";", 1)
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for WikiPathways."""
4
2
 
5
3
  import logging
6
4
  import urllib.error
7
- from typing import Iterable
5
+ from collections.abc import Iterable
8
6
 
9
7
  from .gmt_utils import parse_wikipathways_gmt
10
8
  from ..constants import SPECIES_REMAPPING
pyobo/sources/zfin.py CHANGED
@@ -1,10 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Converter for ZFIN."""
4
2
 
5
3
  import logging
6
4
  from collections import defaultdict
7
- from typing import Iterable, Optional
5
+ from collections.abc import Iterable
6
+ from typing import Optional
8
7
 
9
8
  from tqdm.auto import tqdm
10
9
 
pyobo/ssg/__init__.py CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  import itertools as itt
4
4
  from collections import defaultdict
5
+ from collections.abc import Sequence
5
6
  from operator import attrgetter
6
7
  from pathlib import Path
7
- from typing import Optional, Sequence, Tuple, Union
8
+ from typing import Optional, Union
8
9
 
9
10
  import bioregistry
10
11
  from bioregistry.constants import BIOREGISTRY_DEFAULT_BASE_URL
@@ -37,7 +38,7 @@ def make_site(
37
38
  metaregistry_metaprefix: Optional[str] = None,
38
39
  metaregistry_name: Optional[str] = None,
39
40
  metaregistry_base_url: Optional[str] = None,
40
- show_properties_in_manifest: Optional[Sequence[Tuple[str, str]]] = None,
41
+ show_properties_in_manifest: Optional[Sequence[tuple[str, str]]] = None,
41
42
  ) -> None:
42
43
  """Make a website in the given directory.
43
44
 
pyobo/struct/__init__.py CHANGED
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Data structures for OBO."""
4
2
 
5
3
  from .reference import Reference # noqa: F401