aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/do_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/do_search.py')
-rwxr-xr-xwqflask/wqflask/do_search.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index a3260f34..5b042940 100755
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -481,7 +481,7 @@ class GoSearch(MrnaAssaySearch):
return self.execute(query)
#ZS: Not sure what the best way to deal with LRS searches is
-class LrsSearch(MrnaAssaySearch):
+class LrsSearch(DoSearch):
"""Searches for genes with a QTL within the given LRS values
LRS searches can take 3 different forms:
@@ -497,9 +497,11 @@ class LrsSearch(MrnaAssaySearch):
def get_from_clause(self):
if self.search_operator == "=":
- return ", Geno"
+ from_clause = ", Geno"
else:
- return ""
+ from_clause = ""
+
+ return from_clause
def get_where_clause(self):
self.search_term = [float(value) for value in self.search_term]
@@ -537,26 +539,42 @@ class LrsSearch(MrnaAssaySearch):
self.search_operator,
self.search_term[0])
where_clause = self.sub_clause
-
-
+
return where_clause
- def get_final_query(self):
+
+ def run(self):
+
self.from_clause = self.get_from_clause()
self.where_clause = self.get_where_clause()
+
self.query = self.compile_final_query(self.from_clause, self.where_clause)
- return self.query
+ return self.execute(self.query)
+
+class MrnaLrsSearch(LrsSearch, MrnaAssaySearch):
+
+ DoSearch.search_types['ProbeSet_LRS'] = 'MrnaLrsSearch'
def run(self):
self.from_clause = self.get_from_clause()
self.where_clause = self.get_where_clause()
-
- self.query = self.compile_final_query(self.from_clause, self.where_clause)
+ self.query = self.compile_final_query(from_clause = self.from_clause, where_clause = self.where_clause)
return self.execute(self.query)
+class PhenotypeLrsSearch(LrsSearch, PhenotypeSearch):
+
+ DoSearch.search_types['Publish_LRS'] = 'PhenotypeLrsSearch'
+
+ def run(self):
+
+ 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)
class CisTransLrsSearch(LrsSearch):
@@ -693,24 +711,6 @@ class MeanSearch(MrnaAssaySearch):
return self.query
def run(self):
-
- #self.search_term = [float(value) for value in self.search_term]
- #
- #if self.search_operator == "=":
- # assert isinstance(self.search_term, (list, tuple))
- # self.mean_min, self.mean_max = self.search_term[:2]
- #
- # self.where_clause = """ %sXRef.mean > %s and
- # %sXRef.mean < %s """ % self.mescape(self.dataset.type,
- # min(self.mean_min, self.mean_max),
- # self.dataset.type,
- # max(self.mean_min, self.mean_max))
- #else:
- # # Deal with >, <, >=, and <=
- # self.where_clause = """ %sXRef.mean %s %s """ % self.mescape(self.dataset.type,
- # self.search_operator,
- # self.search_term[0])
-
self.where_clause = self.get_where_clause()
print("where_clause is:", pf(self.where_clause))
@@ -781,6 +781,10 @@ class PositionSearch(DoSearch):
DoSearch.search_types[search_key] = "PositionSearch"
def get_where_clause(self):
+ self.search_term = [float(value) if is_number(value) else value for value in self.search_term]
+ self.chr, self.mb_min, self.mb_max = self.search_term[:3]
+ self.get_chr()
+
where_clause = """ %s.Chr = %s and
%s.Mb > %s and
%s.Mb < %s """ % self.mescape(self.dataset.type,
@@ -793,12 +797,6 @@ class PositionSearch(DoSearch):
return where_clause
- def setup(self):
- self.search_term = [float(value) if is_number(value) else value for value in self.search_term]
- self.chr, self.mb_min, self.mb_max = self.search_term[:3]
- self.get_chr()
- self.where_clause = self.get_where_clause()
-
def get_chr(self):
try:
self.chr = int(self.chr)
@@ -807,7 +805,7 @@ class PositionSearch(DoSearch):
def run(self):
- self.setup()
+ self.get_where_clause()
self.query = self.compile_final_query(where_clause = self.where_clause)
return self.execute(self.query)
@@ -820,7 +818,7 @@ class MrnaPositionSearch(PositionSearch, MrnaAssaySearch):
def run(self):
- self.setup()
+ self.get_where_clause()
self.query = self.compile_final_query(where_clause = self.where_clause)
return self.execute(self.query)
@@ -833,7 +831,7 @@ class GenotypePositionSearch(PositionSearch, GenotypeSearch):
def run(self):
- self.setup()
+ self.get_where_clause()
self.query = self.compile_final_query(where_clause = self.where_clause)
return self.execute(self.query)
@@ -841,6 +839,8 @@ class GenotypePositionSearch(PositionSearch, GenotypeSearch):
class PvalueSearch(MrnaAssaySearch):
"""Searches for traits with a permutationed p-value between low and high"""
+ DoSearch.search_types['ProbeSet_PVALUE'] = "PvalueSearch"
+
def run(self):
self.search_term = [float(value) for value in self.search_term]