diff options
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/base/data_set/genotypedataset.py | 10 | ||||
-rw-r--r-- | gn2/wqflask/templates/wiki/genewiki.html | 1 | ||||
-rw-r--r-- | gn2/wqflask/templates/wiki/history.html | 57 | ||||
-rw-r--r-- | gn2/wqflask/views.py | 20 |
4 files changed, 83 insertions, 5 deletions
diff --git a/gn2/base/data_set/genotypedataset.py b/gn2/base/data_set/genotypedataset.py index 77af1dad..a5b65772 100644 --- a/gn2/base/data_set/genotypedataset.py +++ b/gn2/base/data_set/genotypedataset.py @@ -50,7 +50,7 @@ GenoFreeze.Name = %s""" with database_connection(get_setting("SQL_URI")) as conn, conn.cursor() as cursor: cursor.execute( "SELECT Strain.Name, GenoData.value, " - "GenoSE.error, 'N/A', Strain.Name2 " + "GenoSE.error, NULL, Strain.Name2 " "FROM (GenoData, GenoFreeze, Strain, Geno, " "GenoXRef) LEFT JOIN GenoSE ON " "(GenoSE.DataId = GenoData.Id AND " @@ -68,9 +68,9 @@ GenoFreeze.Name = %s""" if self.group.name in webqtlUtil.ParInfo: f1_1, f1_2, ref, nonref = webqtlUtil.ParInfo[self.group.name] - results.append([f1_1, 0, None, "N/A", f1_1]) - results.append([f1_2, 0, None, "N/A", f1_2]) - results.append([ref, -1, None, "N/A", ref]) - results.append([nonref, 1, None, "N/A", nonref]) + results.append([f1_1, 0, None, None, f1_1]) + results.append([f1_2, 0, None, None, f1_2]) + results.append([ref, -1, None, None, ref]) + results.append([nonref, 1, None, None, nonref]) return results diff --git a/gn2/wqflask/templates/wiki/genewiki.html b/gn2/wqflask/templates/wiki/genewiki.html index 496f5e28..41fa97df 100644 --- a/gn2/wqflask/templates/wiki/genewiki.html +++ b/gn2/wqflask/templates/wiki/genewiki.html @@ -19,6 +19,7 @@ {% if entry.get("web_url") %} <sup> <small> <a href = "{{ entry.web_url }}" target = "_blank"> <span class = "glyphicon glyphicon-globe" aria-hidden = "true"></span>web</a></small></sup> {% endif %} + <sup><small>[<a href="/genewiki/{{ entry.id }}/history" target="_blank">history</a>]</small></sup> </li> {% endfor %} </ol> diff --git a/gn2/wqflask/templates/wiki/history.html b/gn2/wqflask/templates/wiki/history.html new file mode 100644 index 00000000..bda802d3 --- /dev/null +++ b/gn2/wqflask/templates/wiki/history.html @@ -0,0 +1,57 @@ +{% extends "base.html" %} +{% block content %} + {{ flash_me() }} + <div class = "container container-fluid"> + <div class="row"> + <div class="col-sm-9"> + <h2 class="text-info">GeneWiki Entry History</h2> + {% for entry in entries %} + <h3 class="text-info"> + {% if loop.index0 == 0 %} + <strong>Most Recent Version:</strong> + {% elif loop.index0 == 1 %} + <strong>Previous Version:</strong> + {% endif %} + </h3> + <table class="table table-responsive table-bordered"> + <tbody> + <tr> + <th>Gene Symbol:</th> + <td>{{ entry.symbol }}</td> + </tr> + <tr> + <th>PubMed IDs:</th> + <td> + {% for id in entry.pubmed_ids %} + <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids={{ id }}&dopt=Abstract">{{ id }}</a> + {% endfor %} + {% if not entry.pubmed_ids %}Not Available{% endif %} + </td> + </tr> + <tr> + <th>Web URL:</th> + <td>{{ entry.web_url or "Not Available" }}</td> + </tr> + <tr> + <th>Entry:</th> + <td>{{ entry.comment }}</td> + </tr> + <tr> + <th>Category:</th> + <td>{{ '; '.join(entry.categories) or "Not Available" }}</td> + </tr> + <tr> + <th>Add Time:</th> + <td>{{ entry.created }}</td> + </tr> + <tr> + <th>Reason for Modification:</th> + <td>{{ entry.reason or "Not Available" }}</td> + </tr> + </tbody> + </table> + {% endfor %} + </div> + </div> + </div> +{% endblock %} diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index 4164c604..7699c303 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -1312,6 +1312,26 @@ def display_genewiki_page(symbol: str): ) +@app.route("/genewiki/<int:comment_id>/history") +def display_wiki_history(comment_id: str): + entries = [] + try: + entries = requests.get( + urljoin( + GN3_LOCAL_URL, + f"/api/metadata/wiki/{comment_id}/history" + ) + ) + entries.raise_for_status() + entries = entries.json() + except requests.RequestException as excp: + flash(excp, "alert-warning") + return render_template( + "wiki/history.html", + entries=entries + ) + + @app.route("/datasets/<name>", methods=('GET',)) def get_dataset(name): from gn2.wqflask.oauth2.client import oauth2_get |