pyobo 0.12.5__py3-none-any.whl → 0.12.7__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 +2 -0
- pyobo/cli/database.py +7 -1
- pyobo/identifier_utils/api.py +3 -1
- pyobo/sources/drugcentral.py +2 -1
- pyobo/sources/iana_media_type.py +65 -9
- pyobo/sources/spdx.py +10 -6
- pyobo/struct/functional/obo_to_functional.py +9 -3
- pyobo/struct/obograph/export.py +8 -2
- pyobo/struct/struct.py +22 -0
- pyobo/struct/struct_utils.py +17 -3
- pyobo/struct/typedef.py +1 -0
- pyobo/utils/misc.py +14 -7
- pyobo/version.py +1 -1
- {pyobo-0.12.5.dist-info → pyobo-0.12.7.dist-info}/METADATA +7 -3
- {pyobo-0.12.5.dist-info → pyobo-0.12.7.dist-info}/RECORD +18 -18
- {pyobo-0.12.5.dist-info → pyobo-0.12.7.dist-info}/WHEEL +0 -0
- {pyobo-0.12.5.dist-info → pyobo-0.12.7.dist-info}/entry_points.txt +0 -0
- {pyobo-0.12.5.dist-info → pyobo-0.12.7.dist-info}/licenses/LICENSE +0 -0
pyobo/__init__.py
CHANGED
|
@@ -65,6 +65,7 @@ from .plugins import (
|
|
|
65
65
|
run_nomenclature_plugin,
|
|
66
66
|
)
|
|
67
67
|
from .struct import (
|
|
68
|
+
Annotation,
|
|
68
69
|
Obo,
|
|
69
70
|
Reference,
|
|
70
71
|
StanzaType,
|
|
@@ -80,6 +81,7 @@ from .utils.path import ensure_path
|
|
|
80
81
|
from .version import get_version
|
|
81
82
|
|
|
82
83
|
__all__ = [
|
|
84
|
+
"Annotation",
|
|
83
85
|
"Obo",
|
|
84
86
|
"Reference",
|
|
85
87
|
"StanzaType",
|
pyobo/cli/database.py
CHANGED
|
@@ -6,6 +6,7 @@ from collections.abc import Iterable
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
8
|
import bioregistry
|
|
9
|
+
import bioversions
|
|
9
10
|
import click
|
|
10
11
|
from more_click import verbose_option
|
|
11
12
|
from tqdm.contrib.logging import logging_redirect_tqdm
|
|
@@ -97,12 +98,17 @@ def _update_database_kwargs(kwargs: DatabaseKwargs) -> DatabaseKwargs:
|
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
@database_annotate
|
|
101
|
+
@click.option("--eager-versions", is_flag=True)
|
|
100
102
|
@click.pass_context
|
|
101
|
-
def build(ctx: click.Context, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
103
|
+
def build(ctx: click.Context, eager_versions: bool, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
102
104
|
"""Build all databases."""
|
|
103
105
|
# if no_strict and zenodo:
|
|
104
106
|
# click.secho("Must be strict before uploading", fg="red")
|
|
105
107
|
# sys.exit(1)
|
|
108
|
+
|
|
109
|
+
if eager_versions:
|
|
110
|
+
bioversions.get_rows(use_tqdm=True)
|
|
111
|
+
|
|
106
112
|
with logging_redirect_tqdm():
|
|
107
113
|
click.secho("Collecting metadata and building", fg="cyan", bold=True)
|
|
108
114
|
# note that this is the only one that needs a force=force
|
pyobo/identifier_utils/api.py
CHANGED
|
@@ -287,7 +287,9 @@ def wrap_norm_prefix(f):
|
|
|
287
287
|
raise ValueError(f"Invalid prefix: {prefix.prefix}")
|
|
288
288
|
prefix = ReferenceTuple(norm_prefix, prefix.identifier)
|
|
289
289
|
else:
|
|
290
|
-
raise TypeError
|
|
290
|
+
raise TypeError(
|
|
291
|
+
f"prefix should be given as a string or reference object. Got {type(prefix)} {prefix}"
|
|
292
|
+
)
|
|
291
293
|
return f(prefix, *args, **kwargs)
|
|
292
294
|
|
|
293
295
|
return _wrapped
|
pyobo/sources/drugcentral.py
CHANGED
|
@@ -6,7 +6,6 @@ from collections.abc import Iterable
|
|
|
6
6
|
from contextlib import closing
|
|
7
7
|
|
|
8
8
|
import bioregistry
|
|
9
|
-
import psycopg2
|
|
10
9
|
from pydantic import ValidationError
|
|
11
10
|
from tqdm.auto import tqdm
|
|
12
11
|
|
|
@@ -42,6 +41,8 @@ class DrugCentralGetter(Obo):
|
|
|
42
41
|
|
|
43
42
|
def iter_terms() -> Iterable[Term]:
|
|
44
43
|
"""Iterate over DrugCentral terms."""
|
|
44
|
+
import psycopg2
|
|
45
|
+
|
|
45
46
|
with closing(psycopg2.connect(**PARAMS)) as conn:
|
|
46
47
|
with closing(conn.cursor()) as cur:
|
|
47
48
|
cur.execute(
|
pyobo/sources/iana_media_type.py
CHANGED
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
from collections.abc import Iterable
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import requests
|
|
9
|
+
|
|
10
|
+
from pyobo import Obo, Reference, Term, TypeDef, default_reference
|
|
11
|
+
from pyobo.struct import Annotation
|
|
12
|
+
from pyobo.struct.typedef import has_source, term_replaced_by
|
|
10
13
|
from pyobo.utils.path import ensure_df
|
|
11
14
|
|
|
12
15
|
__all__ = ["IANAGetter"]
|
|
13
16
|
|
|
14
17
|
PREFIX = "iana.mediatype"
|
|
15
|
-
|
|
18
|
+
ROOT_MEDIA_TYPE = Term.from_triple(prefix="dcterms", identifier="MediaType", name="media type")
|
|
19
|
+
ROOT_FILE_FORMAT = Term.from_triple(prefix="dcterms", identifier="FileFormat", name="file format")
|
|
16
20
|
|
|
17
21
|
#: The top-level types listed on https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
18
22
|
MEDIA_TYPE_GROUPS = [
|
|
@@ -31,13 +35,37 @@ MEDIA_TYPE_GROUPS = [
|
|
|
31
35
|
GROUP_TO_CSV = {
|
|
32
36
|
media_type_group: (
|
|
33
37
|
f"https://www.iana.org/assignments/media-types/{media_type_group}.csv",
|
|
34
|
-
Term(
|
|
35
|
-
|
|
36
|
-
),
|
|
38
|
+
Term(
|
|
39
|
+
reference=Reference(prefix=PREFIX, identifier=media_type_group, name=media_type_group)
|
|
40
|
+
).append_parent(ROOT_MEDIA_TYPE),
|
|
37
41
|
)
|
|
38
42
|
for media_type_group in MEDIA_TYPE_GROUPS
|
|
39
43
|
}
|
|
40
44
|
|
|
45
|
+
MIMETYPE_IO_URL = (
|
|
46
|
+
"https://github.com/patrickmccallum/mimetype-io/raw/refs/heads/master/src/mimeData.json"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _get_mimetypes():
|
|
51
|
+
records = requests.get(MIMETYPE_IO_URL, timeout=5).json()
|
|
52
|
+
rv = {}
|
|
53
|
+
for record in records:
|
|
54
|
+
name = record.pop("name")
|
|
55
|
+
rv[name] = record
|
|
56
|
+
return rv
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
PREDICATE = TypeDef(
|
|
60
|
+
reference=default_reference(
|
|
61
|
+
prefix=PREFIX, identifier="extension", name="appears with file extension"
|
|
62
|
+
),
|
|
63
|
+
domain=ROOT_MEDIA_TYPE.reference,
|
|
64
|
+
range=ROOT_FILE_FORMAT.reference,
|
|
65
|
+
definition="Connects a media type with a file format that has been observed to encode it",
|
|
66
|
+
is_metadata_tag=True,
|
|
67
|
+
)
|
|
68
|
+
|
|
41
69
|
|
|
42
70
|
class IANAGetter(Obo):
|
|
43
71
|
"""An ontology representation of IANA media types (i.e. MIME types)."""
|
|
@@ -45,9 +73,10 @@ class IANAGetter(Obo):
|
|
|
45
73
|
ontology = bioregistry_key = PREFIX
|
|
46
74
|
name = "IANA Media Types"
|
|
47
75
|
dynamic_version = True
|
|
48
|
-
root_terms = [
|
|
76
|
+
root_terms = [ROOT_MEDIA_TYPE.reference, ROOT_FILE_FORMAT.reference]
|
|
49
77
|
typedefs = [
|
|
50
78
|
term_replaced_by,
|
|
79
|
+
PREDICATE,
|
|
51
80
|
]
|
|
52
81
|
|
|
53
82
|
def iter_terms(self, force: bool = False) -> Iterable[Term]:
|
|
@@ -55,26 +84,53 @@ class IANAGetter(Obo):
|
|
|
55
84
|
return get_terms()
|
|
56
85
|
|
|
57
86
|
|
|
58
|
-
def get_terms() ->
|
|
87
|
+
def get_terms() -> Iterable[Term]:
|
|
59
88
|
"""Get IANA Media Type terms."""
|
|
89
|
+
mimetypes_data = _get_mimetypes()
|
|
90
|
+
|
|
91
|
+
filetype_to_term = {}
|
|
92
|
+
for record in mimetypes_data.values():
|
|
93
|
+
for filetype_str in record.get("fileTypes", []):
|
|
94
|
+
filetype_id = filetype_str.removeprefix(".")
|
|
95
|
+
filetype_term = Term(
|
|
96
|
+
reference=default_reference(PREFIX, identifier=filetype_id, name=filetype_str),
|
|
97
|
+
type="Instance",
|
|
98
|
+
)
|
|
99
|
+
filetype_term.append_parent(ROOT_FILE_FORMAT)
|
|
100
|
+
filetype_term.annotate_string(has_source, MIMETYPE_IO_URL)
|
|
101
|
+
filetype_to_term[filetype_str] = filetype_term
|
|
102
|
+
yield filetype_term
|
|
103
|
+
|
|
60
104
|
terms: dict[str, Term] = {}
|
|
61
105
|
forwards: dict[Term, str] = {}
|
|
62
106
|
for key, (url, parent) in GROUP_TO_CSV.items():
|
|
63
107
|
df = ensure_df(PREFIX, url=url, sep=",")
|
|
64
108
|
terms[key] = parent
|
|
65
109
|
for name, identifier, references in df.values:
|
|
110
|
+
mimetypes_record = mimetypes_data.get(identifier, {})
|
|
111
|
+
|
|
66
112
|
if "OBSOLE" in name or "DEPRECATED" in name:
|
|
67
113
|
is_obsolete = True
|
|
68
114
|
else:
|
|
69
115
|
is_obsolete = None
|
|
116
|
+
|
|
70
117
|
term = Term(
|
|
71
118
|
reference=Reference(prefix=PREFIX, identifier=identifier, name=name),
|
|
72
119
|
is_obsolete=is_obsolete,
|
|
120
|
+
# TODO how to add definition source?
|
|
121
|
+
definition=mimetypes_record.get("description"),
|
|
73
122
|
).append_parent(parent)
|
|
74
123
|
for reference in _process_references(references):
|
|
75
124
|
term.append_see_also_uri(reference)
|
|
76
125
|
terms[identifier.casefold()] = term
|
|
77
126
|
|
|
127
|
+
for filetype_str in mimetypes_record.get("fileTypes", []):
|
|
128
|
+
term.annotate_object(
|
|
129
|
+
PREDICATE,
|
|
130
|
+
filetype_to_term[filetype_str],
|
|
131
|
+
annotations=[Annotation.uri(has_source, MIMETYPE_IO_URL)],
|
|
132
|
+
)
|
|
133
|
+
|
|
78
134
|
if "in favor of" in name:
|
|
79
135
|
_, _, new = name.partition("in favor of ")
|
|
80
136
|
forwards[term] = new.casefold().strip().rstrip(")").strip()
|
|
@@ -84,7 +140,7 @@ def get_terms() -> list[Term]:
|
|
|
84
140
|
new = "application/vnd.afpc.afplinedata"
|
|
85
141
|
old.append_replaced_by(terms[new].reference)
|
|
86
142
|
|
|
87
|
-
|
|
143
|
+
yield from terms.values()
|
|
88
144
|
|
|
89
145
|
|
|
90
146
|
def _process_references(cell: str) -> list[str]:
|
pyobo/sources/spdx.py
CHANGED
|
@@ -55,11 +55,15 @@ def _get_term(record: dict[str, Any]) -> Term | None:
|
|
|
55
55
|
except ValidationError:
|
|
56
56
|
tqdm.write(f"invalid: {record['licenseId']}")
|
|
57
57
|
return None
|
|
58
|
-
term =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
term = (
|
|
59
|
+
Term(
|
|
60
|
+
reference=reference,
|
|
61
|
+
is_obsolete=True if record.get("isDeprecatedLicenseId") else None,
|
|
62
|
+
# type="Instance",
|
|
63
|
+
)
|
|
64
|
+
.append_parent(ROOT)
|
|
65
|
+
.append_synonym(record["licenseId"])
|
|
66
|
+
)
|
|
63
67
|
if record.get("isOsiApproved"):
|
|
64
68
|
term.annotate_boolean(IS_OSI, True)
|
|
65
69
|
if record.get("isFsfLibre"):
|
|
@@ -82,4 +86,4 @@ class SPDXLicenseGetter(Obo):
|
|
|
82
86
|
|
|
83
87
|
|
|
84
88
|
if __name__ == "__main__":
|
|
85
|
-
SPDXLicenseGetter.cli(
|
|
89
|
+
SPDXLicenseGetter.cli()
|
|
@@ -39,9 +39,15 @@ def get_ofn_from_obo(
|
|
|
39
39
|
prefix = obo_ontology.ontology
|
|
40
40
|
base = f"{_BASE}/{prefix}"
|
|
41
41
|
if iri is None:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if obo_ontology.ontology_iri:
|
|
43
|
+
iri = obo_ontology.ontology_iri
|
|
44
|
+
else:
|
|
45
|
+
iri = f"{base}/{prefix}.ofn"
|
|
46
|
+
if version_iri is None:
|
|
47
|
+
if obo_ontology.ontology_version_iri:
|
|
48
|
+
version_iri = obo_ontology.ontology_version_iri
|
|
49
|
+
elif obo_ontology.data_version:
|
|
50
|
+
version_iri = f"{base}/{obo_ontology.data_version}/{prefix}.ofn"
|
|
45
51
|
ofn_ontology = Ontology(
|
|
46
52
|
iri=iri,
|
|
47
53
|
version_iri=version_iri,
|
pyobo/struct/obograph/export.py
CHANGED
|
@@ -70,8 +70,12 @@ def to_parsed_obograph(obo: Obo) -> og.StandardizedGraphDocument:
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
def _to_parsed_graph(obo: Obo) -> og.StandardizedGraph:
|
|
73
|
+
if obo.ontology_iri:
|
|
74
|
+
ontology_iri = obo.ontology_iri
|
|
75
|
+
else:
|
|
76
|
+
ontology_iri = f"http://purl.obolibrary.org/obo/{obo.ontology}.owl"
|
|
73
77
|
return og.StandardizedGraph(
|
|
74
|
-
id=
|
|
78
|
+
id=ontology_iri,
|
|
75
79
|
meta=_get_meta(obo),
|
|
76
80
|
nodes=_get_nodes(obo),
|
|
77
81
|
edges=_get_edges(obo),
|
|
@@ -167,7 +171,9 @@ def _get_meta(obo: Obo) -> og.StandardizedMeta | None:
|
|
|
167
171
|
)
|
|
168
172
|
)
|
|
169
173
|
|
|
170
|
-
if obo.
|
|
174
|
+
if obo.ontology_version_iri:
|
|
175
|
+
version_iri = obo.ontology_version_iri
|
|
176
|
+
elif obo.data_version:
|
|
171
177
|
version_iri = (
|
|
172
178
|
f"http://purl.obolibrary.org/obo/{obo.ontology}/{obo.data_version}/{obo.ontology}.owl"
|
|
173
179
|
)
|
pyobo/struct/struct.py
CHANGED
|
@@ -8,6 +8,7 @@ import json
|
|
|
8
8
|
import logging
|
|
9
9
|
import os
|
|
10
10
|
import sys
|
|
11
|
+
import tempfile
|
|
11
12
|
import warnings
|
|
12
13
|
from collections import ChainMap, defaultdict
|
|
13
14
|
from collections.abc import Callable, Collection, Iterable, Iterator, Mapping, Sequence
|
|
@@ -593,6 +594,10 @@ class Obo:
|
|
|
593
594
|
|
|
594
595
|
imports: ClassVar[list[str] | None] = None
|
|
595
596
|
|
|
597
|
+
ontology_iri: ClassVar[str | None] = None
|
|
598
|
+
|
|
599
|
+
ontology_version_iri: ClassVar[str | None] = None
|
|
600
|
+
|
|
596
601
|
def __post_init__(self):
|
|
597
602
|
"""Run post-init checks."""
|
|
598
603
|
if self.ontology is None:
|
|
@@ -1021,6 +1026,15 @@ class Obo:
|
|
|
1021
1026
|
ofn = get_ofn_from_obo(self)
|
|
1022
1027
|
ofn.write_funowl(path)
|
|
1023
1028
|
|
|
1029
|
+
def write_owl(self, path: str | Path) -> None:
|
|
1030
|
+
"""Write OWL, by first outputting OFN then converting with ROBOT."""
|
|
1031
|
+
from bioontologies import robot
|
|
1032
|
+
|
|
1033
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
1034
|
+
ofn_path = Path(directory).joinpath("tmp.ofn")
|
|
1035
|
+
self.write_ofn(ofn_path)
|
|
1036
|
+
robot.convert(ofn_path, path)
|
|
1037
|
+
|
|
1024
1038
|
def write_rdf(self, path: str | Path) -> None:
|
|
1025
1039
|
"""Write as Turtle RDF."""
|
|
1026
1040
|
from .functional.obo_to_functional import get_ofn_from_obo
|
|
@@ -2309,6 +2323,8 @@ def build_ontology(
|
|
|
2309
2323
|
mailing_list: str | None = None,
|
|
2310
2324
|
logo: str | None = None,
|
|
2311
2325
|
repository: str | None = None,
|
|
2326
|
+
ontology_iri: str | None = None,
|
|
2327
|
+
ontology_version_iri: str | None = None,
|
|
2312
2328
|
) -> Obo:
|
|
2313
2329
|
"""Build an ontology from parts."""
|
|
2314
2330
|
if name is None:
|
|
@@ -2368,6 +2384,8 @@ def build_ontology(
|
|
|
2368
2384
|
_subsetdefs=subsetdefs,
|
|
2369
2385
|
_property_values=properties,
|
|
2370
2386
|
_imports=imports,
|
|
2387
|
+
_ontology_iri=ontology_iri,
|
|
2388
|
+
_ontology_version_iri=ontology_version_iri,
|
|
2371
2389
|
terms=terms,
|
|
2372
2390
|
)
|
|
2373
2391
|
|
|
@@ -2385,6 +2403,8 @@ def make_ad_hoc_ontology(
|
|
|
2385
2403
|
_subsetdefs: list[tuple[Reference, str]] | None = None,
|
|
2386
2404
|
_property_values: list[Annotation] | None = None,
|
|
2387
2405
|
_imports: list[str] | None = None,
|
|
2406
|
+
_ontology_iri: str | None = None,
|
|
2407
|
+
_ontology_version_iri: str | None = None,
|
|
2388
2408
|
*,
|
|
2389
2409
|
terms: list[Term] | None = None,
|
|
2390
2410
|
) -> Obo:
|
|
@@ -2403,6 +2423,8 @@ def make_ad_hoc_ontology(
|
|
|
2403
2423
|
subsetdefs = _subsetdefs
|
|
2404
2424
|
property_values = _property_values
|
|
2405
2425
|
imports = _imports
|
|
2426
|
+
ontology_iri = _ontology_iri
|
|
2427
|
+
ontology_version_iri = _ontology_version_iri
|
|
2406
2428
|
|
|
2407
2429
|
def __post_init__(self):
|
|
2408
2430
|
self.date = _date
|
pyobo/struct/struct_utils.py
CHANGED
|
@@ -59,18 +59,32 @@ class Annotation(NamedTuple):
|
|
|
59
59
|
value: Reference | OBOLiteral
|
|
60
60
|
|
|
61
61
|
@classmethod
|
|
62
|
-
def float(cls, predicate: Reference, value: float) -> Self:
|
|
62
|
+
def float(cls, predicate: Reference | TypeDef, value: float) -> Self:
|
|
63
63
|
"""Return a literal property for a float."""
|
|
64
|
+
from .struct import TypeDef
|
|
65
|
+
|
|
66
|
+
if isinstance(predicate, TypeDef):
|
|
67
|
+
predicate = predicate.reference
|
|
64
68
|
return cls(predicate, OBOLiteral.float(value))
|
|
65
69
|
|
|
66
70
|
@classmethod
|
|
67
|
-
def uri(cls, predicate: Reference, uri: str) -> Self:
|
|
71
|
+
def uri(cls, predicate: Reference | TypeDef, uri: str) -> Self:
|
|
68
72
|
"""Return a literal property for a URI."""
|
|
73
|
+
from .struct import TypeDef
|
|
74
|
+
|
|
75
|
+
if isinstance(predicate, TypeDef):
|
|
76
|
+
predicate = predicate.reference
|
|
69
77
|
return cls(predicate, OBOLiteral.uri(uri))
|
|
70
78
|
|
|
71
79
|
@classmethod
|
|
72
|
-
def string(
|
|
80
|
+
def string(
|
|
81
|
+
cls, predicate: Reference | TypeDef, value: str, *, language: str | None = None
|
|
82
|
+
) -> Self:
|
|
73
83
|
"""Return a literal property for a float."""
|
|
84
|
+
from .struct import TypeDef
|
|
85
|
+
|
|
86
|
+
if isinstance(predicate, TypeDef):
|
|
87
|
+
predicate = predicate.reference
|
|
74
88
|
return cls(predicate, OBOLiteral.string(value, language=language))
|
|
75
89
|
|
|
76
90
|
@staticmethod
|
pyobo/struct/typedef.py
CHANGED
|
@@ -135,6 +135,7 @@ rdf_type = TypeDef(reference=v.rdf_type)
|
|
|
135
135
|
subproperty_of = TypeDef(reference=v.subproperty_of)
|
|
136
136
|
see_also = TypeDef(reference=v.see_also, is_metadata_tag=True)
|
|
137
137
|
comment = TypeDef(reference=v.comment, is_metadata_tag=True)
|
|
138
|
+
label = TypeDef(reference=v.label, is_metadata_tag=True)
|
|
138
139
|
has_member = TypeDef(
|
|
139
140
|
reference=Reference(prefix=RO_PREFIX, identifier="0002351", name="has member"),
|
|
140
141
|
)
|
pyobo/utils/misc.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
-
from collections.abc import Callable
|
|
6
|
+
from collections.abc import Callable, Iterable
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
|
|
9
9
|
import bioversions.utils
|
|
@@ -46,6 +46,8 @@ VERSION_PREFIXES = [
|
|
|
46
46
|
"http://w3id.org/nfdi4ing/metadata4ing/", # like http://w3id.org/nfdi4ing/metadata4ing/1.3.1
|
|
47
47
|
"http://www.semanticweb.com/OntoRxn/", # like http://www.semanticweb.com/OntoRxn/0.2.5
|
|
48
48
|
"https://w3id.org/lehrplan/ontology/", # like in https://w3id.org/lehrplan/ontology/1.0.0-4
|
|
49
|
+
"http://www.ebi.ac.uk/swo/version/", # http://www.ebi.ac.uk/swo/version/6.0
|
|
50
|
+
"https://w3id.org/emi/version/",
|
|
49
51
|
]
|
|
50
52
|
VERSION_PREFIX_SPLITS = [
|
|
51
53
|
"http://www.ebi.ac.uk/efo/releases/v",
|
|
@@ -193,18 +195,23 @@ def _prioritize_version(
|
|
|
193
195
|
return None
|
|
194
196
|
|
|
195
197
|
|
|
196
|
-
def
|
|
198
|
+
def _get_getter_urls(prefix: str) -> Iterable[tuple[OntologyFormat, str]]:
|
|
197
199
|
# assume that all possible files that can be downloaded
|
|
198
200
|
# are in sync and have the same version
|
|
199
|
-
for ontology_format,
|
|
200
|
-
url =
|
|
201
|
+
for ontology_format, get_url_func in ONTOLOGY_GETTERS:
|
|
202
|
+
url = get_url_func(prefix)
|
|
201
203
|
if url is None:
|
|
202
204
|
continue
|
|
205
|
+
yield ontology_format, url
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _get_version_from_artifact(prefix: str) -> str | None:
|
|
209
|
+
for ontology_format, url in _get_getter_urls(prefix):
|
|
203
210
|
# Try to peak into the file to get the version without fully downloading
|
|
204
|
-
|
|
205
|
-
if
|
|
211
|
+
get_version_func = VERSION_GETTERS.get(ontology_format)
|
|
212
|
+
if get_version_func is None:
|
|
206
213
|
continue
|
|
207
|
-
version =
|
|
214
|
+
version = get_version_func(prefix, url)
|
|
208
215
|
if version:
|
|
209
216
|
return cleanup_version(version, prefix=prefix)
|
|
210
217
|
return None
|
pyobo/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyobo
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.7
|
|
4
4
|
Summary: A python package for handling and generating OBO
|
|
5
5
|
Keywords: snekpack,cookiecutter,ontologies,biomedical ontologies,life sciences,natural sciences,bioinformatics,cheminformatics,Open Biomedical Ontologies,OBO
|
|
6
6
|
Author: Charles Tapley Hoyt
|
|
@@ -30,7 +30,6 @@ Requires-Dist: tqdm
|
|
|
30
30
|
Requires-Dist: pyyaml
|
|
31
31
|
Requires-Dist: pandas
|
|
32
32
|
Requires-Dist: requests
|
|
33
|
-
Requires-Dist: protmapper
|
|
34
33
|
Requires-Dist: more-itertools
|
|
35
34
|
Requires-Dist: more-click>=0.0.2
|
|
36
35
|
Requires-Dist: humanize
|
|
@@ -43,7 +42,6 @@ Requires-Dist: bioontologies>=0.7.2
|
|
|
43
42
|
Requires-Dist: ssslm>=0.0.13
|
|
44
43
|
Requires-Dist: zenodo-client>=0.3.6
|
|
45
44
|
Requires-Dist: class-resolver>=0.6.0
|
|
46
|
-
Requires-Dist: psycopg2-binary
|
|
47
45
|
Requires-Dist: pydantic>=2.0
|
|
48
46
|
Requires-Dist: curies>=0.10.17
|
|
49
47
|
Requires-Dist: curies-processing>=0.1.2
|
|
@@ -57,8 +55,11 @@ Requires-Dist: nih-reporter-downloader>=0.0.1
|
|
|
57
55
|
Requires-Dist: typing-extensions
|
|
58
56
|
Requires-Dist: rdflib
|
|
59
57
|
Requires-Dist: obographs>=0.0.8
|
|
58
|
+
Requires-Dist: psycopg2-binary ; extra == 'drugcentral'
|
|
60
59
|
Requires-Dist: ssslm[gilda] ; extra == 'gilda'
|
|
61
60
|
Requires-Dist: ssslm[gilda-slim] ; extra == 'gilda-slim'
|
|
61
|
+
Requires-Dist: protmapper ; extra == 'pid'
|
|
62
|
+
Requires-Dist: pyobo[drugcentral,pid] ; extra == 'sources'
|
|
62
63
|
Maintainer: Charles Tapley Hoyt
|
|
63
64
|
Maintainer-email: Charles Tapley Hoyt <cthoyt@gmail.com>
|
|
64
65
|
Requires-Python: >=3.10
|
|
@@ -67,8 +68,11 @@ Project-URL: Documentation, https://pyobo.readthedocs.io
|
|
|
67
68
|
Project-URL: Funding, https://github.com/sponsors/cthoyt
|
|
68
69
|
Project-URL: Homepage, https://github.com/biopragmatics/pyobo
|
|
69
70
|
Project-URL: Repository, https://github.com/biopragmatics/pyobo.git
|
|
71
|
+
Provides-Extra: drugcentral
|
|
70
72
|
Provides-Extra: gilda
|
|
71
73
|
Provides-Extra: gilda-slim
|
|
74
|
+
Provides-Extra: pid
|
|
75
|
+
Provides-Extra: sources
|
|
72
76
|
Description-Content-Type: text/markdown
|
|
73
77
|
|
|
74
78
|
<!--
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pyobo/.DS_Store,sha256=89c9b251ccb5e7628fa025768c73ba6621f3768619efd69855d3d7cdc1b33044,8196
|
|
2
|
-
pyobo/__init__.py,sha256=
|
|
2
|
+
pyobo/__init__.py,sha256=e86aa2d2fb934d7cc923d0588be45a493dd13e3465f48f19ed8b02332c160f75,3632
|
|
3
3
|
pyobo/__main__.py,sha256=70e610d8e10bc45fbd4fa9ee67dc672d2bbd6cb1e4e9e8a7aec4a8cfb11c0fd3,83
|
|
4
4
|
pyobo/api/__init__.py,sha256=6e194a5d230bf0297970d8b3267f5577130e536c440443bba286dee1dda3643e,3091
|
|
5
5
|
pyobo/api/alts.py,sha256=478b3162574616f2827bd73107f80f5dfdaf5971eaf6c6813109109dba89e522,3032
|
|
@@ -17,7 +17,7 @@ pyobo/api/utils.py,sha256=48232ccb8432615867f902b487dd047f55d431bc87291d5fbed791
|
|
|
17
17
|
pyobo/api/xrefs.py,sha256=9d62cbb761b36957e780d0546ce3154a33a90ae6be23bbbedadba8c735c6aab0,5242
|
|
18
18
|
pyobo/cli/__init__.py,sha256=a5388bbb38e3a62d0febdc958d0da413a9c152666e6059ea74934364b0e482f9,71
|
|
19
19
|
pyobo/cli/cli.py,sha256=e5b63fed95593a81f0859b42c71f8060be726f20738d2eb9354e6fe57f43b0b0,2842
|
|
20
|
-
pyobo/cli/database.py,sha256=
|
|
20
|
+
pyobo/cli/database.py,sha256=82b3d51b577bf3286883996f100bb7c301e404048a86d99a6f09afc78f564487,12121
|
|
21
21
|
pyobo/cli/database_utils.py,sha256=8d0eea4a0fa8664f90f910b5db536451ba9778d8342bc7d5f7a8a05da2b7adae,5540
|
|
22
22
|
pyobo/cli/lookup.py,sha256=1b11bbe771979c345ff8df494562919900b95e237c7c437997595ee42de31c76,9163
|
|
23
23
|
pyobo/cli/utils.py,sha256=9e6b57b311b44d61088e321efa387f6aacebd3d6d337bf8d1c589fb871b3304d,1738
|
|
@@ -25,7 +25,7 @@ pyobo/constants.py,sha256=1b9132661b9c730acc9f5d4345a4d73334c76b944676d191cd8aab
|
|
|
25
25
|
pyobo/getters.py,sha256=5f68100998658f6b070e12fbbd52cc8d280f142d5361287ac74ee3bcc406deb8,18197
|
|
26
26
|
pyobo/gilda_utils.py,sha256=b9384002b00b48dcc98be86b47d954bed41c8b9548c380aaab62fa9ad929d0aa,1990
|
|
27
27
|
pyobo/identifier_utils/__init__.py,sha256=8921c06613b0a9666662939fa5734bb8aa2e4988fb652562697ec1179b93f2ca,793
|
|
28
|
-
pyobo/identifier_utils/api.py,sha256=
|
|
28
|
+
pyobo/identifier_utils/api.py,sha256=7e293972b20e3a1b0722e1fe89afe839078a65e5f96c1323e52ea871c59a31e6,9365
|
|
29
29
|
pyobo/identifier_utils/relations/__init__.py,sha256=2961f492b8530a678a9e010887b5530c3de1cc2df8f294e210a18dbb748d01db,159
|
|
30
30
|
pyobo/identifier_utils/relations/api.py,sha256=c625bca0f09379ba7ef544d05aaf4b998ee9798945a90f3b98b6d763ef9d36df,5764
|
|
31
31
|
pyobo/identifier_utils/relations/data.json,sha256=88b6ce5fb632faa389b512b68f1b73acdd54b552a1aaa8043430eb5e0020a0bc,113169
|
|
@@ -77,7 +77,7 @@ pyobo/sources/dictybase_gene.py,sha256=78bbde62732e26cd92c2d287ca3e34b678e9f058f
|
|
|
77
77
|
pyobo/sources/drugbank/__init__.py,sha256=880b2dbd9419d3525c25e0089b606727ddb7501be2f1a490e2d1158440e8540a,178
|
|
78
78
|
pyobo/sources/drugbank/drugbank.py,sha256=5a216ccbfe883599207ad99b518904d6f3e983974bc2305fcf7715263228d705,10914
|
|
79
79
|
pyobo/sources/drugbank/drugbank_salt.py,sha256=69b565fe280b7a698cc3850b8b7fc8b5381f09aab7bb26e3aa7b13f5187b0b59,1646
|
|
80
|
-
pyobo/sources/drugcentral.py,sha256=
|
|
80
|
+
pyobo/sources/drugcentral.py,sha256=c481bfb0f79b6d5fbf4b5bd440bcceb8ba876bf44cfb300e7d9f28aabd5aa9b7,4052
|
|
81
81
|
pyobo/sources/expasy.py,sha256=25f116d229b5c25858db82add7a037e8c5b405e40dbfd76d3ff67a1f581c8755,11053
|
|
82
82
|
pyobo/sources/famplex.py,sha256=a82be3e9607feaeab64471d53c8686872aa47f5b9b23a5eb3bc0daf98b5af7a4,5628
|
|
83
83
|
pyobo/sources/flybase.py,sha256=8144b7f4d17fa9cef6dd1d9201b85062a3e0e943a2c0ac0f5e15d0d49c02ebc4,5666
|
|
@@ -95,7 +95,7 @@ pyobo/sources/gwascentral/gwascentral_study.py,sha256=7f30e246e594f38d3ce60725ce
|
|
|
95
95
|
pyobo/sources/hgnc/__init__.py,sha256=d5084cec674febf03108ccda073da4dd244b9034ce912da15213cc2c44d21963,157
|
|
96
96
|
pyobo/sources/hgnc/hgnc.py,sha256=7ac57bc377e25e6dac0f5ada71005f50a3bf0b82c1aff88ffe7072c04f38ced2,16699
|
|
97
97
|
pyobo/sources/hgnc/hgncgenefamily.py,sha256=e3e8d0b750d59a7da3d0ac2b100e248e8dad51af54c045405a12704e36db20cd,3710
|
|
98
|
-
pyobo/sources/iana_media_type.py,sha256=
|
|
98
|
+
pyobo/sources/iana_media_type.py,sha256=2ad63b4f5d7caf651fb8f1b5a93b79abf7a23e3b175b0ee21862105441c59e8e,5019
|
|
99
99
|
pyobo/sources/icd/__init__.py,sha256=0eb65597be8ff1eb2c278b6564f71ab8556b5d590821907ab09d1ce8a9ba4962,142
|
|
100
100
|
pyobo/sources/icd/icd10.py,sha256=61ab55ce0af6dbd27f59e25c6b8150007a96af1edcecde1f1db85bd5c4354de5,2587
|
|
101
101
|
pyobo/sources/icd/icd11.py,sha256=5b6e59f8028cfbd41f860151d1164514be2653a50078c0fc8748c20b815ee11b,4867
|
|
@@ -154,7 +154,7 @@ pyobo/sources/signor/__init__.py,sha256=6de6ff151aaca2a2d5317b437916405dff5783d5
|
|
|
154
154
|
pyobo/sources/signor/download.py,sha256=ae40c954403a95dd33e221b5e2d30e70072e4658d043d48024068b75ac5a833f,1053
|
|
155
155
|
pyobo/sources/signor/signor_complexes.py,sha256=04634cfe41b48eda51fa2eab0d2305e5729e0a59563b7e336762aae0532d064d,3802
|
|
156
156
|
pyobo/sources/slm.py,sha256=986242c3f131a541116d6b452e8f053763607d5844befdf79bae893db85c8f62,4246
|
|
157
|
-
pyobo/sources/spdx.py,sha256=
|
|
157
|
+
pyobo/sources/spdx.py,sha256=26354335498de8d73c6d3ff6fcea2a26978a9d9ceec0f99d504ca74e5fd80153,2530
|
|
158
158
|
pyobo/sources/umls/__init__.py,sha256=10d80d5d02a1cdef73cb1b178e49fbdfe05daa6767b4be19cb5a91e36183b4ff,141
|
|
159
159
|
pyobo/sources/umls/__main__.py,sha256=358e97a9eb60a5177f2cf9bde554d7d8bdeb241ffb877250b6d8270c9f5c1613,108
|
|
160
160
|
pyobo/sources/umls/get_synonym_types.py,sha256=fd5266a8217b628fca6bef678e579dba3251445bc0f474d0f6f6c92c80bd7bb2,1724
|
|
@@ -177,32 +177,32 @@ pyobo/struct/__init__.py,sha256=7efd602470a09f89f9820227baee10b9679b7a8422b2554e
|
|
|
177
177
|
pyobo/struct/functional/__init__.py,sha256=d536edb7fe86a1aad19607df3dea62b49dd0b4bb2b30f31b8431a842700a499e,32
|
|
178
178
|
pyobo/struct/functional/dsl.py,sha256=a1d0d7df79734a429c46372bb2d7ab68549cd34c0838f04726dc577bd73d4471,101591
|
|
179
179
|
pyobo/struct/functional/macros.py,sha256=cc654f131fa685d4afc87d8c7b5e8565da1b789dd5d73045a77b3e033a8ced52,13785
|
|
180
|
-
pyobo/struct/functional/obo_to_functional.py,sha256=
|
|
180
|
+
pyobo/struct/functional/obo_to_functional.py,sha256=71e8bc7d2c03dc7942cba56fadb6b78f585792420c63c9172deb902c308dd5cb,13493
|
|
181
181
|
pyobo/struct/functional/ontology.py,sha256=f9af23c7eeb536c23776008111834ff957acc00cbcc16c4b06500414c26e7322,9342
|
|
182
182
|
pyobo/struct/functional/utils.py,sha256=73e5c6d9227b0a162dcfb294dcad05f93ea870c8d87af7a2d16c6591f9249ad1,3487
|
|
183
183
|
pyobo/struct/obo/__init__.py,sha256=c49005278cae796050bf706bb53b871c9ec0ccea8280eb8780a638450a1cb16d,157
|
|
184
184
|
pyobo/struct/obo/reader.py,sha256=edef37b6592ddcd4dded06f3bd9ea9ffc5bbcd1cc11b247839923be078ff497e,50797
|
|
185
185
|
pyobo/struct/obo/reader_utils.py,sha256=5324154d08576e167d7c28b3660dbaa394e67878acf7ea9930abd0170201460a,4423
|
|
186
186
|
pyobo/struct/obograph/__init__.py,sha256=078acd3fd3824e73179bc629434adaaf5b309f8188c3d6f88100fe215baa1f2c,452
|
|
187
|
-
pyobo/struct/obograph/export.py,sha256=
|
|
187
|
+
pyobo/struct/obograph/export.py,sha256=ca4dcc1ee94333f48ca217f088575e07adbe5c627664d8115191a31a38b2a276,9945
|
|
188
188
|
pyobo/struct/obograph/reader.py,sha256=dbae3255e0fc6b78c6c7d11a194655c456d243fa7043fe9c915c3d4bcc2225f3,8525
|
|
189
189
|
pyobo/struct/obograph/utils.py,sha256=8ded244a40b6e0c53da56447ab5fcaf89e635a18d611263a348dd3a59aaf67f4,1516
|
|
190
190
|
pyobo/struct/reference.py,sha256=4fc7d3b665cd18c8dfbbb2b8b49de4bc30a8e101d14ff26bf5f88e9c562bc2d3,11735
|
|
191
|
-
pyobo/struct/struct.py,sha256=
|
|
192
|
-
pyobo/struct/struct_utils.py,sha256=
|
|
193
|
-
pyobo/struct/typedef.py,sha256=
|
|
191
|
+
pyobo/struct/struct.py,sha256=58fd6a184318b8bc7d44edb90f635e4277b83b454be8309996175fa86661af7f,93743
|
|
192
|
+
pyobo/struct/struct_utils.py,sha256=fc3ebcf5b3651a0d7fafee2f410fa299510ec73abde5706a045c6a14c574efb5,40346
|
|
193
|
+
pyobo/struct/typedef.py,sha256=88b9bcf83558d2ffdd2bf470a0d28278e17b9c8e9795a89e4b609a08778f4a52,13088
|
|
194
194
|
pyobo/struct/utils.py,sha256=ce4a4e138d894087e4374adce6a34434ad375482a691fff9eed1e88cc24aef56,906
|
|
195
195
|
pyobo/struct/vocabulary.py,sha256=2addf44eb64ab55f3ee06f87022c7112078f873c8436fc45d9a2ff7dfec9b53e,5243
|
|
196
196
|
pyobo/utils/__init__.py,sha256=08035263cbc6abfeaff2b5a159121d9e4f96a392c0d91f568e0d67a9b5aa2cec,17
|
|
197
197
|
pyobo/utils/cache.py,sha256=c7b0e7c3cbc762ca2c9575a257d2fd65d4eee59b9e211d648b935c7696fb1f5d,3136
|
|
198
198
|
pyobo/utils/io.py,sha256=413bc68cd0e46887fbf1371adb7079456fda57078a892b319a0c1229770c48da,3921
|
|
199
199
|
pyobo/utils/iter.py,sha256=ad845b6da1491f131a134c94fab419a026a0608aed7afd3db98d26c4591fe736,1524
|
|
200
|
-
pyobo/utils/misc.py,sha256=
|
|
200
|
+
pyobo/utils/misc.py,sha256=e3df697a77320ea5bdff19b41f40aad0584ec34328368abef485504ca87e79a1,7992
|
|
201
201
|
pyobo/utils/ndex_utils.py,sha256=128902592d345ab93fe32f2575e42e53269a0bac8dcc18370da81497e2767336,2326
|
|
202
202
|
pyobo/utils/path.py,sha256=129f254d15a0154f7f5c5e6fa895790771b83dc501825222b4c91a50dc63cefa,4091
|
|
203
|
-
pyobo/version.py,sha256=
|
|
204
|
-
pyobo-0.12.
|
|
205
|
-
pyobo-0.12.
|
|
206
|
-
pyobo-0.12.
|
|
207
|
-
pyobo-0.12.
|
|
208
|
-
pyobo-0.12.
|
|
203
|
+
pyobo/version.py,sha256=524be873cd1df560b36d00f90206d2db05da6d13b7332ae8ecae37d2fdbc49ac,926
|
|
204
|
+
pyobo-0.12.7.dist-info/licenses/LICENSE,sha256=41c80964a1b1956e41c013670812fc5592d5b51bd7b3cd4287d949450488a498,1076
|
|
205
|
+
pyobo-0.12.7.dist-info/WHEEL,sha256=ec89e25a684ec3ad8fb2a9be806e47666a27f7dcdcf9b55bff3f1d3ed5e60e0a,78
|
|
206
|
+
pyobo-0.12.7.dist-info/entry_points.txt,sha256=00d833beec05ffdff58a90a8c49b5b04ce80e22d8c92ddfd80c3f340eea1bc6b,42
|
|
207
|
+
pyobo-0.12.7.dist-info/METADATA,sha256=c0d2615e44897b0361e752bc2579a271dc2669d3b6987fb3b50e0399154cef9a,21834
|
|
208
|
+
pyobo-0.12.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|