diff options
author | Zachary Sloan | 2013-03-27 19:15:54 +0000 |
---|---|---|
committer | Zachary Sloan | 2013-03-27 19:15:54 +0000 |
commit | 2ead7d163451f17775ff99f048f66c17d2a7f20f (patch) | |
tree | b41dcfa5449a2b249fbe4e60b5517d1c2a8181c9 | |
parent | e2ca00d32752df02214c9c249a3aab7d2e9a6ad2 (diff) | |
download | genenetwork2-2ead7d163451f17775ff99f048f66c17d2a7f20f.tar.gz |
Worked on trying to get results for quick search to display
-rw-r--r-- | wqflask/wqflask/do_search.py | 27 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 20 |
2 files changed, 37 insertions, 10 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index bbb16054..4ba35d63 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -67,13 +67,21 @@ class QuickMrnaAssaySearch(DoSearch): DoSearch.search_types['quick_mrna_assay'] = "QuickMrnaAssaySearch" - base_query = """SELECT ProbeSet.Name as ProbeSet_Name, + base_query = """SELECT Species.Name as Species_Name, + ProbeSetFreeze.Name as DataSet_Name, + ProbeSetFreeze.FullName as DataSet_FullName, + ProbeSet.Name as ProbeSet_Name, ProbeSet.Symbol as ProbeSet_Symbol, ProbeSet.description as ProbeSet_Description, ProbeSet.Chr_num as ProbeSet_Chr_Num, ProbeSet.Mb as ProbeSet_Mb, ProbeSet.name_num as ProbeSet_name_num - FROM ProbeSet """ + FROM ProbeSet, + ProbeSetXRef, + ProbeSetFreeze, + ProbeFreeze, + InbredSet, + Species """ header_fields = ['', 'Record ID', @@ -88,7 +96,12 @@ class QuickMrnaAssaySearch(DoSearch): ProbeSet.description, ProbeSet.symbol, ProbeSet.alias) - AGAINST ('%s' IN BOOLEAN MODE)) + AGAINST ('%s' IN BOOLEAN MODE)) and + ProbeSet.Id = ProbeSetXRef.ProbeSetId and + ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id and + ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and + ProbeFreeze.InbredSetId = InbredSet.Id and + InbredSet.SpeciesId = Species.Id """ % (escape(self.search_term[0])) print("final query is:", pf(query)) @@ -159,7 +172,7 @@ class MrnaAssaySearch(DoSearch): print("final query is:", pf(query)) return self.execute(query) - + class PhenotypeSearch(DoSearch): """A search within a phenotype dataset""" @@ -252,7 +265,8 @@ class PhenotypeSearch(DoSearch): query = self.compile_final_query(where_clause = self.get_fields_clause()) return self.execute(query) - + + class QuickPhenotypeSearch(PhenotypeSearch): """A search across all phenotype datasets""" @@ -304,7 +318,8 @@ class QuickPhenotypeSearch(PhenotypeSearch): with Bench("Doing quick phenotype search"): results = self.execute(query) - return results + return results + class GenotypeSearch(DoSearch): """A search within a genotype dataset""" diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index e1d81f37..8942d2ff 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -61,17 +61,29 @@ class SearchResultPage(): self.results = [] if 'q' in kw: - #self.quick_search = True + self.quick_search = True self.search_terms = kw['q'] print("self.search_terms is: ", self.search_terms) - self.quick_search() + self.do_quick_search() else: - #self.quick_search = False + self.quick_search = False self.search_terms = kw['search_terms'] self.dataset = create_dataset(kw['dataset']) self.search() self.gen_search_result() + def gen_quick_search_result(self): + self.trait_list = [] + + species_list = [] + + for result in self.results: + if not result: + continue + if result[0] not in species_list: + species_list.append(result[0]) + + def gen_search_result(self): """ @@ -100,7 +112,7 @@ class SearchResultPage(): self.dataset.get_trait_info(self.trait_list, species) - def quick_search(self): + def do_quick_search(self): self.search_terms = parser.parse(self.search_terms) print("After parsing:", self.search_terms) |