aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader
diff options
context:
space:
mode:
authorPeter Amstutz2020-11-09 17:20:27 -0500
committerPeter Amstutz2020-11-09 17:20:27 -0500
commit1082b907d816f5da52aba6233073737632d0242f (patch)
tree8ad59d268234bbea42b3d6b42bd2d352eb56df28 /bh20simplewebuploader
parentb5143c79de268b844f3a6a63d92c6389b047f35e (diff)
downloadbh20-seq-resource-1082b907d816f5da52aba6233073737632d0242f.tar.gz
bh20-seq-resource-1082b907d816f5da52aba6233073737632d0242f.tar.lz
bh20-seq-resource-1082b907d816f5da52aba6233073737632d0242f.zip
Make resource link work for both portable data hashes and sample id
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r--bh20simplewebuploader/main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 73503b4..405544c 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -675,13 +675,27 @@ sparqlURL='http://sparql.genenetwork.org/sparql/'
@app.route('/resource/<id>')
def resource(id):
"""Get a COVID19 resource using identifier"""
+
query=f"""
PREFIX pubseq: <http://biohackathon.org/bh20-seq-schema#MainSchema/>
PREFIX sio: <http://semanticscience.org/resource/>
select distinct ?sample ?geoname ?date ?source ?geo ?sampletype ?institute ?sequenceuri
+where {{
{{
?sample sio:SIO_000115 "{id}" .
?sequenceuri pubseq:sample ?sample .
+}}
+union
+{{
+ <http://collections.lugli.arvadosapi.com/c={id}/sequence.fasta> pubseq:sample ?sample .
+ ?sequenceuri pubseq:sample ?sample .
+}}
+union
+{{
+ <http://covid19.genenetwork.org/resource/{id}> pubseq:sample ?sample .
+ ?sequenceuri pubseq:sample ?sample .
+}}
+
?sample <http://purl.obolibrary.org/obo/GAZ_00000448> ?geo .
?geo rdfs:label ?geoname .
?sample <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25164> ?date .