Skip to content

Commit

Permalink
Merge pull request #7 from monarch-initiative/branch-review
Browse files Browse the repository at this point in the history
Branch review code for node obsoletion
  • Loading branch information
matentzn authored Nov 5, 2023
2 parents 261289c + f74c031 commit d734c2e
Show file tree
Hide file tree
Showing 8 changed files with 1,086 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,7 @@ tests/input/example-relation-graph.tsv.gz
.vscode/*
**/__pycache__/**
tmp/*
reports/*

!tmp/.keep
!tmp/mondo_validate*
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ tmp/mondo_edit.obo:
tmp/mondo.owl: tmp/mondo_edit.obo
robot convert -i $< --output $@

tmp/mondo.db: tmp/mondo.owl
tmp/mondo-relaxed-branchreview.owl: tmp/mondo_edit.obo
robot merge -i $< -i $< relax -o $@

tmp/mondo-reasoned-branchreview.owl: tmp/mondo_edit.obo
robot merge -i $< -i $< reason -o $@

tmp/mondo%.db: tmp/mondo%.owl
$(RUN) semsql make $@
rm -f .template.db
rm -f tmp/mondo-relation-graph.tsv.gz
Expand All @@ -36,7 +42,15 @@ tmp/mondo_validate_full.tsv: tmp/mondo.db
tmp/mondo_validate.tsv: tmp/mondo_validate_full.tsv
$(RUN) mondoqc validate $< -o $@

obsoletion-tables: tmp/mondo-relaxed-branchreview.db tmp/mondo-reasoned-branchreview.db
for id in $(shell cat src/mondolib/config/branch_ids.tsv); do \
$(RUN) mondoqc create-review-table -i tmp/mondo-reasoned-branchreview.db -o tmp/mondo-reasoned-branch-$$id-review.tsv -f src/mondolib/config/obsoletion_terms.tsv -b $$id;\
$(RUN) mondoqc create-review-table -i tmp/mondo-relaxed-branchreview.db -o tmp/mondo-relaxed-branch-$$id-review.tsv -f src/mondolib/config/obsoletion_terms.tsv -b $$id;\
$(RUN) mondoqc relax-and-reason -i tmp/mondo-reasoned-branch-$$id-review.tsv -i tmp/mondo-relaxed-branch-$$id-review.tsv -r tmp/mondo-relaxed-branchreview.db -f src/mondolib/config/obsoletion_terms.tsv -o reports/mondo-combined-branch-$$id-review.tsv;\
done

lexmatch: tmp/mondo_lexmatch.sssom.tsv
validate: tmp/mondo_validate.tsv

clear-tmp:
rm -rf tmp/*
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target-version = ["py38", "py39", "py310"]
extend-ignore = [
"D211", # `no-blank-line-before-class`
"D212", # `multi-line-summary-first-line`
"B005", # Using `.strip()` with multi-character strings is misleading the reader
]
exclude = [
"src/mondolib/datamodels/*"
Expand Down
31 changes: 30 additions & 1 deletion src/mondolib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import click

from mondolib import __version__
from mondolib.main import validate
from mondolib.main import create_review_table, relax_and_reason, validate

__all__ = [
"main",
Expand Down Expand Up @@ -42,5 +42,34 @@ def click_validate(input: str, output: str):
validate(input, output)


@main.command("create-review-table")
@click.option("-i", "--input", help="DB source file.")
@click.option("-b", "--branch-id", help="Branch ID")
@click.option("-B", "--branch-id-file", help="TSV with one column of obsoletion CURIEs")
@click.option(
"-f",
"--obsoletion-candidates-file",
help="TSV with one column of obsoletion CURIEs",
)
@click.option("-o", "--output-file", help="Path to report file")
def click_create_review_table(branch_id, branch_id_file, obsoletion_candidates_file, output_file, input):
"""Create review table."""
create_review_table(branch_id, branch_id_file, obsoletion_candidates_file, output_file, input)


@main.command("relax-and-reason")
@click.option("-i", "--input", help="branch review files to be combined.", multiple=True)
@click.option(
"-f",
"--obsoletion-candidates-file",
help="TSV with one column of obsoletion CURIEs",
)
@click.option("-o", "--output-file", help="Path to report file")
@click.option("-r", "--relaxed-resource", help="DB source file.")
def click_relax_and_reason(input, obsoletion_candidates_file, output_file, relaxed_resource):
"""Create final output takinf `reason` and `relax` output of resource via robot."""
relax_and_reason(input, obsoletion_candidates_file, output_file, relaxed_resource)


if __name__ == "__main__":
main()
39 changes: 39 additions & 0 deletions src/mondolib/config/branch_ids.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
MONDO:0002409
MONDO:0002657
MONDO:0045024
MONDO:0004995
MONDO:0019040
MONDO:0003900
MONDO:0004335
MONDO:0021147
MONDO:0002022
MONDO:0024458
MONDO:0005151
MONDO:0005570
MONDO:0003847
MONDO:0043543
MONDO:0700007
MONDO:0005046
MONDO:0005550
MONDO:0021166
MONDO:0002051
MONDO:0005066
MONDO:0044970
MONDO:0006858
MONDO:0002081
MONDO:0005071
MONDO:0005137
MONDO:0700003
MONDO:0100366
MONDO:0024623
MONDO:0100086
MONDO:0029000
MONDO:0021669
MONDO:0002025
MONDO:0043459
MONDO:0005039
MONDO:0005087
MONDO:0002254
MONDO:0043839
MONDO:0044991
MONDO:0002118
Loading

0 comments on commit d734c2e

Please sign in to comment.