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

Overhaul taxon subsets #3363

Merged
merged 8 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ subsets/*.tsv
src/ontology/subsets/*.json
src/ontology/subsets/*.obo
src/ontology/subsets/*.owl
src/ontology/subsets/*.ofn
src/ontology/subsets/*.tsv
src/ontology/imports/*_import.owl
!src/ontology/imports/orcidio_import.owl
Expand Down
6 changes: 3 additions & 3 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# More information: https://github.com/INCATools/ontology-development-kit/

# Fingerprint of the configuration file when this Makefile was last generated
CONFIG_HASH= 9531f9cc87d9bbbcf0d424b5845e95234e9cd34df6d28bdbb856a4ba7b5557ad
CONFIG_HASH= 943829f9eb8e1b8d46bf5f3f878364bb18f10e0d9eee11d7c28bfb3dfba894c7


# ----------------------------------------
Expand Down Expand Up @@ -154,7 +154,7 @@ $(ROBOT_PLUGINS_DIRECTORY)/%.jar:
# Specific rules for supplementary plugins defined in configuration

$(ROBOT_PLUGINS_DIRECTORY)/uberon.jar:
curl -L -o $@ https://github.com/gouttegd/uberon-robot-plugin/releases/download/uberon-robot-plugin-0.2.0/uberon.jar
curl -L -o $@ https://github.com/gouttegd/uberon-robot-plugin/releases/download/uberon-robot-plugin-0.3.1/uberon.jar


# ----------------------------------------
Expand Down Expand Up @@ -189,7 +189,7 @@ all_imports: $(IMPORT_FILES)
# ----------------------------------------


SUBSETS = appendicular-minimal circulatory-minimal cranial-minimal cumbo digestive-minimal excretory-minimal human-view immune-minimal life-stages-composite life-stages-core life-stages-minimal merged-partonomy mouse-view musculoskeletal-minimal nephron-minimal nervous-minimal pulmonary-minimal renal-minimal reproductive-minimal sensory-minimal xenopus-view amniote-basic euarchontoglires-basic
SUBSETS = appendicular-minimal circulatory-minimal cranial-minimal cumbo digestive-minimal excretory-minimal human-view immune-minimal life-stages-composite life-stages-core life-stages-minimal merged-partonomy mouse-view musculoskeletal-minimal nephron-minimal nervous-minimal pulmonary-minimal renal-minimal reproductive-minimal sensory-minimal xenopus-view amniote-view euarchontoglires-view

SUBSET_ROOTS = $(patsubst %, $(SUBSETDIR)/%, $(SUBSETS))
SUBSET_FILES = $(foreach n,$(SUBSET_ROOTS), $(foreach f,$(FORMATS_INCL_TSV), $(n).$(f)))
Expand Down
4 changes: 0 additions & 4 deletions src/ontology/contexts/context-drosophila.owl

This file was deleted.

4 changes: 0 additions & 4 deletions src/ontology/contexts/context-gnathostome.owl

This file was deleted.

4 changes: 0 additions & 4 deletions src/ontology/contexts/context-human.owl

This file was deleted.

4 changes: 0 additions & 4 deletions src/ontology/contexts/context-mouse.owl

This file was deleted.

3 changes: 0 additions & 3 deletions src/ontology/contexts/context-nematode.owl

This file was deleted.

4 changes: 0 additions & 4 deletions src/ontology/contexts/context-xenopus.owl

This file was deleted.

4 changes: 0 additions & 4 deletions src/ontology/contexts/context-zebrafish.owl

This file was deleted.

6 changes: 3 additions & 3 deletions src/ontology/uberon-odk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ subset_group:
- id: reproductive-minimal
- id: sensory-minimal
- id: xenopus-view
- id: amniote-basic
- id: euarchontoglires-basic
- id: amniote-view
- id: euarchontoglires-view
sssom_mappingset_group:
products:
- id: fbbt
Expand All @@ -123,7 +123,7 @@ robot_java_args: '-Xmx20G'
robot_plugins:
plugins:
- name: uberon
mirror_from: https://github.com/gouttegd/uberon-robot-plugin/releases/download/uberon-robot-plugin-0.2.0/uberon.jar
mirror_from: https://github.com/gouttegd/uberon-robot-plugin/releases/download/uberon-robot-plugin-0.3.1/uberon.jar
robot_report:
release_reports: False
fail_on: ERROR
Expand Down
99 changes: 49 additions & 50 deletions src/ontology/uberon.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -934,40 +934,59 @@ subsets/life-stages-core.owl: uberon.owl
# Taxon subsets
# ----------------------------------------

all_taxmods: $(TAXMODSDIR)/uberon-taxmod-amniote.obo $(TAXMODSDIR)/uberon-taxmod-euarchontoglires.obo

$(TAXMODSDIR)/uberon-taxmod-euarchontoglires.owl: $(TMPDIR)/uberon-taxmod-314146.owl
cp $< $@

$(TAXMODSDIR)/uberon-taxmod-amniote.owl: $(TMPDIR)/uberon-taxmod-32524.owl
cp $< $@

$(TAXMODSDIR)/uberon-taxmod-human.owl: $(TMPDIR)/uberon-taxmod-9606.owl
cp $< $@

subsets/%-basic.owl: $(TAXMODSDIR)/uberon-taxmod-%.owl tmp/simple-slim-seed.txt
$(ROBOT) reason --input $< \
--reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural \
TAXON_ID_human = NCBITaxon:9606
TAXON_ID_mouse = NCBITaxon:10090
TAXON_ID_xenopus = NCBITaxon:8353
TAXON_ID_drosophila = NCBITaxon:7227
TAXON_ID_gnathostome = NCBITaxon:7776
TAXON_ID_amniote = NCBITaxon:32524
TAXON_ID_euarchontoglires = NCBITaxon:314146
TAXON_ID_nematode = NCBITaxon:6237
TAXON_ID_zebrafish = NCBITaxon:7955

# Strategy to use to create the taxon subsets:
# - default: OWLTools' original strategy; given a root class R and a
# taxon T, assert 'R SubClassOf: in_taxon some T' and exclude
# all classes that are unsatisfiable because of that
# assertion.
# - precise: alternative strategy; given a root class R and a taxon T,
# iterate through all subclasses C of R and include classes
# for which the expression 'C and in_taxon some T' is
# satisfiable; about 3-5 times slower than 'default'.
TAXON_SUBSET_STRATEGY = default

TAXON_SUBSET_ROOTS = UBERON:0001062 UBERON:0000000
matentzn marked this conversation as resolved.
Show resolved Hide resolved

# Create a taxon-specific subset
.PRECIOUS: subsets/%-view.owl
subsets/%-view.owl: uberon.owl | all_robot_plugins
$(ROBOT) uberon:create-species-subset --input $< \
--taxon $(TAXON_ID_$*) \
--strategy $(TAXON_SUBSET_STRATEGY) \
--reasoner ELK \
$(foreach root,$(TAXON_SUBSET_ROOTS),--root $(root)) \
reason --reasoner ELK --equivalent-classes-allowed all \
--exclude-tautologies structural \
relax \
remove --axioms equivalent \
relax \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't imagine what this second relax does but well since it's there..

filter --term-file tmp/simple-slim-seed.txt \
--select "annotations ontology anonymous self" --trim true --signature true \
reduce -r ELK \
query --update ../sparql/inject-subset-declaration.ru \
reduce --reasoner ELK \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert -f ofn -o [email protected] && mv [email protected] $@
.PRECIOUS: subsets/%-basic.owl

$(TAXMODSDIR)/uberon-taxmod-%.obo: $(TAXMODSDIR)/uberon-taxmod-%.owl
$(OWLTOOLS) $< --remove-imports-declarations -o -f obo --no-check [email protected] && grep -v ^owl [email protected] > $@

# added --allowEquivalencies, see https://github.com/geneontology/go-ontology/issues/12926
$(TMPDIR)/uberon-taxmod-%.owl: uberon.owl
$(OWLTOOLS) $< --reasoner elk --make-species-subset --perform-macro-expansion false -t NCBITaxon:$* \
--assert-inferred-subclass-axioms --allowEquivalencies --useIsInferred --remove-dangling \
--set-ontology-id $(URIBASE)/uberon/subsets/$@ -o $@ 2>&1 > [email protected]
.PRECIOUS: $(TMPDIR)/uberon-taxmod-%.owl
convert --format ofn --output $@

# Create a component containing oboInOwl:inSubset annotations that mark
# the classes that belong to a taxon-specific subset
subsets/%-tags.ofn: uberon.owl | all_robot_plugins
$(ROBOT) uberon:create-species-subset --input $< \
--taxon $(TAXON_ID_$*) \
--strategy $(TAXON_SUBSET_STRATEGY) \
--reasoner ELK \
$(foreach root,$(TAXON_SUBSET_ROOTS),--root $(root)) \
--no-remove \
--prefix 'uberon: http://purl.obolibrary.org/obo/uberon/core#' \
--subset-name uberon:$*_subset \
--only-tag-in UBERON: --only-tag-in GO: \
--write-tags-to $@
matentzn marked this conversation as resolved.
Show resolved Hide resolved


# Other subsets
Expand All @@ -990,26 +1009,6 @@ subsets/immaterial.obo: uberon.owl
--make-ontology-from-results $(URIBASE)/uberon/$@ \
-o -f obo $@ --reasoner-dispose 2>&1 > [email protected]

# The first step is a simple "merge+reason", but it still requires
# Owltools because ROBOT has no equivalent to the -x option to simply
# ignore unsatisfiable classes without erroring out.
subsets/%-view.owl: uberon.owl contexts/context-%.owl tmp/simple-slim-seed.txt
$(OWLTOOLS) uberon.owl contexts/context-$*.owl --merge-support-ontologies --merge-imports-closure \
$(QELK) --run-reasoner -r elk -x -o -f ofn [email protected] && \
$(ROBOT) reason --input [email protected] \
--reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural \
unmerge -i contexts/context-$*.owl \
relax \
remove --axioms equivalent \
relax \
filter --term-file tmp/simple-slim-seed.txt \
--select "annotations ontology anonymous self" --trim true --signature true \
reduce -r ELK \
query --update ../sparql/inject-subset-declaration.ru \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert -f ofn -o [email protected] && mv [email protected] $@
.PRECIOUS: subsets/%-view.owl

%-partview.owl: %.owl
$(OWLTOOLS) $< --remove-subset grouping_class --remove-subset upper_level \
--bpvo --reflexive --prefix "" --suffix " part" -r elk -p BFO:0000050 --replace \
Expand Down
Loading