diff options
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r-- | bh20simplewebuploader/main.py | 25 | ||||
-rw-r--r-- | bh20simplewebuploader/static/main.js | 10 |
2 files changed, 19 insertions, 16 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 4ec3251..92cea2e 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -669,7 +669,7 @@ def contact_page(): sparqlURL='http://sparql.genenetwork.org/sparql/' ## -# Example http://host/resource/MT326090.1 +# Example http://covid19.genenetwork.org/resource/MT326090.1 # Example http://host/resource/SRR11621868 @app.route('/resource/<id>') def resource(id): @@ -842,10 +842,13 @@ def getSEQbyLocation(): @app.route('/api/getSEQCountbyLocation', methods=['GET']) def getSEQCountbyLocation(): - query="""SELECT ?geoLocation ?geoLocation_label (count(?fasta) as ?fastaCount) WHERE - {?fasta ?x [<http://purl.obolibrary.org/obo/GAZ_00000448> ?geoLocation] . - Optional {?geoLocation <http://www.w3.org/2000/01/rdf-schema#label> ?geoLocation_tmp_label} - BIND(IF(BOUND(?geoLocation_tmp_label), ?geoLocation_tmp_label, ?geoLocation) as ?geoLocation_label)} + query=""" + SELECT ?geoLocation ?geoLocation_label (count(?fasta) as ?fastaCount) WHERE + { + ?fasta ?x [<http://purl.obolibrary.org/obo/GAZ_00000448> ?geoLocation] . + Optional {?geoLocation <http://www.w3.org/2000/01/rdf-schema#label> ?geoLocation_tmp_label} + BIND(IF(BOUND(?geoLocation_tmp_label), ?geoLocation_tmp_label, ?geoLocation) as ?geoLocation_label) + } GROUP BY ?geoLocation ?geoLocation_label ORDER BY DESC (?fastaCount) """ payload = {'query': query, 'format': 'json'} @@ -878,11 +881,13 @@ def getSEQCountbyContinent(): @app.route('/api/getSEQCountbyCountryContinent', methods=['GET']) def getSEQCountbyCountryContinent(): - query="""SELECT DISTINCT ?location ?location_label (count(?fasta) as ?fastaCount) WHERE { - ?fasta ?x[ <http://purl.obolibrary.org/obo/GAZ_00000448> ?location] . - ?location <http://www.wikidata.org/prop/direct/P30> <placeholder> . - OPTIONAL { ?location rdfs:label ?key_tmp_label } - BIND(IF(BOUND(?key_tmp_label),?key_tmp_label, ?location) as ?location_label) + query=""" + SELECT DISTINCT ?location ?location_label (count(?fasta) as ?fastaCount) WHERE + { + ?fasta ?x[ <http://purl.obolibrary.org/obo/GAZ_00000448> ?location] . + ?location <http://www.wikidata.org/prop/direct/P30> <placeholder> . + OPTIONAL { ?location rdfs:label ?key_tmp_label } + BIND(IF(BOUND(?key_tmp_label),?key_tmp_label, ?location) as ?location_label) } GROUP BY ?location ?location_label """ diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index c0bc23f..6e63ed3 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -72,9 +72,11 @@ function fetchHTMLTable(apiEndPoint) { for (var i=0; i<data.length;i++) { htmlString=htmlString+"<tr><td><a href='#' onclick='fetchSEQByLocation(\""+data[i]["key"]+"\");'>"+data[i]["label"]+"</a></td><td>"+data[i]["count"]+"<td></tr>" } -*/ + */ for (var i=0; i<data.length;i++) { - htmlString=htmlString+"<tr><td>"+data[i]["label"]+"</td><td>"+data[i]["count"]+"<td></tr>" + let url = data[i]["key"]; + let label = data[i]["label"]; + htmlString=htmlString+"<tr><td><a href=\""+url+"\">"+label+"</a></td><td>"+data[i]["count"]+"<td></tr>" } htmlString=htmlString+"</table>" @@ -143,10 +145,6 @@ let fetchMap = () => { updateMapMarkers(); }; -let fetchSEQCountbyLocation = () => { - fetchHTMLTable("/api/getSEQCountbyLocation"); -}; - let fetchSEQByLocation = () => { console.log("Missing - set parameter for request, retrieve data") }; |