diff options
author | Munyoki Kilyungi | 2022-10-26 18:20:08 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-11-10 09:00:04 +0300 |
commit | 97f5ab24e8ff8df638b5320058e8f0d815c28ed4 (patch) | |
tree | ae5f4416ca1a89335879f1758305401c6a9f9fa2 | |
parent | e76f723104a1c9b4e3fc0f529e890debad8584cb (diff) | |
download | genenetwork2-97f5ab24e8ff8df638b5320058e8f0d815c28ed4.tar.gz |
Display a dataset's metadata in the "Trait Data and Analysis" page
* wqflask/wqflask/static/new/css/show_trait.css: Show a pointer when a
user hovers over summary data. Add extra styling for the metadata
table.
* wqflask/wqflask/templates/search_result_page.html: Replace
dataset.accession_id with metadata.accession_id.
* wqflask/wqflask/templates/show_metadata_details.html: New template.
file that displays a dataset's metadata in tabular form.
* wqflask/wqflask/templates/show_trait.html: Sub-template
'show_metadata_details' conditionally.
* wqflask/wqflask/views.py (show_trait_page): Explicitly pass metadata
as a dictionary to the template.
-rw-r--r-- | wqflask/wqflask/static/new/css/show_trait.css | 17 | ||||
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_metadata_details.html | 186 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait.html | 14 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 11 |
5 files changed, 229 insertions, 5 deletions
diff --git a/wqflask/wqflask/static/new/css/show_trait.css b/wqflask/wqflask/static/new/css/show_trait.css index 3780a8f1..2ce07fec 100644 --- a/wqflask/wqflask/static/new/css/show_trait.css +++ b/wqflask/wqflask/static/new/css/show_trait.css @@ -6,6 +6,23 @@ table.dataTable tbody tr.selected { background-color: #ffee99; } +table.metadata { + table-layout: fixed; +} + +table.metadata td:nth-child(1) { + width: 10%; +} + +table summary b { + cursor: pointer; + text-decoration: underline; +} + +table details[open] { + width: 80%; +} + #bar_chart_container { overflow-x:scroll; } diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 2bcfe92b..3a6f6e91 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -17,7 +17,7 @@ <div style="padding-top: 10px; padding-bottom: 10px; font-size: 16px;"> <!-- Need to customize text more for other types of searches --> - <p>We searched <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&{% if not dataset.accession_id %}GN_AccessionId={{ dataset.accession_id }}{% else %}InfoPageName={{ dataset.name }}{% endif %}">{{ dataset.fullname }}</a> + <p>We searched <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&{% if metadata.accession_id %}GN_AccessionId={{ metadata.accession_id }}{% else %}InfoPageName={{ dataset.name }}{% endif %}">{{ dataset.fullname }}</a> <br> to find all records {% if go_term is not none %} @@ -97,8 +97,8 @@ <input type="hidden" name="database_name" id="database_name" value="{{ dataset.fullname }}"> <input type="hidden" name="file_name" id="file_name" value="search_results"> <input type="hidden" name="filter_term" id="filter_term" value="None"> - {% if dataset.accession_id is defined %} - <input type="hidden" name="accession_id" id="accession_id" value="{{ dataset.accession_id }}"> + {% if metadata.accession_id %} + <input type="hidden" name="accession_id" id="accession_id" value="{{ metadata.accession_id }}"> {% endif %} <input type="hidden" name="export_data" id="export_data" value=""> <input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search For..."> diff --git a/wqflask/wqflask/templates/show_metadata_details.html b/wqflask/wqflask/templates/show_metadata_details.html new file mode 100644 index 00000000..36b0f9b5 --- /dev/null +++ b/wqflask/wqflask/templates/show_metadata_details.html @@ -0,0 +1,186 @@ +<table class="table metadata"> + {% if metadata.accession_id %} + <tr> + <td><b>Title:</b></td> + <td><div>{{ metadata.accession_id }} {% if metadata.title %}: {{ metadata.title }} {% endif %}</div></td> + </tr> + {% endif %} + + {% if metadata.geo_series %} + <tr> + <td><b>Geo Series:</b></td> + <td><div>{{ metadata.geo_series|safe }}</div></td> + </tr> + {% endif %} + + {% if metadata.dataset_group %} + <tr> + <td><b>Dataset Group:</b></td> + <td><div>{{ metadata.dataset_group }}</div></td> + </tr> + {% endif %} + + {% if metadata.species_name %} + <tr> + <td><b>Species:</b></td> + <td><div>{{ metadata.species_name }}</div></td> + </tr> + {% endif %} + + {% if metadata.inbred_set_name %} + <tr> + <td><b>Group:</b></td> + <td><div>{{ metadata.inbred_set_name }}</div></td> + </tr> + {% endif %} + + {% if metadata.investigators %} + <tr> + <td><b>Investigator(s):</b></td> + <td><div>{{ metadata.investigators.name }}, {{ metadata.investigators.city }}, {{ metadata.investigators.country }} </div></td> + </tr> + {% endif %} + + {% if metadata.tissue_name %} + <tr> + <td><b>Tissue:</b></td> + <td> + {% if metadata.about_tissue %} + <div></div> + <details> + <summary><b title="Click to view tissue information">{{ metadata.tissue_name }}</b></summary> + <b>About the tissue used to generate this set of data:</b> + <div>{{ metadata.about_tissue|safe }}</div> + </details> + {% else %} + {{ metadata.tissue_name }} + {% endif %} + </td> + </tr> + {% endif %} + + {% if metadata.platform_name %} + <tr> + <td><b>Platforms:</b></td> + <td> + {% if metadata.about_platform %} + <details> + <summary><b title="Click to view platform information">{{ metadata.platform_name }}</b></summary> + <b>About the array platform:</b> + {{ metadata.about_platform|safe }} + </details> + {% else %} + {{ metadata.platform_name }} + {% endif %} + </td> + </tr> + {% endif %} + + {% if metadata.normalization_name %} + <tr> + <td><b>Normalization:</b></td> + <td> + {{ metadata.normalization_name }} + </td> + </tr> + {% endif %} + + {% if metadata.summary %} + <tr> + <td></td> + <td> + <details> + <summary><b title="Click to view summary">Summary</b></summary> + {{ metadata.summary|safe }} + </details> + </td> + </tr> + {% endif %} + + + {% if metadata.about_cases %} + <tr> + <td></td> + <td> + <details> + <summary><b title="Click to view case information">About the cases used to generate this set of data</b></summary> + {{ metadata.about_cases|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.about_data_processing %} + <tr> + <td></td> + <td> + <details> + <summary><b title="Click to view data values and processing">About Data Values and Data Processing</b></summary> + {{ metadata.about_data_processing.value|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.notes %} + <tr> + <td></td> + <td> + <details> + <summary><b>Notes</b></summary> + {{ metadata.notes|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.experiment_design %} + <tr> + <td></td> + <td> + <details> + <summary><b>Experiment Type</b></summary> + {{ metadata.experiment_design|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.contributors %} + <tr> + <td></td> + <td> + <details> + <summary><b>Contributor(s)</b></summary> + {{ metadata.contributors|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.citation %} + <tr> + <td> + <td> + <details> + <summary><b>Citation</b></summary> + {{ metadata.citation|safe }} + </details> + </td> + </tr> + {% endif %} + + {% if metadata.acknowledgment %} + <tr> + <td></td> + <td> + <details> + <summary><b>Data source acknowledgment</b></summary> + {{ metadata.acknowledgment|safe }} + </details> + </td> + </tr> + {% endif %} + + +</table> diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 0f93188b..4b92545c 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -51,8 +51,20 @@ <div class="panel-body"> {% include 'show_trait_details.html' %} </div> + </div> + {% if metadata.accession_id %} + <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" data-target="#collapseMeta"> + <h3 class="panel-title"> + <span class="glyphicon glyphicon-chevron-down"></span> Data Set Group: {{ dataset.fullname }} + </h3> </div> - </div> + <div id="collapseMeta" class="panel-collapse collapse in"> + <div class="panel-body"> + {% include 'show_metadata_details.html' %} + </div> + </div> + {% endif %} + </div> <div class="panel panel-default"> <div class="panel-heading stats_panel" data-toggle="collapse" data-parent="#accordion" data-target="#collapseTwo"> <h3 class="panel-title"> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 211a8f13..8a0bede3 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -83,6 +83,7 @@ from utility.helper_functions import get_species_groups from utility.redis_tools import get_redis_conn import utility.hmac as hmac +from gn3.db.rdf import get_dataset_metadata from base.webqtlConfig import TMPDIR @@ -487,7 +488,15 @@ def show_trait_page(): template_vars.js_data = json.dumps(template_vars.js_data, default=json_default_handler, indent=" ") - return render_template("show_trait.html", **template_vars.__dict__) + metadata = ( + template_vars.dataset.accession_id + .bind( + lambda idx: get_dataset_metadata(f"GN{idx}") + ) + ).data + + return render_template("show_trait.html", + metadata=metadata, **template_vars.__dict__) @app.route("/heatmap", methods=('POST',)) |