aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2016-10-31 19:55:56 +0000
committerPjotr Prins2016-10-31 19:55:56 +0000
commit55bbc368c6a02ebfb8f754dfbe7ee5f60edea66b (patch)
tree29e5cbb7b6b30f1dde153c57821ddc54e92dc76c
parent0748bb92fe326330114d2051d959fb4d09977e53 (diff)
parent684f461b815e3920419874fccb036c359cae35d8 (diff)
downloadgenenetwork2-55bbc368c6a02ebfb8f754dfbe7ee5f60edea66b.tar.gz
Merge branch 'master' of github.com:zsloan/genenetwork2 into zsloan
-rw-r--r--wqflask/base/trait.py36
-rw-r--r--wqflask/wqflask/templates/collections/view.html59
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html4
-rw-r--r--wqflask/wqflask/templates/gsearch_pheno.html4
-rw-r--r--wqflask/wqflask/templates/search_result_page.html4
5 files changed, 56 insertions, 51 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 32032ba7..276c624a 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -78,11 +78,37 @@ class GeneralTrait(object):
"""Return a dict suitable for using as json
Actual turning into json doesn't happen here though"""
- return dict(name=self.name,
- dataset=self.dataset.name,
- description=self.description_display,
- mean=self.mean)
-
+
+ if self.dataset.type == "ProbeSet":
+ return dict(name=self.name,
+ symbol=self.symbol,
+ dataset=self.dataset.name,
+ description=self.description_display,
+ mean=self.mean,
+ location=self.location_repr,
+ lrs_score=self.LRS_score_repr,
+ lrs_location=self.LRS_location_repr,
+ additive=self.additive
+ )
+ elif self.dataset.type == "Publish":
+ return dict(name=self.name,
+ dataset=self.dataset.name,
+ description=self.description_display,
+ authors=self.authors,
+ pubmed_text=self.pubmed_text,
+ pubmed_link=self.pubmed_link,
+ lrs_score=self.LRS_score_repr,
+ lrs_location=self.LRS_location_repr,
+ additive=self.additive
+ )
+ elif self.dataset.type == "Geno":
+ return dict(name=self.name,
+ dataset=self.dataset.name,
+ location=self.location_repr
+ )
+ else:
+ return dict()
+
def get_name(self):
stringy = ""
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index 8fc5f120..801266d3 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -4,7 +4,6 @@
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
<link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" />
- <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
{% endblock %}
{% block content %}
<!-- Start of body -->
@@ -74,20 +73,26 @@
<button class="btn" id="remove" disabled="disabled"><i class="icon-minus-sign"></i> Remove Record</button>
<br />
<br />
+ <form id="export_form" method="POST" action="/export_traits_csv">
+ <input type="hidden" name="database_name" id="database_name" value="None">
+ <input type="hidden" name="export_data" id="export_data" value="">
+ <button class="btn btn-default" id="export_traits">Download CSV</button>
+ </form>
+ <br />
<div style="background-color: #eeeeee; border: 1px solid black;">
<table id="trait_table" class="table table-hover table-striped">
<thead>
<tr>
<th style="background-color: #eeeeee;"></th>
- <th style="background-color: #eeeeee;">Index</th>
- <th style="background-color: #eeeeee;">Dataset</th>
- <th style="background-color: #eeeeee;">Record</th>
- <th style="background-color: #eeeeee;">Description</th>
- <th style="background-color: #eeeeee;">Location</th>
- <th style="background-color: #eeeeee;">Mean</th>
- <th style="background-color: #eeeeee;">Max LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
- <th style="background-color: #eeeeee;">Max LRS Location</th>
- <th style="background-color: #eeeeee;">Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+ <th data-export="Index" style="background-color: #eeeeee;">Index</th>
+ <th data-export="Dataset" style="background-color: #eeeeee;">Dataset</th>
+ <th data-export="Record" style="background-color: #eeeeee;">Record</th>
+ <th data-export="Description" style="background-color: #eeeeee;">Description</th>
+ <th data-export="Location" style="background-color: #eeeeee;">Location</th>
+ <th data-export="Mean" style="background-color: #eeeeee;">Mean</th>
+ <th data-export="Max LRS" style="background-color: #eeeeee;">Max LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+ <th data-export="Max LRS Location" style="background-color: #eeeeee;">Max LRS Location</th>
+ <th data-export="Additive Effect" style="background-color: #eeeeee;">Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
</tr>
</thead>
@@ -98,9 +103,9 @@
<INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox"
VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}">
</TD>
- <TD>{{ loop.index }}</TD>
- <TD>{{ this_trait.dataset.name }}</TD>
- <TD>
+ <TD data-export="{{ loop.index }}">{{ loop.index }}</TD>
+ <TD data-export="{{ this_trait.dataset.name }}">{{ this_trait.dataset.name }}</TD>
+ <TD data-export="{{ this_trait.name }}">
<a href="{{ url_for('show_trait_page',
trait_id = this_trait.name,
dataset = this_trait.dataset.name
@@ -108,12 +113,12 @@
{{ this_trait.name }}
</a>
</TD>
- <TD>{{ this_trait.description_display }}</TD>
- <TD>{{ this_trait.location_repr }}</TD>
- <TD>{{ '%0.3f' % this_trait.mean|float }}</TD>
- <TD>{{ '%0.3f' % this_trait.LRS_score_repr|float }}</TD>
- <TD>{{ this_trait.LRS_location_repr }}</TD>
- <TD>{{ '%0.3f' % this_trait.additive|float }}</TD>
+ <TD data-export="{{ this_trait.description_display }}">{{ this_trait.description_display }}</TD>
+ <TD data-export="{{ this_trait.location_repr }}">{{ this_trait.location_repr }}</TD>
+ <TD data-export="{{ this_trait.mean }}">{{ '%0.3f' % this_trait.mean|float }}</TD>
+ <TD data-export="{{ this_trait.LRS_score_repr }}">{{ '%0.3f' % this_trait.LRS_score_repr|float }}</TD>
+ <TD data-export="{{ this_trait.LRS_location_repr }}">{{ this_trait.LRS_location_repr }}</TD>
+ <TD data-export="{{ this_trait.additive }}">{{ '%0.3f' % this_trait.additive|float }}</TD>
</TR>
{% endfor %}
@@ -132,9 +137,6 @@
{% block js %}
<script type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script>
@@ -170,18 +172,7 @@
"width": "15%" },
{ "type": "natural" }
],
- "buttons": [
- {
- extend: 'csvHtml5',
- text: 'Download CSV',
- title: 'collection',
- fieldBoundary: '"',
- exportOptions: {
- columns: [1, 2, 3, 4, 5, 6, 7, 8, 9]
- }
- }
- ],
- "sDom": "ZRBtir",
+ "sDom": "ZRtir",
"iDisplayLength": -1,
"autoWidth": true,
"bDeferRender": true,
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 776b8d07..8b8a9057 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -2,7 +2,6 @@
{% block title %}Search Results{% endblock %}
{% block css %}
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
- <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
{% endblock %}
{% block content %}
<!-- Start of body -->
@@ -99,9 +98,6 @@
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script>
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index 9aad7568..2f7dcaf6 100644
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -4,7 +4,6 @@
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
<link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" />
- <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" >
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css">
{% endblock %}
@@ -93,9 +92,6 @@
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script>
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index b6aab101..0f5e68d7 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -5,7 +5,6 @@
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/scroller/1.4.1/css/scroller.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" >
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css">
- <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
{% endblock %}
{% block content %}
<!-- Start of body -->
@@ -166,9 +165,6 @@
<script type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script>
- <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script>