diff --git a/Dockerfile b/Dockerfile index 763cc1e..3420fb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,14 +27,20 @@ ENV JAVA_HOME /usr/lib/jvm/java-8-oracle # Define working directory. WORKDIR /data ADD owlsim-services/target/owlsim-services-3.0-SNAPSHOT.jar /data/ -ADD configuration-samples/configuration-all.yaml /data/configuration.yaml +#ADD configuration-samples/configuration-all.yaml /data/configuration.yaml +ADD scripts/golr-exporter.py /data/golr-exporter.py +ADD scripts/configuration-generator.py /data/configuration-generator.py -RUN if [ $species = "human" ]; \ +RUN apt-get -y update && apt-get install python-pip -y +RUN pip install pyyaml + +RUN if [ $species = "all" ]; \ then \ - wget https://data.monarchinitiative.org/owl/all-hp.owl -O /data/all.owl; \ + cd /data && python golr-exporter.py; \ else \ - wget http://ci.monarchinitiative.org/view/dev/job/create-owlsim-files-on-dev/lastSuccessfulBuild/artifact/server/all.owl -O /data/all.owl; \ + cd /data && python golr-exporter.py -t $species; \ fi +RUN cd /data && python configuration-generator.py CMD java -jar /data/owlsim-services-3.0-SNAPSHOT.jar server /data/configuration.yaml diff --git a/README.md b/README.md index 7fd2ddc..87ddadd 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ To restrict to specific species: ``` docker build --build-arg species=all -t owlsim-all . # default if no args is provided or not matching any species -docker build --build-arg species=human -t owlsim-human - +docker build --build-arg species=Hs -t owlsim-human . +docker build --build-arg species=Hs,Mm -t owlsim-multi . +# supported species: Hs,Mm,Dr,Dm,Ce ``` diff --git a/owlsim-core/src/main/java/org/monarchinitiative/owlsim/kb/impl/BMKnowledgeBaseOWLAPIImpl.java b/owlsim-core/src/main/java/org/monarchinitiative/owlsim/kb/impl/BMKnowledgeBaseOWLAPIImpl.java index 444f212..7a85e0a 100644 --- a/owlsim-core/src/main/java/org/monarchinitiative/owlsim/kb/impl/BMKnowledgeBaseOWLAPIImpl.java +++ b/owlsim-core/src/main/java/org/monarchinitiative/owlsim/kb/impl/BMKnowledgeBaseOWLAPIImpl.java @@ -363,8 +363,8 @@ private void setPropertyValues(OWLOntology ont, OWLNamedIndividual i) { addPropertyValue(pvm, pid, getShortForm(((OWLNamedIndividual) obj).getIRI())); } - - } else if (false) { + // TODO check this... + } else if (false) { String pid = getShortForm(((OWLDataProperty) p).getIRI()); OWLLiteral obj = ((OWLDataPropertyAssertionAxiom) paa).getObject(); if (obj instanceof OWLLiteral) { diff --git a/owlsim-services/src/main/java/org/monarchinitiative/owlsim/services/modules/KnowledgeBaseModule.java b/owlsim-services/src/main/java/org/monarchinitiative/owlsim/services/modules/KnowledgeBaseModule.java index 0b3b2a9..d7f152c 100644 --- a/owlsim-services/src/main/java/org/monarchinitiative/owlsim/services/modules/KnowledgeBaseModule.java +++ b/owlsim-services/src/main/java/org/monarchinitiative/owlsim/services/modules/KnowledgeBaseModule.java @@ -33,7 +33,7 @@ public KnowledgeBaseModule(Collection ontologyUris, Collection o logger.info("Loading curies:"); curies.entrySet().forEach(logger::info); logger.info("Loading labels:"); - //labels.entrySet().forEach(logger::info); + labelTsvs.forEach(logger::info); //The OwlKnowledgeBase.Loader uses the ELKReasonerFactory and Concurrency.CONCURRENT as defaults. this.bmKnowledgeBase = OwlKnowledgeBase.loader() diff --git a/scripts/configuration-generator.py b/scripts/configuration-generator.py new file mode 100644 index 0000000..33d0911 --- /dev/null +++ b/scripts/configuration-generator.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# grab the curie mapping +# scan the current directory for the tsvs +# output an owlsim config file + +import yaml +import urllib2 +import fnmatch +import os + +def main(): + + # Getting tsv file path + tsvs = [] + for root, _, filenames in os.walk('.'): + for filename in fnmatch.filter(filenames, '*.tsv'): + tsvs.append(os.path.abspath(os.path.join(root, filename))) # Check that: it looks insane to get the absolute path... + + dataTsvs = [filename for filename in tsvs if not filename.endswith('label.tsv')] + labelTsvs = [filename for filename in tsvs if filename.endswith('label.tsv')] + + # Note: the yaml dump is buggy with the empty string key, so I'm just appending the raw string and add indentation manually + curies = urllib2.urlopen("https://raw.githubusercontent.com/monarch-initiative/dipper/master/dipper/curie_map.yaml").read() + + data = dict( + ontologyUris = ['http://purl.obolibrary.org/obo/upheno/monarch.owl'], + ontologyDataUris = [], + dataTsvs = dataTsvs, + labelTsvs = labelTsvs + ) + + print("Generating owlsim configuration") + with open('configuration.yaml', 'w') as outfile: + yaml.dump(data, outfile, default_flow_style=False) + outfile.write("curies:\n") + outfile.write(' '.join(curies.splitlines(True))) + + +if __name__ == "__main__": + main() diff --git a/scripts/golr-exporter.py b/scripts/golr-exporter.py index 09df921..0373256 100644 --- a/scripts/golr-exporter.py +++ b/scripts/golr-exporter.py @@ -43,7 +43,8 @@ def transformAssociation(input, output): def main(): - biolink = "http://localhost:5000/api" #mart/labels/gene/phenotype/NCBITaxon%3A7955 + #biolink = "http://localhost:5000/api" #mart/labels/gene/phenotype/NCBITaxon%3A7955 + biolink = "https://api.monarchinitiative.org/api" taxon_map = { 'Hs': 9606,