From 80954e51a20e25e03b7f8b3fcb9e8ca7f675c068 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 11 Nov 2020 17:23:30 +0000 Subject: Fix resolving permalinks such as http://covid19.genenetwork.org/resource/MT326090.1 --- bh20simplewebuploader/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bh20simplewebuploader') 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/') 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'] -- cgit v1.2.3