aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader
diff options
context:
space:
mode:
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r--bh20simplewebuploader/api.py24
-rw-r--r--bh20simplewebuploader/templates/ebi-sample.xml4
2 files changed, 17 insertions, 11 deletions
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: <http://semanticscience.org/resource/>
PREFIX edam: <http://edamontology.org/>
PREFIX efo: <http://www.ebi.ac.uk/efo/>
- select distinct ?id ?seq ?info ?sequencer
+ PREFIX evs: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
+ PREFIX obo: <http://purl.obolibrary.org/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-<id>.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 @@
</SAMPLE_ATTRIBUTE>
<SAMPLE_ATTRIBUTE>
<TAG>collection date</TAG>
- <VALUE>{{ time }}</VALUE>
+ <VALUE>{{ date }}</VALUE>
</SAMPLE_ATTRIBUTE>
<SAMPLE_ATTRIBUTE>
<TAG>geographic location (latitude)</TAG>
@@ -40,7 +40,7 @@
</SAMPLE_ATTRIBUTE>
<SAMPLE_ATTRIBUTE>
<TAG>environment (material)</TAG>
- <VALUE>{{ material }}</VALUE>
+ <VALUE>{{ specimen }}</VALUE>
</SAMPLE_ATTRIBUTE>
<SAMPLE_ATTRIBUTE>
<TAG>ENA-CHECKLIST</TAG>