Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created November 2, 2024 13:41
Show Gist options
  • Save cthoyt/89e427061a4d553ee85b6bbfd1791de5 to your computer and use it in GitHub Desktop.
Save cthoyt/89e427061a4d553ee85b6bbfd1791de5 to your computer and use it in GitHub Desktop.
Generate SSSOM for the negative mappings in the Bioregistry
import json
import bioregistry
if __name__ == "__main__":
r = json.load(open("mismatch.json"))
with open("mismatches.sssom.tsv", "w") as file:
print(
"subject_id",
"subject_label",
"predicate_id",
"predicate_modifier",
"object_id",
"object_label",
"mapping_justification",
"author_id",
sep="\t",
file=file,
)
for k, v in r.items():
for metaprefix, value in v.items():
print(
f"bioregistry:{k}",
bioregistry.get_name(k),
"skos:exactMatch",
"NOT",
f"{metaprefix}:{value}",
"",
"semapv:ManualMappingCuration",
"orcid:0000-0003-4423-4370",
sep="\t",
file=file,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment