Skip to content

Commit

Permalink
add makefile to generate a synonym csv report from ontologies/rdf
Browse files Browse the repository at this point in the history
  • Loading branch information
kshefchek committed Feb 26, 2020
1 parent d172e4e commit 5147da0
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
44 changes: 44 additions & 0 deletions synonyms/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
WGET = /usr/bin/wget --timestamping --no-verbose

OBO = http://purl.obolibrary.org/obo
MONARCH = https://archive.monarchinitiative.org/latest/rdf


OBO_SOURCES = mondo.owl \
hp.owl \
chebi.owl

MONARCH_SOURCES = reactome.ttl

ALL_SOURCES = $(OBO_SOURCES) $(MONARCH_SOURCES)
CSVS = $(ALL_SOURCES:=.csv)

build/:
mkdir -p build

build/robot.jar: | build/
curl -L -o build/robot.jar \
https://build.berkeleybop.org/job/robot/lastSuccessfulBuild/artifact/bin/robot.jar

ROBOT := java -jar build/robot.jar

sources/:
mkdir --parents $@

$(OBO_SOURCES): | sources/
cd sources && $(WGET) $(OBO)/$@

$(MONARCH_SOURCES): | sources/
cd sources && $(WGET) $(MONARCH)/$@

$(CSVS): $(ALL_SOURCES) build/robot.jar
$(ROBOT) \
filter --input sources/$(patsubst %.csv,%,$@) --axioms annotation \
query -f csv --query ./sparql/synonyms.sparql $@

all-synonyms.csv: $(CSVS)
cat *.csv | sort -u >all-synonyms.csv


all: $(ALL_SOURCES) build/robot.jar $(CSVS) all-synonyms.csv

9 changes: 9 additions & 0 deletions synonyms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Generates a tsv of synonyms using [robot](http://robot.obolibrary.org/)
with the fields iri, synonym type, synonym

To run:

make all

To add ontologies or rdf sources adjust the ALL_SOURCES variable

15 changes: 15 additions & 0 deletions synonyms/sparql/synonyms.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?cls ?pred ?val
WHERE
{ ?cls ?pred ?val ;
a owl:Class .
FILTER (
?pred = oboInOwl:hasRelatedSynonym ||
?pred = oboInOwl:hasNarrowSynonym ||
?pred = oboInOwl:hasBroadSynonym ||
?pred = oboInOwl:hasExactSynonym
)
}

0 comments on commit 5147da0

Please sign in to comment.