From 5348517df7f62ce81d33e388f70e97cba680f679 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 12 May 2020 14:11:31 -0500 Subject: Update graph script --- doc/INSTALL.md | 5 ++++- scripts/update_virtuoso/check_for_updates.py | 31 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index e68b81a..8f4b2f0 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -29,9 +29,12 @@ arvados-python-client-2.0.1 ciso8601-2.1.3 future-0.18.2 google-api-python-clien 3. Run the tool directly with ```sh -guix environment guix --ad-hoc git python openssl python-pycurl python-magic nss-certs -- python3 bh20sequploader/main.py example/sequence.fasta example/metadata.yaml +guix environment guix --ad-hoc git python openssl python-pycurl python-magic nss-certs python-pyshex -- python3 bh20sequploader/main.py example/sequence.fasta example/metadata.yaml ``` +Note that python-pyshex is packaged in +http://git.genenetwork.org/guix-bioinformatics/guix-bioinformatics + ### Using the Web Uploader To run the web uploader in a GNU Guix environment/container diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py index f3b8a86..1c7813a 100755 --- a/scripts/update_virtuoso/check_for_updates.py +++ b/scripts/update_virtuoso/check_for_updates.py @@ -10,6 +10,25 @@ import requests import time +def upload(fn): + # Upload into Virtuoso using CURL + # cmd = "curl -X PUT --digest -u dba:dba -H Content-Type:text/turtle -T metadata.ttl -G http://localhost:8890/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph".split(" ") + print("DELETE "+fn) + cmd = ("curl --digest --user dba:dba --verbose --url -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph -X DELETE" % pwd).split(" ") + print(cmd) + p = subprocess.Popen(cmd) + output = p.communicate()[0] + print(output) + assert(p.returncode == 0) + + print("UPLOAD "+fn) + cmd = ("curl -X PUT --digest -u dba:%s -H Content-Type:text/turtle -T %s -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph" % pwd, fn ).split(" ") + print(cmd) + p = subprocess.Popen(cmd) + output = p.communicate()[0] + print(output) + assert(p.returncode == 0) + url = 'https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl' # --- Fetch headers from TTL file on Arvados r = requests.head(url) @@ -45,15 +64,9 @@ if stamp != last_modified_str: with open("metadata.ttl", "w") as f: f.write(r.text) f.close - # Now push into Virtuoso using CURL - # cmd = "curl -X PUT --digest -u dba:dba -H Content-Type:text/turtle -T metadata.ttl -G http://localhost:8890/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph".split(" ") - print("Push metadata TTL") - cmd = ("curl -X PUT --digest -u dba:%s -H Content-Type:text/turtle -T metadata.ttl -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph" % pwd ).split(" ") - print(cmd) - p = subprocess.Popen(cmd) - output = p.communicate()[0] - print(output) - assert(p.returncode == 0) + upload("metadata.ttl") + upload("semantic_enrichment/labels.ttl") + upload("semantic_enrichment/countries.ttl") with open(fn,"w") as f: f.write(last_modified_str) -- cgit v1.2.3