aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/main.py
diff options
context:
space:
mode:
authorPjotr Prins2020-11-11 17:23:30 +0000
committerPjotr Prins2020-11-11 17:24:41 +0000
commit80954e51a20e25e03b7f8b3fcb9e8ca7f675c068 (patch)
tree3ba0688c92a4516bdac63fa11e02925ccae3deef /bh20simplewebuploader/main.py
parent8039f9f7989bb8000f88738ede20d934dde70c2c (diff)
downloadbh20-seq-resource-80954e51a20e25e03b7f8b3fcb9e8ca7f675c068.tar.gz
bh20-seq-resource-80954e51a20e25e03b7f8b3fcb9e8ca7f675c068.tar.lz
bh20-seq-resource-80954e51a20e25e03b7f8b3fcb9e8ca7f675c068.zip
Fix resolving permalinks such as http://covid19.genenetwork.org/resource/MT326090.1
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r--bh20simplewebuploader/main.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 1d12d9e..0495613 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -688,6 +688,9 @@ sparqlURL='http://sparql.genenetwork.org/sparql/'
##
# Example http://covid19.genenetwork.org/resource/MT326090.1
+# http://localhost:5067/resource/lugli-4zz18-oixhf5jl3lqlegz
+# http://localhost:5067/resource/MT326090.1
+#
# Example http://host/resource/SRR11621868
@app.route('/resource/<id>')
def resource(id):
@@ -735,9 +738,11 @@ union
logging.info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
# return jsonify({'sequences': int(result[0]["num"]["value"])})
sequenceuri=sample['sequenceuri']['value']
+ # http://covid19.genenetwork.org/resource/lugli-4zz18-gx0ifousk9yu0ql
m = re.match(r"http://collections.lugli.arvadosapi.com/c=([^/]*)/sequence.fasta|http://covid19.genenetwork.org/resource/(.*)", sequenceuri)
- fastauri = "http://collections.lugli.arvadosapi.com/c=%s/sequence.fasta" % m.group(1)
- metauri = "http://collections.lugli.arvadosapi.com/c=%s/metadata.yaml" % m.group(1)
+ collection = m.group(1) or m.group(2)
+ fastauri = f"http://collections.lugli.arvadosapi.com/c={collection}/sequence.fasta"
+ metauri = f"http://collections.lugli.arvadosapi.com/c={collection}/metadata.yaml"
locationuri=sample['geo']['value']
location=sample['geoname']['value']
date=sample['date']['value']