Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created February 14, 2022 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cthoyt/52f1af29f600075b83a19638d2fbb26c to your computer and use it in GitHub Desktop.
Save cthoyt/52f1af29f600075b83a19638d2fbb26c to your computer and use it in GitHub Desktop.
How many potential mappings are in the Bioregistry?
"""Calculate the number of possible mappings between bioregistry entries."""
from itertools import combinations
from bioregistry.external.getters import GETTERS
from bioregistry.version import VERSION
from humanize import intword
def main():
getters = [
getter()
for _, _, getter in GETTERS
]
total = sum(
len(x) * len(y)
for x, y in combinations(getters, 2)
)
print(f"There are {intword(total)} possible mappings in the Bioregistry (v{VERSION}).")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment