From 20cbfb593e89b07d68e6c16106a24e79cea61329 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Sun, 19 Jul 2020 11:30:28 +0100
Subject: Moch XML output
---
bh20simplewebuploader/main.py | 10 +++-
bh20simplewebuploader/static/main.js | 5 +-
bh20simplewebuploader/templates/ebi-sample.xml | 68 ++++++++++++++++++++++++++
bh20simplewebuploader/templates/export.html | 2 +-
4 files changed, 81 insertions(+), 4 deletions(-)
create mode 100644 bh20simplewebuploader/templates/ebi-sample.xml
(limited to 'bh20simplewebuploader')
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 673f913..d524efe 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -696,12 +696,13 @@ def search():
query = """
PREFIX pubseq:
PREFIX sio:
- select distinct ?id ?seq
+ PREFIX edam:
+ select distinct ?id ?seq ?info
{
?sample sio:SIO_000115 "%s" .
?sample sio:SIO_000115 ?id .
?seq pubseq:sample ?sample .
- ?sample ?p ?o .
+ ?sample edam:data_2091 ?info .
} limit 100
""" % s
payload = {'query': query, 'format': 'json'}
@@ -711,6 +712,7 @@ def search():
return jsonify([{
'id': x['id']['value'],
'seq': x['seq']['value'],
+ 'info': x['info']['value'],
} for x in result])
@app.route('/api/getAllaccessions', methods=['GET'])
@@ -934,3 +936,7 @@ def getSEQbyLocationAndSpecimenSource():
r = requests.get(baseURL, params=payload)
result = r.json()['results']['bindings']
return str(result)
+
+@app.route('/api/ebi-sample.xml', methods=['GET'])
+def ebi_sample():
+ return render_template('ebi-sample.xml')
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
index 208823a..deda6ec 100644
--- a/bh20simplewebuploader/static/main.js
+++ b/bh20simplewebuploader/static/main.js
@@ -18,10 +18,13 @@ function toDIVTable(rows) {
else {
html = '
';
rows.forEach(row => {
+ id = row['id'];
seq = row['seq'];
+ info = row['info'];
html += '
';
});
html += '
';
diff --git a/bh20simplewebuploader/templates/ebi-sample.xml b/bh20simplewebuploader/templates/ebi-sample.xml
new file mode 100644
index 0000000..694c471
--- /dev/null
+++ b/bh20simplewebuploader/templates/ebi-sample.xml
@@ -0,0 +1,68 @@
+
+
+
+ human gastric microbiota, mucosal
+
+ 1284369
+ stomach metagenome
+
+
+
+
+ investigation type
+ mimarks-survey
+
+
+ sequencing method
+ pyrosequencing
+
+
+ collection date
+ 2010
+
+
+ host body site
+ Mucosa of stomach
+
+
+ human-associated environmental package
+ human-associated
+
+
+ geographic location (latitude)
+ 1.81
+ DD
+
+
+ geographic location (longitude)
+ -78.76
+ DD
+
+
+ geographic location (country and/or sea)
+ Colombia
+
+
+ geographic location (region and locality)
+ Tumaco
+
+
+ environment (biome)
+ coast
+
+
+ environment (feature)
+ human-associated habitat
+
+
+ environment (material)
+ gastric biopsy
+
+
+ ENA-CHECKLIST
+ ERC000011
+
+
+
+
+
diff --git a/bh20simplewebuploader/templates/export.html b/bh20simplewebuploader/templates/export.html
index 1f0d9b7..aaceac9 100644
--- a/bh20simplewebuploader/templates/export.html
+++ b/bh20simplewebuploader/templates/export.html
@@ -31,7 +31,7 @@
-
+