aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-01-10 16:16:53 +0300
committerBonfaceKilz2024-01-10 16:24:41 +0300
commit30aa8d69884ea4f1904a424fde8a4083bc35a7d1 (patch)
tree821905dbe51f70c4e65e1458ce6e17cc8439861f
parentf5066b2dd2043002d2415fd44e70bf01e506d471 (diff)
downloadgenenetwork2-30aa8d69884ea4f1904a424fde8a4083bc35a7d1.tar.gz
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 <me@bonfacemunyoki.com>
-rw-r--r--gn2/wqflask/templates/genotype.html74
-rw-r--r--gn2/wqflask/views.py6
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 %}
<style type="text/css">
.page-header {
- text-underline-offset: 0.5rem;
padding: 1em;
}
</style>
@@ -13,58 +12,44 @@
{% block content %}
-<h1 class="page-header">
- {% if metadata.name %}
- <u>Genotype: {{ metadata.name }}</u>
- {% else %}
- {{ name }}
- {% endif %}
-</h1>
+<h2 class="page-header">
+ Genotype: {{ metadata.name or name }}
+</h2>
<div class="container">
<table class="table">
- {% if metadata.datasetName %}
- <tr>
- <td><b>Dataset: </b></td>
- <td>
- <a href="{{ metadata.genotypeOfDataset }}" target="_blank">{{ metadata.datasetName }}</a>
- </td>
- </tr>
- {% endif %}
-
- {% if metadata.inbredSetName %}
- <tr>
- <td><b>Group</b></td>
- <td>{{ metadata.inbredSetName }}</td>
- </tr>
- {% endif %}
-
- <tr>
+ {% if metadata.dataset.group and metadata.species %}
+ <tr>
+ <td><b>Group</b></td>
+ <td>{{ metadata.dataset.group }}: {{ metadata.species.speciesName }}</td>
+ </tr>
+ {% elif metadata.species %}
+ <tr>
<td><b>Species</b></td>
- <td>{{ metadata.species or "N/A"}}</td>
- </tr>
+ <td>{{ metadata.species.speciesName }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.chr and metadata.mb %}
<tr>
<td><b>Location</b></td>
- <td>Chr {{ metadata.ch }} @ {{ metadata.mb }} mb </td>
+ <td>Chr {{ metadata.chr }} @ {{ metadata.mb }} mb </td>
</tr>
- {% if metadata.cM %}
+ {% endif %}
+ {% if metadata.dataset %}
<tr>
- <td><b>cM</b></td>
- <td>{{ metadata.cM }}</td>
- </tr>
- {% endif %}
-
- {% if metadata.mb %}
- <tr>
- <td><b>mb</b></td>
- <td>{{ metadata.mb }}</td>
+ <td><b>Database </b></td>
+ <td>
+ <a href={{ url_for("get_dataset", name= metadata.dataset.name) }} target="_blank">
+ {{ metadata.dataset.prefLabel }}
+ </a>
+ </td>
</tr>
- {% endif %}
-
+ {% endif %}
{% if metadata.sequence %}
<tr>
<td><b>Sequence</b></td>
- <td>metadata.sequence</td>
+ <td style="inline-size: fit-content; writing-mode: horizontal-tb; overflow-wrap: break-word; max-width: 70vw;">{{ metadata.sequence }}</td>
</tr>
{% endif %}
@@ -74,13 +59,6 @@
<td>{{ metadata.source}}</td>
</tr>
{% endif %}
-
- {% if metadata.markerName %}
- <tr>
- <td><b>Marker Name</b></td>
- <td>{{ metadata.markerName}}</td>
- </tr>
- {% endif %}
</table>
</div>
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/<name>", methods=('GET',))
-def get_genotype(name):
+@app.route("/genotypes/<dataset>/<name>", 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,
)