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 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
(limited to 'bh20simplewebuploader/api.py')
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'])
--
cgit v1.2.3