pyobo 0.11.1__py3-none-any.whl → 0.12.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/.DS_Store +0 -0
- pyobo/__init__.py +95 -20
- pyobo/__main__.py +0 -0
- pyobo/api/__init__.py +81 -10
- pyobo/api/alts.py +52 -42
- pyobo/api/combine.py +39 -0
- pyobo/api/edges.py +68 -0
- pyobo/api/hierarchy.py +231 -203
- pyobo/api/metadata.py +14 -19
- pyobo/api/names.py +207 -127
- pyobo/api/properties.py +117 -113
- pyobo/api/relations.py +68 -94
- pyobo/api/species.py +24 -21
- pyobo/api/typedefs.py +11 -11
- pyobo/api/utils.py +66 -13
- pyobo/api/xrefs.py +108 -114
- pyobo/cli/__init__.py +0 -0
- pyobo/cli/cli.py +35 -50
- pyobo/cli/database.py +183 -161
- pyobo/{xrefdb/xrefs_pipeline.py → cli/database_utils.py} +54 -73
- pyobo/cli/lookup.py +163 -195
- pyobo/cli/utils.py +19 -6
- pyobo/constants.py +102 -3
- pyobo/getters.py +196 -118
- pyobo/gilda_utils.py +79 -200
- pyobo/identifier_utils/__init__.py +41 -0
- pyobo/identifier_utils/api.py +296 -0
- pyobo/identifier_utils/model.py +130 -0
- pyobo/identifier_utils/preprocessing.json +812 -0
- pyobo/identifier_utils/preprocessing.py +61 -0
- pyobo/identifier_utils/relations/__init__.py +8 -0
- pyobo/identifier_utils/relations/api.py +162 -0
- pyobo/identifier_utils/relations/data.json +5824 -0
- pyobo/identifier_utils/relations/data_owl.json +57 -0
- pyobo/identifier_utils/relations/data_rdf.json +1 -0
- pyobo/identifier_utils/relations/data_rdfs.json +7 -0
- pyobo/mocks.py +9 -6
- pyobo/ner/__init__.py +9 -0
- pyobo/ner/api.py +72 -0
- pyobo/ner/normalizer.py +33 -0
- pyobo/obographs.py +43 -39
- pyobo/plugins.py +5 -4
- pyobo/py.typed +0 -0
- pyobo/reader.py +1358 -395
- pyobo/reader_utils.py +155 -0
- pyobo/resource_utils.py +42 -22
- pyobo/resources/__init__.py +0 -0
- pyobo/resources/goc.py +75 -0
- pyobo/resources/goc.tsv +188 -0
- pyobo/resources/ncbitaxon.py +4 -5
- pyobo/resources/ncbitaxon.tsv.gz +0 -0
- pyobo/resources/ro.py +3 -2
- pyobo/resources/ro.tsv +0 -0
- pyobo/resources/so.py +0 -0
- pyobo/resources/so.tsv +0 -0
- pyobo/sources/README.md +12 -8
- pyobo/sources/__init__.py +52 -29
- pyobo/sources/agrovoc.py +0 -0
- pyobo/sources/antibodyregistry.py +11 -12
- pyobo/sources/bigg/__init__.py +13 -0
- pyobo/sources/bigg/bigg_compartment.py +81 -0
- pyobo/sources/bigg/bigg_metabolite.py +229 -0
- pyobo/sources/bigg/bigg_model.py +46 -0
- pyobo/sources/bigg/bigg_reaction.py +77 -0
- pyobo/sources/biogrid.py +1 -2
- pyobo/sources/ccle.py +7 -12
- pyobo/sources/cgnc.py +0 -5
- pyobo/sources/chebi.py +1 -1
- pyobo/sources/chembl/__init__.py +9 -0
- pyobo/sources/{chembl.py → chembl/chembl_compound.py} +13 -25
- pyobo/sources/chembl/chembl_target.py +160 -0
- pyobo/sources/civic_gene.py +55 -15
- pyobo/sources/clinicaltrials.py +160 -0
- pyobo/sources/complexportal.py +24 -24
- pyobo/sources/conso.py +14 -22
- pyobo/sources/cpt.py +0 -0
- pyobo/sources/credit.py +1 -9
- pyobo/sources/cvx.py +27 -5
- pyobo/sources/depmap.py +9 -12
- pyobo/sources/dictybase_gene.py +2 -7
- pyobo/sources/drugbank/__init__.py +9 -0
- pyobo/sources/{drugbank.py → drugbank/drugbank.py} +11 -16
- pyobo/sources/{drugbank_salt.py → drugbank/drugbank_salt.py} +3 -8
- pyobo/sources/drugcentral.py +17 -13
- pyobo/sources/expasy.py +31 -34
- pyobo/sources/famplex.py +13 -18
- pyobo/sources/flybase.py +3 -8
- pyobo/sources/gard.py +62 -0
- pyobo/sources/geonames/__init__.py +9 -0
- pyobo/sources/geonames/features.py +28 -0
- pyobo/sources/{geonames.py → geonames/geonames.py} +87 -26
- pyobo/sources/geonames/utils.py +115 -0
- pyobo/sources/gmt_utils.py +6 -7
- pyobo/sources/go.py +20 -13
- pyobo/sources/gtdb.py +154 -0
- pyobo/sources/gwascentral/__init__.py +9 -0
- pyobo/sources/{gwascentral_phenotype.py → gwascentral/gwascentral_phenotype.py} +5 -7
- pyobo/sources/{gwascentral_study.py → gwascentral/gwascentral_study.py} +1 -7
- pyobo/sources/hgnc/__init__.py +9 -0
- pyobo/sources/{hgnc.py → hgnc/hgnc.py} +56 -70
- pyobo/sources/{hgncgenefamily.py → hgnc/hgncgenefamily.py} +8 -18
- pyobo/sources/icd/__init__.py +9 -0
- pyobo/sources/{icd10.py → icd/icd10.py} +35 -37
- pyobo/sources/icd/icd11.py +148 -0
- pyobo/sources/{icd_utils.py → icd/icd_utils.py} +66 -20
- pyobo/sources/interpro.py +4 -9
- pyobo/sources/itis.py +0 -5
- pyobo/sources/kegg/__init__.py +0 -0
- pyobo/sources/kegg/api.py +16 -38
- pyobo/sources/kegg/genes.py +9 -20
- pyobo/sources/kegg/genome.py +1 -7
- pyobo/sources/kegg/pathway.py +9 -21
- pyobo/sources/mesh.py +58 -24
- pyobo/sources/mgi.py +3 -10
- pyobo/sources/mirbase/__init__.py +11 -0
- pyobo/sources/{mirbase.py → mirbase/mirbase.py} +8 -11
- pyobo/sources/{mirbase_constants.py → mirbase/mirbase_constants.py} +0 -0
- pyobo/sources/{mirbase_family.py → mirbase/mirbase_family.py} +4 -8
- pyobo/sources/{mirbase_mature.py → mirbase/mirbase_mature.py} +3 -7
- pyobo/sources/msigdb.py +74 -39
- pyobo/sources/ncbi/__init__.py +9 -0
- pyobo/sources/ncbi/ncbi_gc.py +162 -0
- pyobo/sources/{ncbigene.py → ncbi/ncbigene.py} +18 -19
- pyobo/sources/nih_reporter.py +60 -0
- pyobo/sources/nlm/__init__.py +9 -0
- pyobo/sources/nlm/nlm_catalog.py +48 -0
- pyobo/sources/nlm/nlm_publisher.py +36 -0
- pyobo/sources/nlm/utils.py +116 -0
- pyobo/sources/npass.py +6 -8
- pyobo/sources/omim_ps.py +10 -3
- pyobo/sources/pathbank.py +4 -8
- pyobo/sources/pfam/__init__.py +9 -0
- pyobo/sources/{pfam.py → pfam/pfam.py} +3 -8
- pyobo/sources/{pfam_clan.py → pfam/pfam_clan.py} +2 -7
- pyobo/sources/pharmgkb/__init__.py +15 -0
- pyobo/sources/pharmgkb/pharmgkb_chemical.py +89 -0
- pyobo/sources/pharmgkb/pharmgkb_disease.py +77 -0
- pyobo/sources/pharmgkb/pharmgkb_gene.py +108 -0
- pyobo/sources/pharmgkb/pharmgkb_pathway.py +63 -0
- pyobo/sources/pharmgkb/pharmgkb_variant.py +84 -0
- pyobo/sources/pharmgkb/utils.py +86 -0
- pyobo/sources/pid.py +1 -6
- pyobo/sources/pombase.py +6 -10
- pyobo/sources/pubchem.py +4 -9
- pyobo/sources/reactome.py +5 -11
- pyobo/sources/rgd.py +11 -16
- pyobo/sources/rhea.py +37 -36
- pyobo/sources/ror.py +69 -42
- pyobo/sources/selventa/__init__.py +0 -0
- pyobo/sources/selventa/schem.py +4 -7
- pyobo/sources/selventa/scomp.py +1 -6
- pyobo/sources/selventa/sdis.py +4 -7
- pyobo/sources/selventa/sfam.py +1 -6
- pyobo/sources/sgd.py +6 -11
- pyobo/sources/signor/__init__.py +7 -0
- pyobo/sources/signor/download.py +41 -0
- pyobo/sources/signor/signor_complexes.py +105 -0
- pyobo/sources/slm.py +12 -15
- pyobo/sources/umls/__init__.py +7 -1
- pyobo/sources/umls/__main__.py +0 -0
- pyobo/sources/umls/get_synonym_types.py +20 -4
- pyobo/sources/umls/sty.py +57 -0
- pyobo/sources/umls/synonym_types.tsv +1 -1
- pyobo/sources/umls/umls.py +18 -22
- pyobo/sources/unimod.py +46 -0
- pyobo/sources/uniprot/__init__.py +1 -1
- pyobo/sources/uniprot/uniprot.py +40 -32
- pyobo/sources/uniprot/uniprot_ptm.py +4 -34
- pyobo/sources/utils.py +3 -2
- pyobo/sources/wikipathways.py +7 -10
- pyobo/sources/zfin.py +5 -10
- pyobo/ssg/__init__.py +12 -16
- pyobo/ssg/base.html +0 -0
- pyobo/ssg/index.html +26 -13
- pyobo/ssg/term.html +12 -2
- pyobo/ssg/typedef.html +0 -0
- pyobo/struct/__init__.py +54 -8
- pyobo/struct/functional/__init__.py +1 -0
- pyobo/struct/functional/dsl.py +2572 -0
- pyobo/struct/functional/macros.py +423 -0
- pyobo/struct/functional/obo_to_functional.py +385 -0
- pyobo/struct/functional/ontology.py +270 -0
- pyobo/struct/functional/utils.py +112 -0
- pyobo/struct/reference.py +331 -136
- pyobo/struct/struct.py +1413 -643
- pyobo/struct/struct_utils.py +1078 -0
- pyobo/struct/typedef.py +162 -210
- pyobo/struct/utils.py +12 -5
- pyobo/struct/vocabulary.py +138 -0
- pyobo/utils/__init__.py +0 -0
- pyobo/utils/cache.py +13 -11
- pyobo/utils/io.py +17 -31
- pyobo/utils/iter.py +5 -5
- pyobo/utils/misc.py +41 -53
- pyobo/utils/ndex_utils.py +0 -0
- pyobo/utils/path.py +76 -70
- pyobo/version.py +3 -3
- {pyobo-0.11.1.dist-info → pyobo-0.12.0.dist-info}/METADATA +224 -225
- pyobo-0.12.0.dist-info/RECORD +202 -0
- pyobo-0.12.0.dist-info/WHEEL +4 -0
- {pyobo-0.11.1.dist-info → pyobo-0.12.0.dist-info}/entry_points.txt +1 -0
- {pyobo-0.11.1.dist-info → pyobo-0.12.0.dist-info/licenses}/LICENSE +0 -0
- pyobo/apps/__init__.py +0 -3
- pyobo/apps/cli.py +0 -24
- pyobo/apps/gilda/__init__.py +0 -3
- pyobo/apps/gilda/__main__.py +0 -8
- pyobo/apps/gilda/app.py +0 -48
- pyobo/apps/gilda/cli.py +0 -36
- pyobo/apps/gilda/templates/base.html +0 -33
- pyobo/apps/gilda/templates/home.html +0 -11
- pyobo/apps/gilda/templates/matches.html +0 -32
- pyobo/apps/mapper/__init__.py +0 -3
- pyobo/apps/mapper/__main__.py +0 -11
- pyobo/apps/mapper/cli.py +0 -37
- pyobo/apps/mapper/mapper.py +0 -187
- pyobo/apps/mapper/templates/base.html +0 -35
- pyobo/apps/mapper/templates/mapper_home.html +0 -64
- pyobo/aws.py +0 -162
- pyobo/cli/aws.py +0 -47
- pyobo/identifier_utils.py +0 -142
- pyobo/normalizer.py +0 -232
- pyobo/registries/__init__.py +0 -16
- pyobo/registries/metaregistry.json +0 -507
- pyobo/registries/metaregistry.py +0 -135
- pyobo/sources/icd11.py +0 -105
- pyobo/xrefdb/__init__.py +0 -1
- pyobo/xrefdb/canonicalizer.py +0 -214
- pyobo/xrefdb/priority.py +0 -59
- pyobo/xrefdb/sources/__init__.py +0 -60
- pyobo/xrefdb/sources/biomappings.py +0 -36
- pyobo/xrefdb/sources/cbms2019.py +0 -91
- pyobo/xrefdb/sources/chembl.py +0 -83
- pyobo/xrefdb/sources/compath.py +0 -82
- pyobo/xrefdb/sources/famplex.py +0 -64
- pyobo/xrefdb/sources/gilda.py +0 -50
- pyobo/xrefdb/sources/intact.py +0 -113
- pyobo/xrefdb/sources/ncit.py +0 -133
- pyobo/xrefdb/sources/pubchem.py +0 -27
- pyobo/xrefdb/sources/wikidata.py +0 -116
- pyobo-0.11.1.dist-info/RECORD +0 -173
- pyobo-0.11.1.dist-info/WHEEL +0 -5
- pyobo-0.11.1.dist-info/top_level.txt +0 -1
pyobo/cli/database.py
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
"""CLI for PyOBO Database Generation."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
|
|
4
|
+
import warnings
|
|
5
|
+
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
import click
|
|
7
8
|
from more_click import verbose_option
|
|
8
9
|
from tqdm.contrib.logging import logging_redirect_tqdm
|
|
10
|
+
from typing_extensions import Unpack
|
|
9
11
|
from zenodo_client import update_zenodo
|
|
10
12
|
|
|
11
|
-
from .
|
|
13
|
+
from .database_utils import (
|
|
14
|
+
_iter_alts,
|
|
15
|
+
_iter_definitions,
|
|
16
|
+
_iter_edges,
|
|
17
|
+
_iter_mappings,
|
|
18
|
+
_iter_metadata,
|
|
19
|
+
_iter_names,
|
|
20
|
+
_iter_properties,
|
|
21
|
+
_iter_relations,
|
|
22
|
+
_iter_species,
|
|
23
|
+
_iter_synonyms,
|
|
24
|
+
_iter_typedefs,
|
|
25
|
+
_iter_xrefs,
|
|
26
|
+
)
|
|
27
|
+
from .utils import (
|
|
28
|
+
Clickable,
|
|
29
|
+
directory_option,
|
|
30
|
+
force_option,
|
|
31
|
+
force_process_option,
|
|
32
|
+
strict_option,
|
|
33
|
+
zenodo_option,
|
|
34
|
+
)
|
|
12
35
|
from ..constants import (
|
|
13
36
|
ALTS_DATA_RECORD,
|
|
14
37
|
DEFINITIONS_RECORD,
|
|
@@ -19,20 +42,9 @@ from ..constants import (
|
|
|
19
42
|
SPECIES_RECORD,
|
|
20
43
|
SYNONYMS_RECORD,
|
|
21
44
|
TYPEDEFS_RECORD,
|
|
45
|
+
DatabaseKwargs,
|
|
22
46
|
)
|
|
23
47
|
from ..getters import db_output_helper
|
|
24
|
-
from ..xrefdb.xrefs_pipeline import (
|
|
25
|
-
_iter_alts,
|
|
26
|
-
_iter_definitions,
|
|
27
|
-
_iter_metadata,
|
|
28
|
-
_iter_names,
|
|
29
|
-
_iter_properties,
|
|
30
|
-
_iter_relations,
|
|
31
|
-
_iter_species,
|
|
32
|
-
_iter_synonyms,
|
|
33
|
-
_iter_typedefs,
|
|
34
|
-
_iter_xrefs,
|
|
35
|
-
)
|
|
36
48
|
|
|
37
49
|
__all__ = [
|
|
38
50
|
"main",
|
|
@@ -44,14 +56,44 @@ def main():
|
|
|
44
56
|
"""Build the PyOBO Database."""
|
|
45
57
|
|
|
46
58
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
skip_pyobo_option = click.option(
|
|
60
|
+
"--skip-pyobo",
|
|
61
|
+
is_flag=True,
|
|
62
|
+
help="Skip prefixes whose ontologies are implemented as PyOBO sources",
|
|
63
|
+
)
|
|
64
|
+
skip_below_option = click.option(
|
|
65
|
+
"--skip-below", help="Skip prefixes lexically sorted below the given one"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def database_annotate(f: Clickable) -> Clickable:
|
|
70
|
+
"""Add appropriate decorators to database CLI functions."""
|
|
71
|
+
decorators = [
|
|
72
|
+
main.command(),
|
|
73
|
+
zenodo_option,
|
|
74
|
+
verbose_option,
|
|
75
|
+
directory_option,
|
|
76
|
+
force_option,
|
|
77
|
+
force_process_option,
|
|
78
|
+
strict_option,
|
|
79
|
+
skip_pyobo_option,
|
|
80
|
+
skip_below_option,
|
|
81
|
+
]
|
|
82
|
+
for decorator in decorators:
|
|
83
|
+
f = decorator(f)
|
|
84
|
+
return f
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _update_database_kwargs(kwargs: DatabaseKwargs) -> DatabaseKwargs:
|
|
88
|
+
updated_kwargs = dict(kwargs)
|
|
89
|
+
updated_kwargs.update(force=False, force_process=False)
|
|
90
|
+
# FIXME get typing right on next line
|
|
91
|
+
return updated_kwargs # type:ignore
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@database_annotate
|
|
53
95
|
@click.pass_context
|
|
54
|
-
def build(ctx: click.Context,
|
|
96
|
+
def build(ctx: click.Context, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
55
97
|
"""Build all databases."""
|
|
56
98
|
# if no_strict and zenodo:
|
|
57
99
|
# click.secho("Must be strict before uploading", fg="red")
|
|
@@ -59,103 +101,74 @@ def build(ctx: click.Context, directory: str, zenodo: bool, no_strict: bool, for
|
|
|
59
101
|
with logging_redirect_tqdm():
|
|
60
102
|
click.secho("Collecting metadata and building", fg="cyan", bold=True)
|
|
61
103
|
# note that this is the only one that needs a force=force
|
|
62
|
-
ctx.invoke(metadata,
|
|
104
|
+
ctx.invoke(metadata, **kwargs)
|
|
105
|
+
|
|
106
|
+
# After running once, we don't want to force or re-process.
|
|
107
|
+
# All the other arguments come along for the ride!
|
|
108
|
+
updated_kwargs = _update_database_kwargs(kwargs)
|
|
109
|
+
|
|
63
110
|
click.secho("Alternate Identifiers", fg="cyan", bold=True)
|
|
64
|
-
ctx.invoke(alts,
|
|
111
|
+
ctx.invoke(alts, **updated_kwargs)
|
|
65
112
|
click.secho("Synonyms", fg="cyan", bold=True)
|
|
66
|
-
ctx.invoke(synonyms,
|
|
67
|
-
click.secho("
|
|
68
|
-
ctx.invoke(
|
|
113
|
+
ctx.invoke(synonyms, **updated_kwargs)
|
|
114
|
+
click.secho("Mappings", fg="cyan", bold=True)
|
|
115
|
+
ctx.invoke(mappings, **updated_kwargs)
|
|
69
116
|
click.secho("Names", fg="cyan", bold=True)
|
|
70
|
-
ctx.invoke(names,
|
|
117
|
+
ctx.invoke(names, **updated_kwargs)
|
|
71
118
|
click.secho("Definitions", fg="cyan", bold=True)
|
|
72
|
-
ctx.invoke(definitions,
|
|
119
|
+
ctx.invoke(definitions, **updated_kwargs)
|
|
73
120
|
click.secho("Properties", fg="cyan", bold=True)
|
|
74
|
-
ctx.invoke(properties,
|
|
121
|
+
ctx.invoke(properties, **updated_kwargs)
|
|
75
122
|
click.secho("Relations", fg="cyan", bold=True)
|
|
76
|
-
ctx.invoke(relations,
|
|
123
|
+
ctx.invoke(relations, **updated_kwargs)
|
|
124
|
+
click.secho("Edges", fg="cyan", bold=True)
|
|
125
|
+
ctx.invoke(edges, **updated_kwargs)
|
|
77
126
|
click.secho("Typedefs", fg="cyan", bold=True)
|
|
78
|
-
ctx.invoke(typedefs,
|
|
127
|
+
ctx.invoke(typedefs, **updated_kwargs)
|
|
79
128
|
click.secho("Species", fg="cyan", bold=True)
|
|
80
|
-
ctx.invoke(species,
|
|
129
|
+
ctx.invoke(species, **updated_kwargs)
|
|
81
130
|
|
|
82
131
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@main.command()
|
|
88
|
-
@verbose_option
|
|
89
|
-
@directory_option
|
|
90
|
-
@force_option
|
|
91
|
-
@no_strict_option
|
|
92
|
-
@skip_below_option
|
|
93
|
-
@click.option("--skip-pyobo")
|
|
94
|
-
def metadata(
|
|
95
|
-
directory: str, no_strict: bool, force: bool, skip_below: Optional[str], skip_pyobo: bool
|
|
96
|
-
):
|
|
132
|
+
@database_annotate
|
|
133
|
+
def metadata(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
97
134
|
"""Make the prefix-metadata dump."""
|
|
135
|
+
it = _iter_metadata(**kwargs)
|
|
98
136
|
db_output_helper(
|
|
99
|
-
|
|
137
|
+
it,
|
|
100
138
|
"metadata",
|
|
101
139
|
("prefix", "version", "date", "deprecated"),
|
|
102
|
-
strict=not no_strict,
|
|
103
|
-
force=force,
|
|
104
|
-
directory=directory,
|
|
105
140
|
use_gzip=False,
|
|
106
|
-
|
|
107
|
-
skip_pyobo=skip_pyobo,
|
|
141
|
+
directory=directory,
|
|
108
142
|
)
|
|
143
|
+
if zenodo:
|
|
144
|
+
click.secho("No Zenodo record for metadata", fg="red")
|
|
109
145
|
|
|
110
146
|
|
|
111
|
-
@
|
|
112
|
-
|
|
113
|
-
@directory_option
|
|
114
|
-
@zenodo_option
|
|
115
|
-
@force_option
|
|
116
|
-
@no_strict_option
|
|
117
|
-
@skip_below_option
|
|
118
|
-
@skip_below_exclusive_option
|
|
119
|
-
def names(
|
|
120
|
-
directory: str,
|
|
121
|
-
zenodo: bool,
|
|
122
|
-
no_strict: bool,
|
|
123
|
-
force: bool,
|
|
124
|
-
skip_below: Optional[str],
|
|
125
|
-
skip_below_exclusive: bool,
|
|
126
|
-
):
|
|
147
|
+
@database_annotate
|
|
148
|
+
def names(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
127
149
|
"""Make the prefix-identifier-name dump."""
|
|
150
|
+
it = _iter_names(**kwargs)
|
|
128
151
|
with logging_redirect_tqdm():
|
|
129
152
|
paths = db_output_helper(
|
|
130
|
-
|
|
153
|
+
it,
|
|
131
154
|
"names",
|
|
132
155
|
("prefix", "identifier", "name"),
|
|
133
|
-
strict=not no_strict,
|
|
134
|
-
force=force,
|
|
135
156
|
directory=directory,
|
|
136
|
-
skip_below=skip_below,
|
|
137
|
-
skip_below_inclusive=not skip_below_exclusive,
|
|
138
157
|
)
|
|
139
158
|
if zenodo:
|
|
140
159
|
# see https://zenodo.org/record/4020486
|
|
141
160
|
update_zenodo(OOH_NA_NA_RECORD, paths)
|
|
142
161
|
|
|
143
162
|
|
|
144
|
-
@
|
|
145
|
-
|
|
146
|
-
@directory_option
|
|
147
|
-
@zenodo_option
|
|
148
|
-
@force_option
|
|
149
|
-
@no_strict_option
|
|
150
|
-
def species(directory: str, zenodo: bool, no_strict: bool, force: bool):
|
|
163
|
+
@database_annotate
|
|
164
|
+
def species(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
151
165
|
"""Make the prefix-identifier-species dump."""
|
|
152
166
|
with logging_redirect_tqdm():
|
|
167
|
+
it = _iter_species(**kwargs)
|
|
153
168
|
paths = db_output_helper(
|
|
154
|
-
|
|
169
|
+
it,
|
|
155
170
|
"species",
|
|
156
171
|
("prefix", "identifier", "species"),
|
|
157
|
-
strict=not no_strict,
|
|
158
|
-
force=force,
|
|
159
172
|
directory=directory,
|
|
160
173
|
)
|
|
161
174
|
if zenodo:
|
|
@@ -163,110 +176,90 @@ def species(directory: str, zenodo: bool, no_strict: bool, force: bool):
|
|
|
163
176
|
update_zenodo(SPECIES_RECORD, paths)
|
|
164
177
|
|
|
165
178
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
def _extend_skip_set(kwargs: DatabaseKwargs, skip_set: set[str]) -> None:
|
|
180
|
+
ss = kwargs.get("skip_set")
|
|
181
|
+
if ss is None:
|
|
182
|
+
kwargs["skip_set"] = skip_set
|
|
183
|
+
else:
|
|
184
|
+
ss.update(skip_set)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@database_annotate
|
|
188
|
+
def definitions(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
173
189
|
"""Make the prefix-identifier-definition dump."""
|
|
174
190
|
with logging_redirect_tqdm():
|
|
191
|
+
_extend_skip_set(kwargs, {"kegg.pathway", "kegg.genes", "kegg.genome", "umls"})
|
|
192
|
+
it = _iter_definitions(**kwargs)
|
|
175
193
|
paths = db_output_helper(
|
|
176
|
-
|
|
194
|
+
it,
|
|
177
195
|
"definitions",
|
|
178
196
|
("prefix", "identifier", "definition"),
|
|
179
|
-
strict=not no_strict,
|
|
180
|
-
force=force,
|
|
181
197
|
directory=directory,
|
|
182
|
-
skip_set={"kegg.pathway", "kegg.genes", "kegg.genome", "umls"},
|
|
183
198
|
)
|
|
184
199
|
if zenodo:
|
|
185
200
|
# see https://zenodo.org/record/4637061
|
|
186
201
|
update_zenodo(DEFINITIONS_RECORD, paths)
|
|
187
202
|
|
|
188
203
|
|
|
189
|
-
@
|
|
190
|
-
|
|
191
|
-
@directory_option
|
|
192
|
-
@zenodo_option
|
|
193
|
-
@force_option
|
|
194
|
-
@no_strict_option
|
|
195
|
-
def typedefs(directory: str, zenodo: bool, no_strict: bool, force: bool):
|
|
204
|
+
@database_annotate
|
|
205
|
+
def typedefs(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
196
206
|
"""Make the typedef prefix-identifier-name dump."""
|
|
197
207
|
with logging_redirect_tqdm():
|
|
208
|
+
_extend_skip_set(kwargs, {"ncbigene", "kegg.pathway", "kegg.genes", "kegg.genome"})
|
|
209
|
+
it = _iter_typedefs(**kwargs)
|
|
198
210
|
paths = db_output_helper(
|
|
199
|
-
|
|
211
|
+
it,
|
|
200
212
|
"typedefs",
|
|
201
213
|
("prefix", "typedef_prefix", "identifier", "name"),
|
|
202
|
-
strict=not no_strict,
|
|
203
|
-
force=force,
|
|
204
|
-
directory=directory,
|
|
205
214
|
use_gzip=False,
|
|
206
|
-
|
|
215
|
+
directory=directory,
|
|
207
216
|
)
|
|
208
217
|
if zenodo:
|
|
209
218
|
# see https://zenodo.org/record/4644013
|
|
210
219
|
update_zenodo(TYPEDEFS_RECORD, paths)
|
|
211
220
|
|
|
212
221
|
|
|
213
|
-
@
|
|
214
|
-
|
|
215
|
-
@directory_option
|
|
216
|
-
@zenodo_option
|
|
217
|
-
@force_option
|
|
218
|
-
@no_strict_option
|
|
219
|
-
def alts(directory: str, zenodo: bool, force: bool, no_strict: bool):
|
|
222
|
+
@database_annotate
|
|
223
|
+
def alts(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
220
224
|
"""Make the prefix-alt-id dump."""
|
|
221
225
|
with logging_redirect_tqdm():
|
|
226
|
+
_extend_skip_set(kwargs, {"kegg.pathway", "kegg.genes", "kegg.genome", "umls"})
|
|
227
|
+
it = _iter_alts(**kwargs)
|
|
222
228
|
paths = db_output_helper(
|
|
223
|
-
|
|
229
|
+
it,
|
|
224
230
|
"alts",
|
|
225
231
|
("prefix", "identifier", "alt"),
|
|
226
232
|
directory=directory,
|
|
227
|
-
force=force,
|
|
228
|
-
strict=not no_strict,
|
|
229
|
-
skip_set={"kegg.pathway", "kegg.genes", "kegg.genome", "umls"},
|
|
230
233
|
)
|
|
231
234
|
if zenodo:
|
|
232
235
|
# see https://zenodo.org/record/4021476
|
|
233
236
|
update_zenodo(ALTS_DATA_RECORD, paths)
|
|
234
237
|
|
|
235
238
|
|
|
236
|
-
@
|
|
237
|
-
|
|
238
|
-
@directory_option
|
|
239
|
-
@zenodo_option
|
|
240
|
-
@force_option
|
|
241
|
-
@no_strict_option
|
|
242
|
-
def synonyms(directory: str, zenodo: bool, force: bool, no_strict: bool):
|
|
239
|
+
@database_annotate
|
|
240
|
+
def synonyms(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
243
241
|
"""Make the prefix-identifier-synonym dump."""
|
|
244
242
|
with logging_redirect_tqdm():
|
|
243
|
+
_extend_skip_set(kwargs, {"kegg.pathway", "kegg.genes", "kegg.genome"})
|
|
244
|
+
it = _iter_synonyms(**kwargs)
|
|
245
245
|
paths = db_output_helper(
|
|
246
|
-
|
|
246
|
+
it,
|
|
247
247
|
"synonyms",
|
|
248
248
|
("prefix", "identifier", "synonym"),
|
|
249
249
|
directory=directory,
|
|
250
|
-
force=force,
|
|
251
|
-
strict=not no_strict,
|
|
252
|
-
skip_set={"kegg.pathway", "kegg.genes", "kegg.genome"},
|
|
253
250
|
)
|
|
254
251
|
if zenodo:
|
|
255
252
|
# see https://zenodo.org/record/4021482
|
|
256
253
|
update_zenodo(SYNONYMS_RECORD, paths)
|
|
257
254
|
|
|
258
255
|
|
|
259
|
-
@
|
|
260
|
-
|
|
261
|
-
@directory_option
|
|
262
|
-
@zenodo_option
|
|
263
|
-
@force_option
|
|
264
|
-
@no_strict_option
|
|
265
|
-
def relations(directory: str, zenodo: bool, force: bool, no_strict: bool):
|
|
256
|
+
@database_annotate
|
|
257
|
+
def relations(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
266
258
|
"""Make the relation dump."""
|
|
267
259
|
with logging_redirect_tqdm():
|
|
260
|
+
it = _iter_relations(**kwargs)
|
|
268
261
|
paths = db_output_helper(
|
|
269
|
-
|
|
262
|
+
it,
|
|
270
263
|
"relations",
|
|
271
264
|
(
|
|
272
265
|
"source_prefix",
|
|
@@ -276,62 +269,91 @@ def relations(directory: str, zenodo: bool, force: bool, no_strict: bool):
|
|
|
276
269
|
"target_prefix",
|
|
277
270
|
"target_identifier",
|
|
278
271
|
),
|
|
279
|
-
directory=directory,
|
|
280
|
-
force=force,
|
|
281
|
-
strict=not no_strict,
|
|
282
272
|
summary_detailed=(0, 2, 3), # second column corresponds to relation type
|
|
273
|
+
directory=directory,
|
|
283
274
|
)
|
|
284
275
|
if zenodo:
|
|
285
276
|
# see https://zenodo.org/record/4625167
|
|
286
277
|
update_zenodo(RELATIONS_RECORD, paths)
|
|
287
278
|
|
|
288
279
|
|
|
289
|
-
@
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
280
|
+
@database_annotate
|
|
281
|
+
def edges(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
282
|
+
"""Make the edges dump."""
|
|
283
|
+
with logging_redirect_tqdm():
|
|
284
|
+
it = _iter_edges(**kwargs)
|
|
285
|
+
db_output_helper(
|
|
286
|
+
it,
|
|
287
|
+
"edges",
|
|
288
|
+
(
|
|
289
|
+
":START_ID",
|
|
290
|
+
":TYPE",
|
|
291
|
+
":END_ID",
|
|
292
|
+
"provenance",
|
|
293
|
+
),
|
|
294
|
+
directory=directory,
|
|
295
|
+
)
|
|
296
|
+
if zenodo:
|
|
297
|
+
raise NotImplementedError
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
@database_annotate
|
|
301
|
+
def properties(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
296
302
|
"""Make the properties dump."""
|
|
297
303
|
with logging_redirect_tqdm():
|
|
304
|
+
it = _iter_properties(**kwargs)
|
|
298
305
|
paths = db_output_helper(
|
|
299
|
-
|
|
306
|
+
it,
|
|
300
307
|
"properties",
|
|
301
308
|
("prefix", "identifier", "property", "value"),
|
|
302
|
-
directory=directory,
|
|
303
|
-
force=force,
|
|
304
|
-
strict=not no_strict,
|
|
305
309
|
summary_detailed=(0, 2), # second column corresponds to property type
|
|
310
|
+
directory=directory,
|
|
306
311
|
)
|
|
307
312
|
if zenodo:
|
|
308
313
|
# see https://zenodo.org/record/4625172
|
|
309
314
|
update_zenodo(PROPERTIES_RECORD, paths)
|
|
310
315
|
|
|
311
316
|
|
|
312
|
-
@
|
|
313
|
-
|
|
314
|
-
@directory_option
|
|
315
|
-
@zenodo_option
|
|
316
|
-
@force_option
|
|
317
|
-
@no_strict_option
|
|
318
|
-
def xrefs(directory: str, zenodo: bool, force: bool, no_strict: bool):
|
|
317
|
+
@database_annotate
|
|
318
|
+
def xrefs(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
319
319
|
"""Make the prefix-identifier-xref dump."""
|
|
320
|
+
warnings.warn("Use pyobo.database.mappings instead", DeprecationWarning, stacklevel=2)
|
|
320
321
|
with logging_redirect_tqdm():
|
|
322
|
+
it = _iter_xrefs(**kwargs)
|
|
321
323
|
paths = db_output_helper(
|
|
322
|
-
|
|
324
|
+
it,
|
|
323
325
|
"xrefs",
|
|
324
326
|
("prefix", "identifier", "xref_prefix", "xref_identifier", "provenance"),
|
|
325
|
-
directory=directory,
|
|
326
|
-
force=force,
|
|
327
|
-
strict=not no_strict,
|
|
328
327
|
summary_detailed=(0, 2), # second column corresponds to xref prefix
|
|
328
|
+
directory=directory,
|
|
329
329
|
)
|
|
330
330
|
if zenodo:
|
|
331
331
|
# see https://zenodo.org/record/4021477
|
|
332
332
|
update_zenodo(JAVERT_RECORD, paths)
|
|
333
333
|
|
|
334
334
|
|
|
335
|
+
@database_annotate
|
|
336
|
+
def mappings(zenodo: bool, directory: Path, **kwargs: Unpack[DatabaseKwargs]) -> None:
|
|
337
|
+
"""Make the SSSOM dump."""
|
|
338
|
+
columns = [
|
|
339
|
+
"subject_id",
|
|
340
|
+
"object_id",
|
|
341
|
+
"predicate_id",
|
|
342
|
+
"mapping_justification",
|
|
343
|
+
"mapping_source",
|
|
344
|
+
]
|
|
345
|
+
with logging_redirect_tqdm():
|
|
346
|
+
it = _iter_mappings(**kwargs)
|
|
347
|
+
db_output_helper(
|
|
348
|
+
it,
|
|
349
|
+
"mappings",
|
|
350
|
+
columns,
|
|
351
|
+
directory=directory,
|
|
352
|
+
)
|
|
353
|
+
if zenodo:
|
|
354
|
+
raise NotImplementedError("need to do initial manual upload of SSSOM build")
|
|
355
|
+
|
|
356
|
+
|
|
335
357
|
if __name__ == "__main__":
|
|
336
358
|
logging.captureWarnings(True)
|
|
337
359
|
with logging_redirect_tqdm():
|