aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2020-05-12 14:11:31 -0500
committerPjotr Prins2020-05-12 14:11:31 -0500
commit5348517df7f62ce81d33e388f70e97cba680f679 (patch)
tree42d5966b81904149ba9dff6f74e7dc31624bb147
parent8e9042879db7fe061f3d18737f4102b5fd0b8c65 (diff)
downloadbh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.tar.gz
bh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.tar.lz
bh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.zip
Update graph script
-rw-r--r--doc/INSTALL.md5
-rwxr-xr-xscripts/update_virtuoso/check_for_updates.py31
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)