From 656a92f6304b19ce4fb50222b91263c6fc6ccac6 Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Sun, 28 Nov 2021 10:01:01 +0100 Subject: [PATCH] New framework release --- Makefile | 18 ++++++++++-------- libs/README.md | 8 +++----- .../org/wikipathways/covid/CreateGPMLRDF.java | 15 +++++++-------- .../main/org/wikipathways/covid/CreateRDF.java | 17 ++++++++++------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index bf08efb..ace6d53 100644 --- a/Makefile +++ b/Makefile @@ -5,17 +5,17 @@ REPORTS := ${shell cat pathways.txt | sed -e 's/\(.*\)/reports\/\1.md/' } SBMLS := ${shell cat pathways.txt | sed -e 's/\(.*\)/sbml\/\1.sbml/' } ${shell cat pathways.txt | sed -e 's/\(.*\)/sbml\/\1.txt/' } SVGS := ${shell cat pathways.txt | sed -e 's/\(.*\)/sbml\/\1.svg/' } -FRAMEWORKVERSION=release-1 +FRAMEWORKVERSION=release-2 WEBSITE := ${shell cat website.txt } all: wikipathways-rdf-wp.zip wikipathways-rdf-gpml.zip install: - @wget -O libs/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar https://github.com/wikipathways/wikipathways-curation-template/releases/download/${FRAMEWORKVERSION}/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar - @wget -O libs/jena-arq-3.17.0.jar https://github.com/wikipathways/wikipathways-curation-template/releases/download/${FRAMEWORKVERSION}/jena-arq-3.17.0.jar + @wget -O libs/GPML2RDF-3.0.0-SNAPSHOT.jar https://github.com/wikipathways/wikipathways-curation-template/releases/download/${FRAMEWORKVERSION}/GPML2RDF-3.0.0-SNAPSHOT.jar @wget -O libs/wikipathways.curator-1-SNAPSHOT-jar-with-dependencies.jar https://github.com/wikipathways/wikipathways-curation-template/releases/download/${FRAMEWORKVERSION}/wikipathways.curator-1-SNAPSHOT-jar-with-dependencies.jar @wget -O libs/slf4j-simple-1.7.32.jar https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-simple/1.7.32/slf4j-simple-1.7.32.jar + @wget -O libs/jena-arq-4.2.0.jar.jar https://repo1.maven.org/maven2/org/apache/jena/jena-arq/4.2.0/jena-arq-4.2.0.jar sbml: ${SBMLS} @@ -56,19 +56,19 @@ sbml/%.svg: sbml/%.sbml wp/Human/%.ttl: gpml/%.gpml src/java/main/org/wikipathways/covid/CreateRDF.class @mkdir -p wp/Human - @cat "$<.rev" | xargs java -cp src/java/main/.:libs/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar:libs/derby-10.14.2.0.jar:libs/slf4j-simple-1.7.32.jar org.wikipathways.covid.CreateRDF $< | grep -v ".bridge" | grep -v "^WARNING" | grep -v "^TODO" | grep -v "^Unknown and unsupported" | grep -v "regulating line is reversible" > $@ + @cat "$<.rev" | xargs java -cp src/java/main/.:libs/GPML2RDF-3.0.0-SNAPSHOT.jar:libs/derby-10.14.2.0.jar:libs/slf4j-simple-1.7.32.jar org.wikipathways.covid.CreateRDF $< $@ wp/gpml/Human/%.ttl: gpml/%.gpml src/java/main/org/wikipathways/covid/CreateGPMLRDF.class @mkdir -p wp/gpml/Human - @cat "$<.rev" | xargs java -cp src/java/main/.:libs/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar:libs/derby-10.14.2.0.jar:libs/slf4j-simple-1.7.32.jar org.wikipathways.covid.CreateGPMLRDF $< | grep -v ".bridge" | grep -v "^WARNING" | grep -v "^TODO" > $@ + @cat "$<.rev" | xargs java -cp src/java/main/.:libs/GPML2RDF-3.0.0-SNAPSHOT.jar:libs/derby-10.14.2.0.jar:libs/slf4j-simple-1.7.32.jar org.wikipathways.covid.CreateGPMLRDF $< $@ src/java/main/org/wikipathways/covid/CreateRDF.class: src/java/main/org/wikipathways/covid/CreateRDF.java @echo "Compiling $@ ..." - @javac -cp libs/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar src/java/main/org/wikipathways/covid/CreateRDF.java + @javac -cp libs/GPML2RDF-3.0.0-SNAPSHOT.jar src/java/main/org/wikipathways/covid/CreateRDF.java src/java/main/org/wikipathways/covid/CreateGPMLRDF.class: src/java/main/org/wikipathways/covid/CreateGPMLRDF.java @echo "Compiling $@ ..." - @javac -cp libs/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar src/java/main/org/wikipathways/covid/CreateGPMLRDF.java + @javac -cp libs/GPML2RDF-3.0.0-SNAPSHOT.jar src/java/main/org/wikipathways/covid/CreateGPMLRDF.java src/java/main/org/wikipathways/covid/CheckRDF.class: src/java/main/org/wikipathways/covid/CheckRDF.java libs/wikipathways.curator-1-SNAPSHOT-jar-with-dependencies.jar @echo "Compiling $@ ..." @@ -91,6 +91,8 @@ index.md: ${REPORTS} echo ".json\">" >> index.md ; \ done -update: +update: install @wget -O Makefile https://raw.githubusercontent.com/wikipathways/wikipathways-curation-template/main/Makefile @wget -O src/java/main/org/wikipathways/covid/CheckRDF.java https://raw.githubusercontent.com/wikipathways/wikipathways-curation-template/main/src/java/main/org/wikipathways/covid/CheckRDF.java + @wget -O src/java/main/org/wikipathways/covid/CreateRDF.java https://raw.githubusercontent.com/wikipathways/wikipathways-curation-template/main/src/java/main/org/wikipathways/covid/CreateRDF.java + @wget -O src/java/main/org/wikipathways/covid/CreateGPMLRDF.java https://raw.githubusercontent.com/wikipathways/wikipathways-curation-template/main/src/java/main/org/wikipathways/covid/CreateGPMLRDF.java diff --git a/libs/README.md b/libs/README.md index 293a8be..da00681 100644 --- a/libs/README.md +++ b/libs/README.md @@ -1,13 +1,11 @@ # Required libraries Java libraries needed for running the tests. They can be downloaded from -https://github.com/wikipathways/wikipathways-curation-template/releases/tag/release-1 +https://github.com/wikipathways/wikipathways-curation-template/releases/ Get the libraries with: ``` -wget https://github.com/wikipathways/wikipathways-curation-template/releases/download/release-1/GPML2RDF-3.0.0-SNAPSHOT-jar-with-dependencies.jar -wget https://github.com/wikipathways/wikipathways-curation-template/releases/download/release-1/jena-arq-3.17.0.jar -wget https://github.com/wikipathways/wikipathways-curation-template/releases/download/release-1/wikipathways.curator-1-SNAPSHOT-jar-with-dependencies.jar -wget -O slf4j-simple-1.7.32.jar https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-simple/1.7.32/slf4j-simple-1.7.32.jar +cd .. +make install ``` diff --git a/src/java/main/org/wikipathways/covid/CreateGPMLRDF.java b/src/java/main/org/wikipathways/covid/CreateGPMLRDF.java index da9b736..cb9e1e1 100644 --- a/src/java/main/org/wikipathways/covid/CreateGPMLRDF.java +++ b/src/java/main/org/wikipathways/covid/CreateGPMLRDF.java @@ -3,9 +3,9 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.ByteArrayOutputStream; import java.util.Collections; import org.bridgedb.DataSource; @@ -18,25 +18,24 @@ import org.wikipathways.wp2rdf.GpmlConverter; import org.wikipathways.wp2rdf.WPREST2RDF; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; +import org.apache.jena.rdf.model.Model; public class CreateGPMLRDF { public static void main(String[] args) throws Exception { String gpmlFile = args[0]; String wpid = gpmlFile.substring(5,11); - String rev = args[1]; + String rev = args[2]; + String outFile = args[1]; InputStream input = new FileInputStream(gpmlFile); Pathway pathway = PathwayReader.readPathway(input); input.close(); - Model model = ModelFactory.createDefaultModel(); - GpmlConverter.convertGpml(pathway, wpid, rev, model); - ByteArrayOutputStream output = new ByteArrayOutputStream(); + Model model = GpmlConverter.convertGpml(pathway, wpid, rev, Collections.emptyList()); + FileOutputStream output = new FileOutputStream(outFile); model.write(output, "TURTLE"); - System.out.print(new String(output.toByteArray())); + output.close(); } } diff --git a/src/java/main/org/wikipathways/covid/CreateRDF.java b/src/java/main/org/wikipathways/covid/CreateRDF.java index 47e4eb4..5cb56e7 100644 --- a/src/java/main/org/wikipathways/covid/CreateRDF.java +++ b/src/java/main/org/wikipathways/covid/CreateRDF.java @@ -3,9 +3,9 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.ByteArrayOutputStream; import java.util.Collections; import org.bridgedb.DataSource; @@ -18,24 +18,27 @@ import org.wikipathways.wp2rdf.GpmlConverter; import org.wikipathways.wp2rdf.WPREST2RDF; -import com.hp.hpl.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Model; public class CreateRDF { public static void main(String[] args) throws Exception { String gpmlFile = args[0]; String wpid = gpmlFile.substring(5,11); - String rev = args[1]; + String rev = args[2]; + String outFile = args[1]; + DataSourceTxt.init(); - // the next line is needed until BridgeDb gets updated InputStream input = new FileInputStream(gpmlFile); Pathway pathway = PathwayReader.readPathway(input); + input.close(); + IDMapperStack stack = WPREST2RDF.maps(); Model model = GpmlConverter.convertWp(pathway, wpid, rev, stack, Collections.emptyList()); - input.close(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); + FileOutputStream output = new FileOutputStream(outFile); model.write(output, "TURTLE"); - System.out.print(new String(output.toByteArray())); + output.flush(); + output.close(); } }