Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrating adding slim version of EC #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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