Skip to content

Commit

Permalink
Add slim EC
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Nov 4, 2024
1 parent 4254dbf commit 4bd4282
Show file tree
Hide file tree
Showing 2 changed files with 52,705 additions and 0 deletions.
21 changes: 21 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
"kegg.genome",
"slm",
]
SLIMS = {
"rhea",
"eccode",
}

for _prefix in PREFIXES:
if _prefix != bioregistry.normalize_prefix(_prefix):
Expand Down Expand Up @@ -212,10 +216,12 @@ def _make(
tqdm.write(click.style(f"[{prefix}] has no version info", fg="red"))
directory.mkdir(exist_ok=True, parents=True)
obo_path = directory.joinpath(f"{prefix}.obo")
obo_slim_path = directory.joinpath(f"{prefix}-slim.obo")
names_path = directory.joinpath(f"{prefix}.tsv")
sssom_path = directory.joinpath(f"{prefix}.sssom.tsv")
obo_graph_json_path = directory.joinpath(f"{prefix}.json")
owl_path = directory.joinpath(f"{prefix}.owl")
owl_slim_path = directory.joinpath(f"{prefix}-slim.owl")
log_path = directory.joinpath(f"{prefix}.log.txt")
log_path.unlink(missing_ok=True)

Expand All @@ -234,6 +240,14 @@ def _make(
return rv
obo_path, rv["obo"] = _prepare_artifact(prefix, obo_path, has_version, ".obo.gz")

if prefix in SLIMS:
obo.write_obo(
obo_slim_path, emit_object_properties=False, emit_annotation_properties=True
)
obo_slim_path, rv["obo-slim"] = _prepare_artifact(
prefix, obo_slim_path, has_version, ".obo.gz"
)

rv["summary"] = _get_summary(obo)

_write_nodes(names_path, obo, prefix)
Expand Down Expand Up @@ -262,6 +276,13 @@ def _make(
else:
tqdm.write(f"[{prefix}] done converting to OWL")

# for now, assume if the non-slim worked, so will the slim
if prefix in SLIMS:
convert(obo_slim_path, owl_slim_path, merge=False, reason=False, debug=True)
_, rv["owl-slim"] = _prepare_artifact(
prefix, owl_slim_path, has_version, ".owl.gz"
)

try:
tqdm.write(f"[{prefix}] converting to OBO Graph JSON")
convert(
Expand Down
Loading

0 comments on commit 4bd4282

Please sign in to comment.