Skip to content

Commit 1462f1a

Browse files
committed
Add infrastructure for annotating provider relationships
References #32 and #21
1 parent 04e2625 commit 1462f1a

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/bioregistry/data/bioregistry.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@
567567
"is_identifiers": true,
568568
"is_obo": false,
569569
"prefix": "APID.INTERACTIONS"
570-
}
570+
},
571+
"provides": "uniprot",
572+
"type": "provider"
571573
},
572574
"apo": {
573575
"bioportal": {
@@ -23990,6 +23992,7 @@
2399023992
}
2399123993
},
2399223994
"validatordb": {
23995+
"example": "2h6o",
2399323996
"miriam": {
2399423997
"deprecated": false,
2399523998
"description": "Database of validation results for ligands and non-standard residues in the Protein Data Bank.",
@@ -24008,7 +24011,10 @@
2400824011
"is_identifiers": true,
2400924012
"is_obo": false,
2401024013
"prefix": "VALIDATORDB"
24011-
}
24014+
},
24015+
"provides": "pdb",
24016+
"type": "provider",
24017+
"url": "https://webchem.ncbr.muni.cz/Platform/ValidatorDb/ByStructure/$1"
2401224018
},
2401324019
"vandf": {
2401424020
"biolink": {

src/bioregistry/resolve.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,36 @@ def get_owl_download(prefix: str) -> Optional[str]:
292292
return entry.get('ols', {}).get('version.iri')
293293

294294

295+
def is_provider(prefix: str) -> bool:
296+
"""Get if the prefix is a provider.
297+
298+
:param prefix: The prefix to look up
299+
:returns: if the prefix is a provider
300+
301+
>>> assert not is_provider('pdb')
302+
>>> assert is_provider('validatordb')
303+
"""
304+
entry = get(prefix)
305+
if entry is None:
306+
return False
307+
return entry.get('type') == 'provider'
308+
309+
310+
def get_provides_for(prefix: str) -> Optional[str]:
311+
"""Get the resource that the given prefix provides for, or return none if not a provider.
312+
313+
:param prefix: The prefix to look up
314+
:returns: The prefix of the resource that the given prefix provides for, if it's a provider
315+
316+
>>> assert get_provides_for('pdb') is None
317+
>>> assert 'pdb' == get_provides_for('validatordb')
318+
"""
319+
entry = get(prefix)
320+
if entry is None:
321+
return None
322+
return entry.get('provides')
323+
324+
295325
def parse_curie(curie: str) -> Union[Tuple[str, str], Tuple[None, None]]:
296326
"""Parse a CURIE, normalizing the prefix and identifier if necessary.
297327

0 commit comments

Comments
 (0)