aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-12-03 11:16:42 -0600
committerzsloan2019-12-03 11:16:42 -0600
commit13786ffcb00bd3bf7864a76ef9b1078da0b355c5 (patch)
treed54060f0c397f3416f09dd594297da4acad6886a /wqflask
parent36dd1457c14b00b2b4d1ce9c36770f08446b4947 (diff)
downloadgenenetwork2-13786ffcb00bd3bf7864a76ef9b1078da0b355c5.tar.gz
Changed search result export metadata
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/export_traits.py21
-rw-r--r--wqflask/wqflask/search_results.py1
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js5
-rw-r--r--wqflask/wqflask/templates/search_result_page.html6
4 files changed, 27 insertions, 6 deletions
diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py
index ab4c0d7c..724350ac 100644
--- a/wqflask/wqflask/export_traits.py
+++ b/wqflask/wqflask/export_traits.py
@@ -12,7 +12,7 @@ from pprint import pformat as pf
def export_search_results_csv(targs):
table_data = json.loads(targs['export_data'])
- table_headers = table_data['headers']
+ table_headers = targs['headers'].split(",")
table_rows = table_data['rows']
buff = StringIO.StringIO()
@@ -20,20 +20,29 @@ def export_search_results_csv(targs):
metadata = []
- metadata.append(["Citations: Please see www.genenetwork.org/reference.html"])
if targs['database_name'] != "None":
- metadata.append(["Database: " + targs['database_name']])
- metadata.append(["Date: " + datetime.datetime.now().strftime("%B %d, %Y")])
- metadata.append(["Time: " + datetime.datetime.now().strftime("%H:%M GMT")])
- metadata.append(["Status of data ownership: Possibly unpublished data; please see www.genenetwork.org/statusandContact.html for details on sources, ownership, and usage of these data."])
+ metadata.append(["Data Set: " + targs['database_name']])
+ if targs['accession_id'] != "None":
+ metadata.append(["Metadata Link: http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + targs['accession_id']])
+ metadata.append(["Export Date: " + datetime.datetime.now().strftime("%B %d, %Y")])
+ metadata.append(["Export Time: " + datetime.datetime.now().strftime("%H:%M GMT")])
+ if targs['accession_id'] != "None":
+ metadata.append(["Data Ownership and References: Please see http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + targs['accession_id']])
+ metadata.append(["Search Query: " + targs['search_string']])
+ metadata.append(["Search Filter Terms: " + targs['filter_term']])
+ metadata.append(["Exported Row Number: " + str(len(table_rows))])
for metadata_row in metadata:
writer.writerow(metadata_row)
+ writer.writerow([""])
+
writer.writerow(table_headers)
for trait_info in table_rows:
writer.writerow(trait_info)
+ writer.writerow([""])
+ writer.writerow(["Funding for The GeneNetwork: NIAAA (U01AA13499, U24AA13513), NIDA, NIMH, and NIAAA (P20-DA21131), NCI MMHCC (U01CA105417), and NCRR (U01NR 105417)"])
csv_data = buff.getvalue()
buff.close()
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 2ac6d4b5..c44436d8 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -59,6 +59,7 @@ views.py).
self.and_or = "and"
self.search_terms = kw['search_terms_and']
search = self.search_terms
+ self.original_search_string = self.search_terms
# check for dodgy search terms
rx = re.compile(r'.*\W(href|http|sql|select|update)\W.*',re.IGNORECASE)
if rx.match(search):
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index 86e7d63e..0331a141 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -40,6 +40,11 @@ $(function() {
};
$('#searchbox').keyup(function(){
+ if ($(this).val() != ""){
+ $('#filter_term').val($(this).val());
+ } else {
+ $('#filter_term').val("None");
+ }
$('#trait_table').DataTable().search($(this).val()).draw();
});
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index b66540d7..093b8ed5 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -119,7 +119,13 @@
<input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ...">
<input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ...">
<form id="export_form" method="POST" action="/export_traits_csv" style="display: inline;">
+ <input type="hidden" name="headers" id="headers" value="{% for field in header_fields %}{{ field }},{% endfor %}">
+ <input type="hidden" name="search_string" id="search_string" value="{{ original_search_string }}">
<input type="hidden" name="database_name" id="database_name" value="{{ dataset.fullname }}">
+ <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 }}">
+ {% endif %}
<input type="hidden" name="export_data" id="export_data" value="">
<button class="btn btn-default" id="export_traits">Download</button>
</form>