-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add --clean-obo
option to convert
.
#1236
Conversation
This commit adds a `--clean-obo` option to the `convert` command. The option accepts a space-separated list of options that dictate how OBO output should be tweaked: * `drop-extra-labels` (if an entity has more than one rdfs:label annotation, keep the first label only); * `drop-extra-definitions` (likewise, but for IAO:0000115 definitions); * `drop-extra-comments` (likewise, but for rdfs:comment annotations); * `merge-comments` (merge rdfs:comment annotations into a single annotation); * `drop-untranslatable-axioms` (drop axioms that cannot be represented in the OBO format instead of putting them in a owl-axioms header tag); * `drop-gci-axioms` (drop general concept inclusion axioms). In addition, the option accepts the following keywords: * `strict`: equivalent to `drop-extra-{labels,definitions,comments}`; * `simple`: equivalent to `strict drop-untranslatable-axioms drop-gci-axioms`; * `true`: equivalent to `simple`.
Not sure what caused the Java 11 test to take more than 10 minutes (thereby triggering a failure)… Can’t reproduce here, on my machine the test suite runs fine with Java 11, Java 17, and Java 21 in about 2.5 minutes. |
Whatever it was it was temporary |
This is really excellent! I'm very happy with the design, and the code looks good too. Please add some tests, the I'll kick the tired, and we'll get this merged. |
I've also seen intermittent timeouts from one of the three Java versions, but haven't noticed a pattern, and it will be hell to debug. So I just re-run the failing one and it usually passes the second time. Not ideal. |
Add two unit tests for the new methods dropExtraAnnotations and mergeExtraAnnotations in the OntologyHelper class.
Test the overall --clean-obo feature with three new integration tests in convert.md. The tests use a new sample file (cl_module.ofn) which is a small CL module built around CL:0000583 ("alveolar macrophage"). That module contains instances of all the things that --clean-obo is suppose to deal with: * supernumerary annotations (two comments on CL:0000583) * axioms that are not translatable into pure OBO: 'has characteristic' some 'cell morphology' SubClassOf cell * (translatable) GCI axioms: cell and ('has characteristic' some mononucleate) SubClassOf 'has part' some nucleus`
@jamesaoverton Tests added. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great code, nicely written docs. I went through most things top to bottom (not all the Java lines in extreme detail) and I find this very readable, nicely written code. I have a tiny opinionated suggestion that I have no concern abandoning.
robot-core/src/main/java/org/obolibrary/robot/OntologyHelper.java
Outdated
Show resolved
Hide resolved
Add an optional argument to OntologyHelper.mergeExtraAnnotations to allow the caller to specify the separator string to insert between annotation values, when merging annotations together. The default separator is a single space character. This is a code-level feature only. The separator string is _not_ customizable from the command-line, when comment annotations are merged as part of `--clean-obo merge-comments`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super clean code, great docs, everything looks pretty much flawless!
Sorry for taking so long to get back to this. Much appreciated! |
Resolves [#995]
docs/
have been added/updatedmvn verify
says all tests passmvn site
says all JavaDocs correctCHANGELOG.md
has been updatedThis PR adds a
--clean-obo
option to theconvert
command, as discussed in #995.The option accepts a space-separated list of keywords that dictate how OBO output should be tweaked:
drop-extra-labels
: if an entity has more than onerdfs:label
annotation, keep the first label only;drop-extra-definitions
: likewise, but forIAO:0000115
definitions;drop-extra-comments
: likewise, but forrdfs:comment
annotations;merge-comments
: alternative todrop-extra-comments
: mergerdfs:comment
annotations into a single annotation, instead of keeping only the first one;drop-untranslatable-axioms
: drop axioms that cannot be represented in the OBO format instead of putting them in aowl-axioms
header tag;drop-gci-axioms
: drop general concept inclusion axioms.In addition, the option accepts the following shortcut keywords:
strict
: equivalent todrop-extra-labels drop-extra-definitions drop-extra-comments
;simple
: equivalent tostrict drop-untranslatable-axioms drop-gci-axioms
;true
: equivalent tosimple
.