pyobo 0.11.0__tar.gz → 0.11.2__tar.gz
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-0.11.0/src/pyobo.egg-info → pyobo-0.11.2}/PKG-INFO +31 -43
- {pyobo-0.11.0 → pyobo-0.11.2}/README.md +27 -39
- {pyobo-0.11.0 → pyobo-0.11.2}/pyproject.toml +11 -4
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/constants.py +1 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/gilda_utils.py +14 -11
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/obographs.py +5 -2
- pyobo-0.11.2/src/pyobo/resources/so.py +55 -0
- pyobo-0.11.2/src/pyobo/resources/so.tsv +2604 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/complexportal.py +54 -15
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/dictybase_gene.py +14 -9
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/drugcentral.py +4 -1
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/expasy.py +22 -4
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/flybase.py +3 -2
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/hgnc.py +24 -19
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/hgncgenefamily.py +7 -7
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/kegg/genome.py +18 -6
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mirbase.py +9 -3
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/npass.py +1 -1
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pathbank.py +32 -23
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pombase.py +6 -3
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/reactome.py +28 -7
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/rgd.py +1 -1
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/slm.py +28 -14
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/uniprot/uniprot.py +7 -6
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/zfin.py +18 -6
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/struct/reference.py +9 -8
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/struct/struct.py +30 -20
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/struct/typedef.py +5 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/version.py +1 -1
- {pyobo-0.11.0 → pyobo-0.11.2/src/pyobo.egg-info}/PKG-INFO +31 -43
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo.egg-info/SOURCES.txt +2 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo.egg-info/requires.txt +3 -2
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_utils.py +22 -2
- {pyobo-0.11.0 → pyobo-0.11.2}/LICENSE +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/MANIFEST.in +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/setup.cfg +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/__main__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/alts.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/hierarchy.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/metadata.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/names.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/properties.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/relations.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/species.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/typedefs.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/api/xrefs.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/aws.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/aws.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/cli.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/database.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/lookup.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/cli/utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/getters.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/identifier_utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/mocks.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/normalizer.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/plugins.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/py.typed +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/reader.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/registries/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/registries/metaregistry.json +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/registries/metaregistry.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resource_utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resources/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resources/ncbitaxon.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resources/ncbitaxon.tsv.gz +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resources/ro.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/resources/ro.tsv +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/README.md +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/agrovoc.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/antibodyregistry.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/biogrid.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/ccle.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/cgnc.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/chebi.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/chembl.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/civic_gene.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/conso.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/cpt.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/credit.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/cvx.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/depmap.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/drugbank.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/drugbank_salt.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/famplex.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/geonames.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/gmt_utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/go.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/gwascentral_phenotype.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/gwascentral_study.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/icd10.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/icd11.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/icd_utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/interpro.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/itis.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/kegg/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/kegg/api.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/kegg/genes.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/kegg/pathway.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mesh.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mgi.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mirbase_constants.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mirbase_family.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/mirbase_mature.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/msigdb.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/ncbigene.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/omim_ps.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pfam.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pfam_clan.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pid.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/pubchem.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/rhea.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/ror.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/selventa/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/selventa/schem.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/selventa/scomp.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/selventa/sdis.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/selventa/sfam.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/sgd.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/umls/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/umls/__main__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/umls/get_synonym_types.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/umls/synonym_types.tsv +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/umls/umls.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/uniprot/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/uniprot/uniprot_ptm.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/sources/wikipathways.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/ssg/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/ssg/base.html +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/ssg/index.html +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/ssg/term.html +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/ssg/typedef.html +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/struct/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/struct/utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/cache.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/io.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/iter.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/misc.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/ndex_utils.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/utils/path.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/canonicalizer.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/priority.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/biomappings.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/cbms2019.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/chembl.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/compath.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/famplex.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/gilda.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/intact.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/ncit.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/pubchem.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/sources/wikidata.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo/xrefdb/xrefs_pipeline.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo.egg-info/dependency_links.txt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo.egg-info/entry_points.txt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/src/pyobo.egg-info/top_level.txt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/constants.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/resources/citations.txt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/resources/test_chebi.obo +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/resources/test_msigdb.gmt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/resources/test_wikipathways.gmt +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_alt_ids.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_caches.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_extract.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_get.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_gmt.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_ground.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_mapper.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_sources/__init__.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_sources/test_famplex.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_sources/test_meta.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_struct.py +0 -0
- {pyobo-0.11.0 → pyobo-0.11.2}/tests/test_version_pins.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyobo
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: A python package for handling and generating OBO
|
|
5
5
|
Author-email: Charles Tapley Hoyt <cthoyt@gmail.com>
|
|
6
6
|
Maintainer-email: Charles Tapley Hoyt <cthoyt@gmail.com>
|
|
@@ -49,7 +49,6 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
49
49
|
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
50
50
|
Requires-Python: >=3.9
|
|
51
51
|
Description-Content-Type: text/markdown
|
|
52
|
-
License-File: LICENSE
|
|
53
52
|
Requires-Dist: obonet>=0.3.0
|
|
54
53
|
Requires-Dist: click
|
|
55
54
|
Requires-Dist: tqdm
|
|
@@ -63,13 +62,14 @@ Requires-Dist: humanize
|
|
|
63
62
|
Requires-Dist: tabulate
|
|
64
63
|
Requires-Dist: cachier
|
|
65
64
|
Requires-Dist: pystow>=0.2.7
|
|
66
|
-
Requires-Dist: bioversions>=0.5.
|
|
67
|
-
Requires-Dist: bioregistry>=0.
|
|
65
|
+
Requires-Dist: bioversions>=0.5.535
|
|
66
|
+
Requires-Dist: bioregistry>=0.11.23
|
|
68
67
|
Requires-Dist: bioontologies>=0.4.0
|
|
69
68
|
Requires-Dist: zenodo-client>=0.0.5
|
|
70
69
|
Requires-Dist: class_resolver
|
|
71
70
|
Requires-Dist: psycopg2-binary
|
|
72
71
|
Requires-Dist: pydantic>=2.0
|
|
72
|
+
Requires-Dist: requests-ftp
|
|
73
73
|
Requires-Dist: drugbank_downloader
|
|
74
74
|
Requires-Dist: chembl_downloader
|
|
75
75
|
Requires-Dist: umls_downloader>=0.1.3
|
|
@@ -109,10 +109,12 @@ Requires-Dist: sphinx_automodapi; extra == "docs"
|
|
|
109
109
|
<img src="https://codecov.io/gh/biopragmatics/pyobo/branch/main/graph/badge.svg" alt="Codecov status" /></a>
|
|
110
110
|
<a href="https://github.com/cthoyt/cookiecutter-python-package">
|
|
111
111
|
<img alt="Cookiecutter template from @cthoyt" src="https://img.shields.io/badge/Cookiecutter-snekpack-blue" /></a>
|
|
112
|
-
<a href=
|
|
113
|
-
<img src=
|
|
112
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
113
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" style="max-width:100%;"></a>
|
|
114
114
|
<a href="https://github.com/biopragmatics/pyobo/blob/main/.github/CODE_OF_CONDUCT.md">
|
|
115
115
|
<img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant"/></a>
|
|
116
|
+
<a href="https://doi.org/10.5281/zenodo.3381961">
|
|
117
|
+
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.3381961.svg" alt="DOI"></a>
|
|
116
118
|
</p>
|
|
117
119
|
|
|
118
120
|
Tools for biological identifiers, names, synonyms, xrefs, hierarchies, relations, and properties through the
|
|
@@ -500,14 +502,14 @@ and make update to the `url` entry for that namespace in the Bioregistry.
|
|
|
500
502
|
The most recent release can be installed from
|
|
501
503
|
[PyPI](https://pypi.org/project/pyobo/) with:
|
|
502
504
|
|
|
503
|
-
```
|
|
504
|
-
pip install pyobo
|
|
505
|
+
```console
|
|
506
|
+
python3 -m pip install pyobo
|
|
505
507
|
```
|
|
506
508
|
|
|
507
509
|
The most recent code and data can be installed directly from GitHub with:
|
|
508
510
|
|
|
509
|
-
```
|
|
510
|
-
pip install git+https://github.com/biopragmatics/pyobo.git
|
|
511
|
+
```console
|
|
512
|
+
python3 -m pip install git+https://github.com/biopragmatics/pyobo.git
|
|
511
513
|
```
|
|
512
514
|
|
|
513
515
|
## 👐 Contributing
|
|
@@ -564,10 +566,10 @@ The final section of the README is for if you want to get involved by making a c
|
|
|
564
566
|
|
|
565
567
|
To install in development mode, use the following:
|
|
566
568
|
|
|
567
|
-
```
|
|
569
|
+
```console
|
|
568
570
|
git clone git+https://github.com/biopragmatics/pyobo.git
|
|
569
571
|
cd pyobo
|
|
570
|
-
pip install -e .
|
|
572
|
+
python3 -m pip install -e .
|
|
571
573
|
```
|
|
572
574
|
|
|
573
575
|
### Updating Package Boilerplate
|
|
@@ -576,8 +578,8 @@ This project uses `cruft` to keep boilerplate (i.e., configuration, contribution
|
|
|
576
578
|
configuration)
|
|
577
579
|
up-to-date with the upstream cookiecutter package. Update with the following:
|
|
578
580
|
|
|
579
|
-
```
|
|
580
|
-
pip install cruft
|
|
581
|
+
```console
|
|
582
|
+
python3 -m pip install cruft
|
|
581
583
|
cruft update
|
|
582
584
|
```
|
|
583
585
|
|
|
@@ -586,10 +588,11 @@ available [here](https://github.com/cruft/cruft?tab=readme-ov-file#updating-a-pr
|
|
|
586
588
|
|
|
587
589
|
### 🥼 Testing
|
|
588
590
|
|
|
589
|
-
After cloning the repository and installing `tox` with
|
|
591
|
+
After cloning the repository and installing `tox` with
|
|
592
|
+
`python3 -m pip install tox tox-uv`,
|
|
590
593
|
the unit tests in the `tests/` folder can be run reproducibly with:
|
|
591
594
|
|
|
592
|
-
```
|
|
595
|
+
```console
|
|
593
596
|
tox -e py
|
|
594
597
|
```
|
|
595
598
|
|
|
@@ -600,12 +603,12 @@ Additionally, these tests are automatically re-run with each commit in a
|
|
|
600
603
|
|
|
601
604
|
The documentation can be built locally using the following:
|
|
602
605
|
|
|
603
|
-
```
|
|
606
|
+
```console
|
|
604
607
|
git clone git+https://github.com/biopragmatics/pyobo.git
|
|
605
608
|
cd pyobo
|
|
606
609
|
tox -e docs
|
|
607
610
|
open docs/build/html/index.html
|
|
608
|
-
```
|
|
611
|
+
```
|
|
609
612
|
|
|
610
613
|
The documentation automatically installs the package as well as the `docs`
|
|
611
614
|
extra specified in the [`pyproject.toml`](../../Desktop/pyobo/pyproject.toml). `sphinx` plugins
|
|
@@ -661,38 +664,23 @@ You only have to do the following steps once.
|
|
|
661
664
|
|
|
662
665
|
#### Configuring your machine's connection to PyPI
|
|
663
666
|
|
|
664
|
-
You have to do the following steps once per machine.
|
|
665
|
-
`.pypirc` and include the following:
|
|
666
|
-
|
|
667
|
-
```ini
|
|
668
|
-
[distutils]
|
|
669
|
-
index-servers =
|
|
670
|
-
pypi
|
|
671
|
-
testpypi
|
|
672
|
-
|
|
673
|
-
[pypi]
|
|
674
|
-
username = __token__
|
|
675
|
-
password = <the API token you just got>
|
|
667
|
+
You have to do the following steps once per machine.
|
|
676
668
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
password = <an API token from test PyPI>
|
|
669
|
+
```console
|
|
670
|
+
$ uv tool install keyring
|
|
671
|
+
$ keyring set https://upload.pypi.org/legacy/ __token__
|
|
672
|
+
$ keyring set https://test.pypi.org/legacy/ __token__
|
|
682
673
|
```
|
|
683
674
|
|
|
684
|
-
Note that
|
|
685
|
-
If you already have a `.pypirc` file with a `[distutils]` section, just make sure that there is an `index-servers`
|
|
686
|
-
key and that `pypi` is in its associated list. More information on configuring the `.pypirc` file can
|
|
687
|
-
be found [here](https://packaging.python.org/en/latest/specifications/pypirc).
|
|
675
|
+
Note that this deprecates previous workflows using `.pypirc`.
|
|
688
676
|
|
|
689
677
|
#### Uploading to PyPI
|
|
690
678
|
|
|
691
679
|
After installing the package in development mode and installing
|
|
692
|
-
`tox` with `pip install tox tox-uv`,
|
|
693
|
-
run the following from the
|
|
680
|
+
`tox` with `python3 -m pip install tox tox-uv`,
|
|
681
|
+
run the following from the console:
|
|
694
682
|
|
|
695
|
-
```
|
|
683
|
+
```console
|
|
696
684
|
tox -e finish
|
|
697
685
|
```
|
|
698
686
|
|
|
@@ -703,7 +691,7 @@ This script does the following:
|
|
|
703
691
|
and [`docs/source/conf.py`](../../Desktop/pyobo/docs/source/conf.py) to not have the `-dev` suffix
|
|
704
692
|
2. Packages the code in both a tar archive and a wheel using
|
|
705
693
|
[`uv build`](https://docs.astral.sh/uv/guides/publish/#building-your-package)
|
|
706
|
-
3. Uploads to PyPI using [`
|
|
694
|
+
3. Uploads to PyPI using [`uv publish`](https://docs.astral.sh/uv/guides/publish/#publishing-your-package).
|
|
707
695
|
4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped.
|
|
708
696
|
5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can
|
|
709
697
|
use `tox -e bumpversion -- minor` after.
|
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
<img src="https://codecov.io/gh/biopragmatics/pyobo/branch/main/graph/badge.svg" alt="Codecov status" /></a>
|
|
24
24
|
<a href="https://github.com/cthoyt/cookiecutter-python-package">
|
|
25
25
|
<img alt="Cookiecutter template from @cthoyt" src="https://img.shields.io/badge/Cookiecutter-snekpack-blue" /></a>
|
|
26
|
-
<a href=
|
|
27
|
-
<img src=
|
|
26
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
27
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" style="max-width:100%;"></a>
|
|
28
28
|
<a href="https://github.com/biopragmatics/pyobo/blob/main/.github/CODE_OF_CONDUCT.md">
|
|
29
29
|
<img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant"/></a>
|
|
30
|
+
<a href="https://doi.org/10.5281/zenodo.3381961">
|
|
31
|
+
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.3381961.svg" alt="DOI"></a>
|
|
30
32
|
</p>
|
|
31
33
|
|
|
32
34
|
Tools for biological identifiers, names, synonyms, xrefs, hierarchies, relations, and properties through the
|
|
@@ -414,14 +416,14 @@ and make update to the `url` entry for that namespace in the Bioregistry.
|
|
|
414
416
|
The most recent release can be installed from
|
|
415
417
|
[PyPI](https://pypi.org/project/pyobo/) with:
|
|
416
418
|
|
|
417
|
-
```
|
|
418
|
-
pip install pyobo
|
|
419
|
+
```console
|
|
420
|
+
python3 -m pip install pyobo
|
|
419
421
|
```
|
|
420
422
|
|
|
421
423
|
The most recent code and data can be installed directly from GitHub with:
|
|
422
424
|
|
|
423
|
-
```
|
|
424
|
-
pip install git+https://github.com/biopragmatics/pyobo.git
|
|
425
|
+
```console
|
|
426
|
+
python3 -m pip install git+https://github.com/biopragmatics/pyobo.git
|
|
425
427
|
```
|
|
426
428
|
|
|
427
429
|
## 👐 Contributing
|
|
@@ -478,10 +480,10 @@ The final section of the README is for if you want to get involved by making a c
|
|
|
478
480
|
|
|
479
481
|
To install in development mode, use the following:
|
|
480
482
|
|
|
481
|
-
```
|
|
483
|
+
```console
|
|
482
484
|
git clone git+https://github.com/biopragmatics/pyobo.git
|
|
483
485
|
cd pyobo
|
|
484
|
-
pip install -e .
|
|
486
|
+
python3 -m pip install -e .
|
|
485
487
|
```
|
|
486
488
|
|
|
487
489
|
### Updating Package Boilerplate
|
|
@@ -490,8 +492,8 @@ This project uses `cruft` to keep boilerplate (i.e., configuration, contribution
|
|
|
490
492
|
configuration)
|
|
491
493
|
up-to-date with the upstream cookiecutter package. Update with the following:
|
|
492
494
|
|
|
493
|
-
```
|
|
494
|
-
pip install cruft
|
|
495
|
+
```console
|
|
496
|
+
python3 -m pip install cruft
|
|
495
497
|
cruft update
|
|
496
498
|
```
|
|
497
499
|
|
|
@@ -500,10 +502,11 @@ available [here](https://github.com/cruft/cruft?tab=readme-ov-file#updating-a-pr
|
|
|
500
502
|
|
|
501
503
|
### 🥼 Testing
|
|
502
504
|
|
|
503
|
-
After cloning the repository and installing `tox` with
|
|
505
|
+
After cloning the repository and installing `tox` with
|
|
506
|
+
`python3 -m pip install tox tox-uv`,
|
|
504
507
|
the unit tests in the `tests/` folder can be run reproducibly with:
|
|
505
508
|
|
|
506
|
-
```
|
|
509
|
+
```console
|
|
507
510
|
tox -e py
|
|
508
511
|
```
|
|
509
512
|
|
|
@@ -514,12 +517,12 @@ Additionally, these tests are automatically re-run with each commit in a
|
|
|
514
517
|
|
|
515
518
|
The documentation can be built locally using the following:
|
|
516
519
|
|
|
517
|
-
```
|
|
520
|
+
```console
|
|
518
521
|
git clone git+https://github.com/biopragmatics/pyobo.git
|
|
519
522
|
cd pyobo
|
|
520
523
|
tox -e docs
|
|
521
524
|
open docs/build/html/index.html
|
|
522
|
-
```
|
|
525
|
+
```
|
|
523
526
|
|
|
524
527
|
The documentation automatically installs the package as well as the `docs`
|
|
525
528
|
extra specified in the [`pyproject.toml`](../../Desktop/pyobo/pyproject.toml). `sphinx` plugins
|
|
@@ -575,38 +578,23 @@ You only have to do the following steps once.
|
|
|
575
578
|
|
|
576
579
|
#### Configuring your machine's connection to PyPI
|
|
577
580
|
|
|
578
|
-
You have to do the following steps once per machine.
|
|
579
|
-
`.pypirc` and include the following:
|
|
580
|
-
|
|
581
|
-
```ini
|
|
582
|
-
[distutils]
|
|
583
|
-
index-servers =
|
|
584
|
-
pypi
|
|
585
|
-
testpypi
|
|
586
|
-
|
|
587
|
-
[pypi]
|
|
588
|
-
username = __token__
|
|
589
|
-
password = <the API token you just got>
|
|
581
|
+
You have to do the following steps once per machine.
|
|
590
582
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
password = <an API token from test PyPI>
|
|
583
|
+
```console
|
|
584
|
+
$ uv tool install keyring
|
|
585
|
+
$ keyring set https://upload.pypi.org/legacy/ __token__
|
|
586
|
+
$ keyring set https://test.pypi.org/legacy/ __token__
|
|
596
587
|
```
|
|
597
588
|
|
|
598
|
-
Note that
|
|
599
|
-
If you already have a `.pypirc` file with a `[distutils]` section, just make sure that there is an `index-servers`
|
|
600
|
-
key and that `pypi` is in its associated list. More information on configuring the `.pypirc` file can
|
|
601
|
-
be found [here](https://packaging.python.org/en/latest/specifications/pypirc).
|
|
589
|
+
Note that this deprecates previous workflows using `.pypirc`.
|
|
602
590
|
|
|
603
591
|
#### Uploading to PyPI
|
|
604
592
|
|
|
605
593
|
After installing the package in development mode and installing
|
|
606
|
-
`tox` with `pip install tox tox-uv`,
|
|
607
|
-
run the following from the
|
|
594
|
+
`tox` with `python3 -m pip install tox tox-uv`,
|
|
595
|
+
run the following from the console:
|
|
608
596
|
|
|
609
|
-
```
|
|
597
|
+
```console
|
|
610
598
|
tox -e finish
|
|
611
599
|
```
|
|
612
600
|
|
|
@@ -617,7 +605,7 @@ This script does the following:
|
|
|
617
605
|
and [`docs/source/conf.py`](../../Desktop/pyobo/docs/source/conf.py) to not have the `-dev` suffix
|
|
618
606
|
2. Packages the code in both a tar archive and a wheel using
|
|
619
607
|
[`uv build`](https://docs.astral.sh/uv/guides/publish/#building-your-package)
|
|
620
|
-
3. Uploads to PyPI using [`
|
|
608
|
+
3. Uploads to PyPI using [`uv publish`](https://docs.astral.sh/uv/guides/publish/#publishing-your-package).
|
|
621
609
|
4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped.
|
|
622
610
|
5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can
|
|
623
611
|
use `tox -e bumpversion -- minor` after.
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "pyobo"
|
|
8
|
-
version = "0.11.
|
|
8
|
+
version = "0.11.2"
|
|
9
9
|
description = "A python package for handling and generating OBO"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
authors = [
|
|
@@ -68,13 +68,14 @@ dependencies = [
|
|
|
68
68
|
"tabulate",
|
|
69
69
|
"cachier",
|
|
70
70
|
"pystow>=0.2.7",
|
|
71
|
-
"bioversions>=0.5.
|
|
72
|
-
"bioregistry>=0.
|
|
71
|
+
"bioversions>=0.5.535",
|
|
72
|
+
"bioregistry>=0.11.23",
|
|
73
73
|
"bioontologies>=0.4.0",
|
|
74
74
|
"zenodo-client>=0.0.5",
|
|
75
75
|
"class_resolver",
|
|
76
76
|
"psycopg2-binary",
|
|
77
77
|
"pydantic>=2.0",
|
|
78
|
+
"requests-ftp",
|
|
78
79
|
# Resource Downloaders
|
|
79
80
|
"drugbank_downloader",
|
|
80
81
|
"chembl_downloader",
|
|
@@ -104,6 +105,12 @@ Documentation = "https://pyobo.readthedocs.io"
|
|
|
104
105
|
|
|
105
106
|
[tool.setuptools]
|
|
106
107
|
package-dir = { "" = "src" }
|
|
108
|
+
# This fix is here as a final tombstone before getting rid of setuptools and
|
|
109
|
+
# replacing with uv's build backend. It appears that the setuptools team hasn't
|
|
110
|
+
# prioritized fixing the fully breaking bug in metadata emission described in
|
|
111
|
+
# https://github.com/pypa/setuptools/issues/4759. Luckily, the license
|
|
112
|
+
# is inferred from the trove classifier for MIT license.
|
|
113
|
+
license-files = []
|
|
107
114
|
|
|
108
115
|
[tool.setuptools.packages.find]
|
|
109
116
|
# this implicitly sets `packages = ":find"`
|
|
@@ -243,7 +250,7 @@ known-first-party = [
|
|
|
243
250
|
docstring-code-format = true
|
|
244
251
|
|
|
245
252
|
[tool.bumpversion]
|
|
246
|
-
current_version = "0.11.
|
|
253
|
+
current_version = "0.11.2"
|
|
247
254
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:-(?P<release>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+(?P<build>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?"
|
|
248
255
|
serialize = [
|
|
249
256
|
"{major}.{minor}.{patch}-{release}+{build}",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""PyOBO's Gilda utilities."""
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import logging
|
|
4
6
|
from collections.abc import Iterable
|
|
5
7
|
from subprocess import CalledProcessError
|
|
6
|
-
from typing import Optional, Union
|
|
7
8
|
|
|
8
9
|
import bioregistry
|
|
9
10
|
import gilda.api
|
|
@@ -37,7 +38,7 @@ def iter_gilda_prediction_tuples(
|
|
|
37
38
|
prefix: str,
|
|
38
39
|
relation: str = "skos:exactMatch",
|
|
39
40
|
*,
|
|
40
|
-
grounder:
|
|
41
|
+
grounder: Grounder | None = None,
|
|
41
42
|
identifiers_are_names: bool = False,
|
|
42
43
|
strict: bool = False,
|
|
43
44
|
) -> Iterable[tuple[str, str, str, str, str, str, str, str, float]]:
|
|
@@ -90,11 +91,11 @@ def normalize_identifier(prefix: str, identifier: str) -> str:
|
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
def get_grounder(
|
|
93
|
-
prefixes:
|
|
94
|
+
prefixes: str | Iterable[str],
|
|
94
95
|
*,
|
|
95
|
-
unnamed:
|
|
96
|
-
grounder_cls:
|
|
97
|
-
versions:
|
|
96
|
+
unnamed: Iterable[str] | None = None,
|
|
97
|
+
grounder_cls: type[Grounder] | None = None,
|
|
98
|
+
versions: None | str | Iterable[str | None] | dict[str, str] = None,
|
|
98
99
|
strict: bool = True,
|
|
99
100
|
skip_obsolete: bool = False,
|
|
100
101
|
progress: bool = True,
|
|
@@ -109,6 +110,8 @@ def get_grounder(
|
|
|
109
110
|
versions = [None] * len(prefixes)
|
|
110
111
|
elif isinstance(versions, str):
|
|
111
112
|
versions = [versions]
|
|
113
|
+
elif isinstance(versions, dict):
|
|
114
|
+
versions = [versions.get(prefix) for prefix in prefixes]
|
|
112
115
|
else:
|
|
113
116
|
versions = list(versions)
|
|
114
117
|
if len(prefixes) != len(versions):
|
|
@@ -146,8 +149,8 @@ def _fast_term(
|
|
|
146
149
|
identifier: str,
|
|
147
150
|
name: str,
|
|
148
151
|
status: str,
|
|
149
|
-
organism:
|
|
150
|
-
) ->
|
|
152
|
+
organism: str | None = None,
|
|
153
|
+
) -> gilda.term.Term | None:
|
|
151
154
|
try:
|
|
152
155
|
term = gilda.term.Term(
|
|
153
156
|
norm_text=normalize(text),
|
|
@@ -168,7 +171,7 @@ def get_gilda_terms(
|
|
|
168
171
|
prefix: str,
|
|
169
172
|
*,
|
|
170
173
|
identifiers_are_names: bool = False,
|
|
171
|
-
version:
|
|
174
|
+
version: str | None = None,
|
|
172
175
|
strict: bool = True,
|
|
173
176
|
skip_obsolete: bool = False,
|
|
174
177
|
progress: bool = True,
|
|
@@ -250,7 +253,7 @@ def get_gilda_terms(
|
|
|
250
253
|
|
|
251
254
|
|
|
252
255
|
def get_gilda_term_subset(
|
|
253
|
-
source: str, ancestors:
|
|
256
|
+
source: str, ancestors: str | list[str], **kwargs
|
|
254
257
|
) -> Iterable[gilda.term.Term]:
|
|
255
258
|
"""Get a subset of terms."""
|
|
256
259
|
subset = {
|
|
@@ -263,7 +266,7 @@ def get_gilda_term_subset(
|
|
|
263
266
|
yield term
|
|
264
267
|
|
|
265
268
|
|
|
266
|
-
def _ensure_list(s:
|
|
269
|
+
def _ensure_list(s: str | list[str]) -> list[str]:
|
|
267
270
|
if isinstance(s, str):
|
|
268
271
|
return [s]
|
|
269
272
|
return s
|
|
@@ -17,6 +17,7 @@ from bioontologies.obograph import (
|
|
|
17
17
|
Xref,
|
|
18
18
|
)
|
|
19
19
|
from bioontologies.robot import ParseResults
|
|
20
|
+
from tqdm import tqdm
|
|
20
21
|
|
|
21
22
|
from pyobo.struct import Obo, Reference, Term
|
|
22
23
|
from pyobo.struct.typedef import definition_source, is_a
|
|
@@ -33,11 +34,13 @@ def parse_results_from_obo(obo: Obo) -> ParseResults:
|
|
|
33
34
|
return ParseResults(graph_document=GraphDocument(graphs=[graph]))
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
def graph_from_obo(obo: Obo) -> Graph:
|
|
37
|
+
def graph_from_obo(obo: Obo, use_tqdm: bool = True) -> Graph:
|
|
37
38
|
"""Get an OBO Graph object from a PyOBO object."""
|
|
38
39
|
nodes: list[Node] = []
|
|
39
40
|
edges: list[Edge] = []
|
|
40
|
-
for term in
|
|
41
|
+
for term in tqdm(
|
|
42
|
+
obo, disable=not use_tqdm, unit="term", unit_scale=True, desc=f"[{obo.ontology}] to JSON"
|
|
43
|
+
):
|
|
41
44
|
nodes.append(_get_class_node(term))
|
|
42
45
|
edges.extend(_iter_edges(term))
|
|
43
46
|
return Graph(
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Loading of the relations ontology names."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
import os
|
|
7
|
+
from functools import lru_cache
|
|
8
|
+
|
|
9
|
+
import requests
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"get_so_name",
|
|
13
|
+
"load_so",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
17
|
+
SO_PATH = os.path.join(HERE, "so.tsv")
|
|
18
|
+
SO_JSON_URL = "https://github.com/The-Sequence-Ontology/SO-Ontologies/raw/refs/heads/master/Ontology_Files/so-simple.json"
|
|
19
|
+
SO_URI_PREFIX = "http://purl.obolibrary.org/obo/SO_"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_so_name(so_id: str) -> str | None:
|
|
23
|
+
"""Get the name from the identifier."""
|
|
24
|
+
return load_so().get(so_id)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@lru_cache(maxsize=1)
|
|
28
|
+
def load_so() -> dict[str, str]:
|
|
29
|
+
"""Load the Sequence Ontology names."""
|
|
30
|
+
if not os.path.exists(SO_PATH):
|
|
31
|
+
download_so()
|
|
32
|
+
with open(SO_PATH) as file:
|
|
33
|
+
return dict(csv.reader(file, delimiter="\t"))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def download_so():
|
|
37
|
+
"""Download the latest version of the Relation Ontology."""
|
|
38
|
+
rows = []
|
|
39
|
+
res_json = requests.get(SO_JSON_URL).json()
|
|
40
|
+
for node in res_json["graphs"][0]["nodes"]:
|
|
41
|
+
uri = node["id"]
|
|
42
|
+
if not uri.startswith(SO_URI_PREFIX):
|
|
43
|
+
continue
|
|
44
|
+
identifier = uri.removeprefix(SO_URI_PREFIX)
|
|
45
|
+
name = node.get("lbl")
|
|
46
|
+
if name:
|
|
47
|
+
rows.append((identifier, name))
|
|
48
|
+
|
|
49
|
+
with open(SO_PATH, "w") as file:
|
|
50
|
+
writer = csv.writer(file, delimiter="\t")
|
|
51
|
+
writer.writerows(sorted(rows, key=lambda x: int(x[0])))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
download_so()
|