From 6c94b530adb183b7297110d116cd6528fd619f3e Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 2 Jul 2015 16:04:58 +0000 Subject: Combined searches that didn't work previously should work now, including cis and trans combined searches --- wqflask/wqflask/do_search.py | 14 +++++++++++--- wqflask/wqflask/search_results.py | 7 ++++++- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 9e88215a..90d88a5a 100755 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -595,6 +595,7 @@ class MrnaLrsSearch(LrsSearch, MrnaAssaySearch): self.from_clause = self.get_from_clause() self.where_clause = self.get_where_clause() + self.query = self.compile_final_query(from_clause = self.from_clause, where_clause = self.where_clause) return self.execute(self.query) @@ -607,6 +608,7 @@ class PhenotypeLrsSearch(LrsSearch, PhenotypeSearch): self.from_clause = self.get_from_clause() self.where_clause = self.get_where_clause() + self.query = self.compile_final_query(from_clause = self.from_clause, where_clause = self.where_clause) return self.execute(self.query) @@ -614,7 +616,7 @@ class PhenotypeLrsSearch(LrsSearch, PhenotypeSearch): class CisTransLrsSearch(DoSearch): def get_from_clause(self): - return ", Geno " + return ", Geno" def get_where_clause(self, cis_trans): self.search_term = [float(value) for value in self.search_term] @@ -699,9 +701,12 @@ class CisLrsSearch(CisTransLrsSearch, MrnaAssaySearch): DoSearch.search_types['ProbeSet_CISLRS'] = 'CisLrsSearch' + def get_where_clause(self): + return CisTransLrsSearch.get_where_clause(self, "cis") + def run(self): self.from_clause = self.get_from_clause() - self.where_clause = self.get_where_clause("cis") + self.where_clause = self.get_where_clause() self.query = self.compile_final_query(self.from_clause, self.where_clause) @@ -725,9 +730,12 @@ class TransLrsSearch(CisTransLrsSearch, MrnaAssaySearch): DoSearch.search_types['ProbeSet_TRANSLRS'] = 'TransLrsSearch' + def get_where_clause(self): + return CisTransLrsSearch.get_where_clause(self, "trans") + def run(self): self.from_clause = self.get_from_clause() - self.where_clause = self.get_where_clause("trans") + self.where_clause = self.get_where_clause() self.query = self.compile_final_query(self.from_clause, self.where_clause) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 2e0299f2..8d857fb4 100755 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -222,12 +222,17 @@ class SearchResultPage(object): if len(self.search_terms) > 1: combined_from_clause = "" combined_where_clause = "" + previous_from_clauses = [] #The same table can't be referenced twice in the from clause for i, a_search in enumerate(self.search_terms): the_search = self.get_search_ob(a_search) get_from_clause = getattr(the_search, "get_from_clause", None) if callable(get_from_clause): from_clause = the_search.get_from_clause() - combined_from_clause += from_clause + if from_clause in previous_from_clauses: + pass + else: + previous_from_clauses.append(from_clause) + combined_from_clause += from_clause where_clause = the_search.get_where_clause() combined_where_clause += "(" + where_clause + ")" if (i+1) < len(self.search_terms): -- cgit v1.2.3