aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/do_search.py71
-rwxr-xr-xwqflask/wqflask/search_results.py7
-rwxr-xr-xwqflask/wqflask/templates/correlation_page.html8
3 files changed, 53 insertions, 33 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index f966b564..4cd87270 100755
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -128,18 +128,24 @@ class MrnaAssaySearch(DoSearch):
'Additive Effect']
def get_where_clause(self):
- where_clause = """(MATCH (ProbeSet.Name,
- ProbeSet.description,
- ProbeSet.symbol,
- alias,
- GenbankId,
- UniGeneId,
- Probe_Target_Description)
- AGAINST ('%s' IN BOOLEAN MODE))
- and ProbeSet.Id = ProbeSetXRef.ProbeSetId
- and ProbeSetXRef.ProbeSetFreezeId = %s
- """ % (escape(self.search_term[0]),
- escape(str(self.dataset.id)))
+
+ if self.search_term[0] != "*":
+ match_clause = """(MATCH (ProbeSet.Name,
+ ProbeSet.description,
+ ProbeSet.symbol,
+ alias,
+ GenbankId,
+ UniGeneId,
+ Probe_Target_Description)
+ AGAINST ('%s' IN BOOLEAN MODE)) and
+ """ % (escape(self.search_term[0]))
+ else:
+ match_clause = ""
+
+ where_clause = (match_clause +
+ """ProbeSet.Id = ProbeSetXRef.ProbeSetId
+ and ProbeSetXRef.ProbeSetFreezeId = %s
+ """ % (escape(str(self.dataset.id))))
return where_clause
@@ -235,29 +241,40 @@ class PhenotypeSearch(DoSearch):
# This adds a clause to the query that matches the search term
# against each field in the search_fields tuple
- fields_clause_list = []
+ where_clause_list = []
for field in self.search_fields:
- fields_clause_list.append('''%s REGEXP "%s"''' % (field, search_term))
- fields_clause = "(%s) " % ' OR '.join(fields_clause_list)
+ where_clause_list.append('''%s REGEXP "%s"''' % (field, search_term))
+ where_clause = "(%s) " % ' OR '.join(where_clause_list)
- return fields_clause
+ return where_clause
def compile_final_query(self, from_clause = '', where_clause = ''):
"""Generates the final query string"""
from_clause = self.normalize_spaces(from_clause)
- query = (self.base_query +
- """%s
- WHERE %s
- and PublishXRef.InbredSetId = %s
- and PublishXRef.PhenotypeId = Phenotype.Id
- and PublishXRef.PublicationId = Publication.Id
- and PublishFreeze.Id = %s""" % (
- from_clause,
- where_clause,
- escape(str(self.dataset.group.id)),
- escape(str(self.dataset.id))))
+ if self.search_term[0] == "*":
+ query = (self.base_query +
+ """%s
+ WHERE PublishXRef.InbredSetId = %s
+ and PublishXRef.PhenotypeId = Phenotype.Id
+ and PublishXRef.PublicationId = Publication.Id
+ and PublishFreeze.Id = %s""" % (
+ from_clause,
+ escape(str(self.dataset.group.id)),
+ escape(str(self.dataset.id))))
+ else:
+ query = (self.base_query +
+ """%s
+ WHERE %s
+ and PublishXRef.InbredSetId = %s
+ and PublishXRef.PhenotypeId = Phenotype.Id
+ and PublishXRef.PublicationId = Publication.Id
+ and PublishFreeze.Id = %s""" % (
+ from_clause,
+ where_clause,
+ escape(str(self.dataset.group.id)),
+ escape(str(self.dataset.id))))
print("query is:", pf(query))
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 6614520e..2e0299f2 100755
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -249,12 +249,7 @@ class SearchResultPage(object):
search_type = {}
search_type['dataset_type'] = self.dataset.type
if a_search['key']:
- search_type['key'] = a_search['key'].upper()
- #search_type = a_search['key'].upper()
- #else:
- # # We fall back to the dataset type as the key to get the right object
- # search_type = self.dataset.type
-
+ search_type['key'] = a_search['key'].upper()
print("search_type is:", pf(search_type))
search_ob = do_search.DoSearch.get_search(search_type)
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 74919c88..445ad428 100755
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -98,8 +98,16 @@
<td><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td>
<td>{{ trait.num_overlap }}</td>
<td>{{'%0.3e'|format(trait.sample_p)}}</td>
+ {% if trait.lit_corr == "" or trait.lit_corr == 0.000 %}
+ <td>--</td>
+ {% else %}
<td>{{'%0.3f'|format(trait.lit_corr)}}</td>
+ {% endif %}
+ {% if trait.tissue_corr == "" or trait.tissue_corr == 0.000 %}
+ <td>--</td>
+ {% else %}
<td>{{'%0.3f'|format(trait.tissue_corr)}}</td>
+ {% endif %}
<td>{{'%0.3e'|format(trait.tissue_pvalue)}}</td>
{% elif target_dataset.type == "Publish" %}
<td><a href="/show_trait?trait_id={{trait.name}}&amp;dataset={{trait.dataset.name}}">{{ trait.name }}</a></td>