Created
February 14, 2022 14:46
-
-
Save cthoyt/52f1af29f600075b83a19638d2fbb26c to your computer and use it in GitHub Desktop.
How many potential mappings are in the Bioregistry?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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