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

Allen JSON structuregraph to OWL converter (unreasoned) #12

Merged
merged 27 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
761c7d0
add download in makefile
shawntanzk Mar 2, 2022
57c7b77
Edited makefile
shawntanzk Mar 2, 2022
20bae6f
minor edits
shawntanzk Mar 2, 2022
eb9347c
remove redundant addtions
shawntanzk Mar 3, 2022
4d7c0e2
full run yay!
shawntanzk Mar 3, 2022
0b26b09
update
shawntanzk Mar 3, 2022
dab6045
Allen JSON structuregraph to OWL converter #9
hkir-dev Mar 8, 2022
6e9936b
Allen JSON structuregraph to OWL converter #9
hkir-dev Mar 8, 2022
f3dff77
Allen JSON structuregraph to OWL converter #9
hkir-dev Mar 8, 2022
21ae82c
Allen JSON structuregraph to OWL converter #9
hkir-dev Mar 8, 2022
7f5ea6c
Merge pull request #10 from shawntanzk/download-sources
shawntanzk Mar 8, 2022
cc1d342
make download > convert
shawntanzk Mar 8, 2022
63f883f
merged makefiles #9
hkir-dev Mar 8, 2022
737e333
added empty sources folder #9
hkir-dev Mar 8, 2022
1b5c6bb
formatting #9
hkir-dev Mar 8, 2022
4e02597
python -> python3
shawntanzk Mar 9, 2022
289fd87
remove convert
shawntanzk Mar 9, 2022
29b7cc6
reports
shawntanzk Mar 9, 2022
c0c3f25
documentation
shawntanzk Mar 9, 2022
c4fcffd
doc
shawntanzk Mar 9, 2022
b174cfe
diff report - make all lowercase
shawntanzk Mar 9, 2022
14a8294
fix
shawntanzk Mar 9, 2022
ad300a0
linkout template fixed based on the new ont
hkir-dev Mar 15, 2022
7bb4614
Merge remote-tracking branch 'origin/issue_9' into issue_9
hkir-dev Mar 15, 2022
09d7c27
sparql query for ccf-validation-tools
hkir-dev Mar 24, 2022
dcd9826
label adding to the validation report
hkir-dev Mar 24, 2022
8186422
Merge pull request #19 from obophenotype/rel_validation
hkir-dev Apr 14, 2022
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src/ontology/mirror/*
src/ontology/sources/*
.DS_Store
src/.DS_Store
src/ontology/.DS_Store
src/ontology/tmp.owl
src/ontology/tmp.json
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pandas
openpyxl
openpyxl
linkml-owl
ruamel.yaml
Empty file added src/linkml/data/.gitignore
Empty file.
44 changes: 44 additions & 0 deletions src/linkml/structure_graph_schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
id: http://purl.obolibrary.org/obo/ABA_Uberon
name: structure_graph
prefixes:
UBERON: 'http://purl.obolibrary.org/obo/UBERON_'

default_curi_maps:
- semweb_context
- obo_context

types:
string:
base: str
uri: xsd:string

classes:
Class:
slots:
- id
- name
- acronym
- parent_structure_id
- subclass_of
class_uri: owl:Class

slots:
id:
identifier: true
# range: uriorcurie
name:
slot_uri: rdfs:label
annotations:
owl: AnnotationAssertion
acronym:
slot_uri: oboInOwl:hasExactSynonym
annotations:
owl: AnnotationAssertion
parent_structure_id:
slot_uri: BFO:0000050
annotations:
owl: SubClassOf, ObjectSomeValuesFrom
subclass_of:
slot_uri: rdfs:subclass_of
annotations:
owl: SubClassOf
63 changes: 56 additions & 7 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
### This makefile requires python3 & pip3 mapped as such

JOBS = 1 17 10 16 8

ROBOT = robot
LINKML = linkml-data2owl

URIBASE = http://purl.obolibrary.org/obo

all: aba_uberon.owl report.xlsx
STRUCTURE_GRAPHS = $(patsubst %, sources/%.json, $(JOBS))
ALL_GRAPH_ONTOLOGIES = $(patsubst sources/%.json,sources/%.ofn,$(STRUCTURE_GRAPHS))


all: dependencies $(ALL_GRAPH_ONTOLOGIES) aba_uberon.owl report.xlsx

# Installing depedencies so it can run in ODK container
.PHONY: dependencies
dependencies:
pip3 install -r ../../requirements.txt

IMP=true # Global parameter to bypass import generation
MIR=true # Global parameter to bypass mirror generation
Expand All @@ -12,26 +27,60 @@ mirror/uberon.owl:

# TODO: move to making uberon slice.

sources/%.json:
curl -o $@ $(subst %,$(subst sources/,,$@),"http://api.brain-map.org/api/v2/structure_graph_download/%")

../linkml/data/template_%.tsv: sources/%.json
python3 ../scripts/structure_graph_template.py -i $< -o $@

sources/%.ofn: ../linkml/data/template_%.tsv
$(LINKML) -C Class -s ../linkml/structure_graph_schema.yaml $< -o $@
.PRECIOUS: sources/%.ofn

# download bridges

sources/uberon-bridge-to-aba.obo:
curl -o sources/uberon-bridge-to-aba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-aba.obo"

sources/uberon-bridge-to-dhba.obo:
curl -o sources/uberon-bridge-to-dhba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-dhba.obo"

sources/uberon-bridge-to-dmba.obo:
curl -o sources/uberon-bridge-to-dmba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-dmba.obo"

sources/uberon-bridge-to-hba.obo:
curl -o sources/uberon-bridge-to-hba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-hba.obo"

sources/uberon-bridge-to-mba.obo:
curl -o sources/uberon-bridge-to-mba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-mba.obo"

sources/uberon-bridge-to-pba.obo:
curl -o sources/uberon-bridge-to-pba.obo "https://raw.githubusercontent.com/obophenotype/uberon/master/src/ontology/bridge/uberon-bridge-to-pba.obo"

all_bridges:
make sources/uberon-bridge-to-aba.obo sources/uberon-bridge-to-dhba.obo sources/uberon-bridge-to-dmba.obo sources/uberon-bridge-to-hba.obo sources/uberon-bridge-to-mba.obo sources/uberon-bridge-to-pba.obo -B


# Merge sources. # crudely listing dependencies for now - but could switch to using pattern expansion
sources_merged.owl:
robot merge --input sources/allen-dhba.obo --input sources/allen-dmba.obo --input sources/allen-hba.obo --input sources/allen-mba.obo --input sources/allen-pba.obo --input sources/uberon-bridge-to-aba.obo --input sources/uberon-bridge-to-dhba.obo --input sources/uberon-bridge-to-dmba.obo --input sources/uberon-bridge-to-hba.obo --input sources/uberon-bridge-to-mba.obo --input sources/uberon-bridge-to-pba.obo annotate --ontology-iri $(URIBASE)/$@ -o $@
sources_merged.owl: all_bridges
robot merge --input sources/1.ofn --input sources/17.ofn --input sources/10.ofn --input sources/16.ofn --input sources/8.ofn --input sources/uberon-bridge-to-aba.obo --input sources/uberon-bridge-to-dhba.obo --input sources/uberon-bridge-to-dmba.obo --input sources/uberon-bridge-to-hba.obo --input sources/uberon-bridge-to-mba.obo --input sources/uberon-bridge-to-pba.obo annotate --ontology-iri $(URIBASE)/$@ -o $@


# Generate seed for pulling relevant subset of Uberon
terms.txt: sources_merged.owl
$(ROBOT) query --use-graphs true -f tsv -i $< --query ../sparql/terms.sparql $@
$(ROBOT) query --use-graphs true -f csv -i $< --query ../sparql/terms.sparql $@

# Generate slice of uberon, removing disjoints
# Using BOT for now - but this could potentially be more minimal

uberon_slice.owl: mirror/uberon.owl terms.txt
$(ROBOT) extract --method BOT -i mirror/uberon.owl -T terms.txt remove --axioms disjoint -o $@
$(ROBOT) extract --method BOT --input mirror/uberon.owl --term-file terms.txt --force true remove --axioms disjoint --output $@


# merge uberon + sources, reason & relax (EC -> SC)

tmp.owl: uberon_slice.owl sources_merged.owl
robot merge --input uberon_slice.owl --input sources_merged.owl reason relax annotate --ontology-iri $(URIBASE)/$@ -o $@
robot merge --input uberon_slice.owl --input sources_merged.owl relax annotate --ontology-iri $(URIBASE)/$@ -o $@

# Make a json file for use in geneating ROBOT template
tmp.json: tmp.owl
Expand All @@ -40,7 +89,7 @@ tmp.json: tmp.owl
# Build robot template - with linkouts and prefLabels

../robot_templates/linkouts.tsv: tmp.json
python ../scripts/gen_linkout_template.py $<
python3 ../scripts/gen_linkout_template.py $<

# generate OWL from template

Expand Down
Loading