From 76be1c0da7593ae61c0935747d21b1ff5a844985 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Tue, 21 Jul 2020 11:26:16 +0100
Subject: Sample date and specimen
---
bh20simplewebuploader/api.py | 24 +++++++++++++++---------
bh20simplewebuploader/templates/ebi-sample.xml | 4 ++--
2 files changed, 17 insertions(+), 11 deletions(-)
(limited to 'bh20simplewebuploader')
diff --git a/bh20simplewebuploader/api.py b/bh20simplewebuploader/api.py
index ff82b72..65435ea 100644
--- a/bh20simplewebuploader/api.py
+++ b/bh20simplewebuploader/api.py
@@ -15,14 +15,18 @@ def fetch_sample_metadata(id):
PREFIX sio:
PREFIX edam:
PREFIX efo:
- select distinct ?id ?seq ?info ?sequencer
+ PREFIX evs:
+ PREFIX obo:
+ select distinct ?id ?seq ?date ?info ?specimen ?sequencer
{
- ?sample sio:SIO_000115 "%s" .
- ?sample sio:SIO_000115 ?id .
- ?seq pubseq:technology ?tech .
- ?seq pubseq:sample ?sample .
- ?sample edam:data_2091 ?info .
- ?tech efo:EFO_0002699 ?sequencer .
+ ?sample sio:SIO_000115 "%s" ;
+ sio:SIO_000115 ?id ;
+ evs:C25164 ?date .
+ ?seq pubseq:technology ?tech ;
+ pubseq:sample ?sample .
+ ?tech efo:EFO_0002699 ?sequencer .
+ optional { ?sample edam:data_2091 ?info } .
+ optional { ?sample obo:OBI_0001479 ?specimen } .
} limit 5
""" % id
payload = {'query': query, 'format': 'json'}
@@ -39,19 +43,21 @@ def version():
def sample(id):
# metadata = file.name(seq)+"/metadata.yaml"
meta = fetch_sample_metadata(id)
+ print(meta)
return jsonify([{
'id': x['id']['value'],
'fasta': x['seq']['value'],
'collection': os.path.dirname(x['seq']['value']),
+ 'date': x['date']['value'],
'info': x['info']['value'],
+ 'specimen': x['specimen']['value'],
'sequencer': x['sequencer']['value'],
} for x in meta])
@app.route('/api/ebi/sample-.xml', methods=['GET'])
def ebi_sample(id):
meta = fetch_sample_metadata(id)[0]
- print("HERE",meta,file=sys.stderr)
- page = render_template('ebi-sample.xml',sampleid=id,sequencer=meta['sequencer']['value'])
+ page = render_template('ebi-sample.xml',sampleid=id,sequencer=meta['sequencer']['value'],date=meta['date']['value'],specimen=meta['specimen']['value'])
return page
@app.route('/api/search', methods=['GET'])
diff --git a/bh20simplewebuploader/templates/ebi-sample.xml b/bh20simplewebuploader/templates/ebi-sample.xml
index 0b6b39e..7ede833 100644
--- a/bh20simplewebuploader/templates/ebi-sample.xml
+++ b/bh20simplewebuploader/templates/ebi-sample.xml
@@ -18,7 +18,7 @@
collection date
- {{ time }}
+ {{ date }}
geographic location (latitude)
@@ -40,7 +40,7 @@
environment (material)
- {{ material }}
+ {{ specimen }}
ENA-CHECKLIST
--
cgit v1.2.3