From 30aa8d69884ea4f1904a424fde8a4083bc35a7d1 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 10 Jan 2024 16:16:53 +0300 Subject: Add dataset metadata to genotype page when a dataset is specified. * gn2/wqflask/templates/genotype.html: Add extra dataset metadata. * gn2/wqflask/views.py (get_genotype): Extend genotype URL to enable specifying the dataset name. Signed-off-by: Munyoki Kilyungi --- gn2/wqflask/templates/genotype.html | 74 +++++++++++++------------------------ gn2/wqflask/views.py | 6 ++- 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/gn2/wqflask/templates/genotype.html b/gn2/wqflask/templates/genotype.html index fc5b1ad7..0d39257f 100644 --- a/gn2/wqflask/templates/genotype.html +++ b/gn2/wqflask/templates/genotype.html @@ -3,7 +3,6 @@ {% block css %} @@ -13,58 +12,44 @@ {% block content %} -

- {% if metadata.name %} - Genotype: {{ metadata.name }} - {% else %} - {{ name }} - {% endif %} -

+
- {% if metadata.datasetName %} - - - - - {% endif %} - - {% if metadata.inbredSetName %} - - - - - {% endif %} - - + {% if metadata.dataset.group and metadata.species %} + + + + + {% elif metadata.species %} + - - + + + {% endif %} + + {% if metadata.chr and metadata.mb %} - + - {% if metadata.cM %} + {% endif %} + {% if metadata.dataset %} - - - - {% endif %} - - {% if metadata.mb %} - - - + + - {% endif %} - + {% endif %} {% if metadata.sequence %} - + {% endif %} @@ -74,13 +59,6 @@ {% endif %} - - {% if metadata.markerName %} - - - - - {% endif %}
Dataset: - {{ metadata.datasetName }} -
Group{{ metadata.inbredSetName }}
Group{{ metadata.dataset.group }}: {{ metadata.species.speciesName }}
Species{{ metadata.species or "N/A"}}
{{ metadata.species.speciesName }}
LocationChr {{ metadata.ch }} @ {{ metadata.mb }} mb Chr {{ metadata.chr }} @ {{ metadata.mb }} mb
cM{{ metadata.cM }}
mb{{ metadata.mb }}Database + + {{ metadata.dataset.prefLabel }} + +
Sequencemetadata.sequence{{ metadata.sequence }}
{{ metadata.source}}
Marker Name{{ metadata.markerName}}
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index 41895f89..3fbda913 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -1209,7 +1209,10 @@ def get_probeset(name, dataset=None): @app.route("/genotypes/", methods=('GET',)) -def get_genotype(name): +@app.route("/genotypes//", methods=('GET',)) +def get_genotype(name, dataset=None): + if dataset: + name = f"{dataset}/{name}" metadata = requests.get( urljoin( GN3_LOCAL_URL, @@ -1217,6 +1220,7 @@ def get_genotype(name): ).json() return render_template( "genotype.html", + name=name, metadata=metadata, ) -- cgit v1.2.3