From 5a3f413da480123e3ad943b5f556e0a557f185cc Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 9 May 2013 22:54:34 +0000 Subject: Just added some print statements so I can show matrix/vector shapes to Tony --- wqflask/base/data_set.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask/base/data_set.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 1520b180..d7328441 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -385,7 +385,7 @@ class PhenotypeDataSet(DataSet): continue # for now if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=self.privilege, userName=self.userName, authorized_users=this_trait.authorized_users): description = this_trait.pre_publication_description - this_trait.description_display = description + this_trait.description_display = unicode(description, "utf8") if not this_trait.year.isdigit(): this_trait.pubmed_text = "N/A" -- cgit v1.2.3 From 7938d8c6cbdfe866ebf9ec62dec0fe5c43cf2d6f Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Wed, 12 Jun 2013 22:45:57 +0000 Subject: Fixed a couple issues with the template that caused the regular search results and show trait page to not display --- wqflask/base/data_set.py | 4 +- wqflask/wqflask/search_results.py | 59 +++++---- wqflask/wqflask/templates/index_page.html | 9 +- wqflask/wqflask/templates/quick_search.html | 146 ++++++++++++++++++---- wqflask/wqflask/templates/show_trait_details.html | 4 +- 5 files changed, 165 insertions(+), 57 deletions(-) (limited to 'wqflask/base/data_set.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index d7328441..9b0a3dcc 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -735,8 +735,10 @@ class MrnaAssayDataSet(DataSet): trait_location_value = 1000000 if this_trait.chr and this_trait.mb: + print("this_trait.chr is:", this_trait.chr) + print("this_trait.mb is:", this_trait.mb) try: - trait_location_value = int(this_trait.chr)*1000 + this_trait.mb + trait_location_value = float(this_trait.chr)*1000 + float(this_trait.mb) except: if this_trait.chr.upper() == 'X': trait_location_value = 20*1000 + this_trait.mb diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index ad74f6cc..63aa481e 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -42,7 +42,7 @@ from utility import formatting #def __init__(self, key, result_fields): # self.key = key # self.result_fields = result_fields - + class SearchResultPage(object): #maxReturn = 3000 @@ -73,6 +73,7 @@ class SearchResultPage(object): self.quick = True self.search_terms = kw['q'] print("self.search_terms is: ", self.search_terms) + self.trait_type = kw['trait_type'] self.quick_search() else: self.results = [] @@ -91,7 +92,7 @@ class SearchResultPage(object): """ self.trait_list = [] - + species = webqtlDatabaseFunction.retrieve_species(self.dataset.group.name) # result_set represents the results for each search term; a search of @@ -100,7 +101,7 @@ class SearchResultPage(object): for result in self.results: if not result: continue - + #### Excel file needs to be generated #### print("foo locals are:", locals()) @@ -123,42 +124,46 @@ class SearchResultPage(object): FROM QuickSearch WHERE MATCH (terms) AGAINST ('{}' IN BOOLEAN MODE) """.format(search_terms) - #print("query is: ", query) with Bench("Doing QuickSearch Query: "): dbresults = g.db.execute(query, no_parameters=True).fetchall() #print("results: ", pf(results)) - + self.results = collections.defaultdict(list) - + type_dict = {'PublishXRef': 'phenotype', 'ProbeSetXRef': 'mrna_assay', 'GenoXRef': 'genotype'} - + self.species_groups = {} + for dbresult in dbresults: this_result = {} this_result['table_name'] = dbresult.table_name - this_result['key'] = dbresult.the_key - this_result['result_fields'] = json.loads(dbresult.result_fields) - this_species = this_result['result_fields']['species'] - this_group = this_result['result_fields']['group_name'] - if this_species not in self.species_groups: - self.species_groups[this_species] = {} - if type_dict[dbresult.table_name] not in self.species_groups[this_species]: - self.species_groups[this_species][type_dict[dbresult.table_name]] = [] - if this_group not in self.species_groups[this_species][type_dict[dbresult.table_name]]: - self.species_groups[this_species][type_dict[dbresult.table_name]].append(this_group) - #if type_dict[dbresult.table_name] not in self.species_groups: - # self.species_groups[type_dict[dbresult.table_name]] = {} - #if this_species not in self.species_groups[type_dict[dbresult.table_name]]: - # self.species_groups[type_dict[dbresult.table_name]][this_species] = [] - #if this_group not in self.species_groups[type_dict[dbresult.table_name]][this_species]: - # self.species_groups[type_dict[dbresult.table_name]][this_species].append(this_group) - self.results[type_dict[dbresult.table_name]].append(this_result) - - #print("results: ", pf(self.results['phenotype'])) - + if self.trait_type == type_dict[dbresult.table_name] or self.trait_type == 'all': + this_result['key'] = dbresult.the_key + this_result['result_fields'] = json.loads(dbresult.result_fields) + this_species = this_result['result_fields']['species'] + this_group = this_result['result_fields']['group_name'] + if this_species not in self.species_groups: + self.species_groups[this_species] = {} + if type_dict[dbresult.table_name] not in self.species_groups[this_species]: + self.species_groups[this_species][type_dict[dbresult.table_name]] = [] + if this_group not in self.species_groups[this_species][type_dict[dbresult.table_name]]: + self.species_groups[this_species][type_dict[dbresult.table_name]].append(this_group) + #if type_dict[dbresult.table_name] not in self.species_groups: + # self.species_groups[type_dict[dbresult.table_name]] = {} + #if this_species not in self.species_groups[type_dict[dbresult.table_name]]: + # self.species_groups[type_dict[dbresult.table_name]][this_species] = [] + #if this_group not in self.species_groups[type_dict[dbresult.table_name]][this_species]: + # self.species_groups[type_dict[dbresult.table_name]][this_species].append(this_group) + self.results[type_dict[dbresult.table_name]].append(this_result) + + import redis + Redis = redis.Redis() + + + #def get_group_species_tree(self): # self.species_groups = collections.default_dict(list) # for key in self.results: diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html index b4376ce3..a9f2cb24 100644 --- a/wqflask/wqflask/templates/index_page.html +++ b/wqflask/wqflask/templates/index_page.html @@ -32,7 +32,14 @@
- +
+ +
-
+ +
+ {% if trait_type == 'all' %} + {% include 'all_results.html' %} + {% else %}
{% for species in species_groups %} -
-
+
+
+ {# -
- {% if species_groups[species]['phenotype'] %} -
+ #} +
+ {% if trait_type == 'phenotype' and species_groups[species]['phenotype'] %} @@ -82,10 +87,8 @@ {% endfor %}
-
{% endif %} - {% if species_groups[species]['mrna_assay'] %} -
+ {% if trait_type == 'mrna_assay' and species_groups[species]['mrna_assay'] %} @@ -105,7 +108,7 @@ {% if result.result_fields['species'] == species %} @@ -114,18 +117,16 @@ - + {% endif %} {% endfor %} -
- + {{ result.result_fields['dataset_name'] }} {{ result.result_fields['symbol'] }} {{ result.result_fields['description'] }}Chr {{ result.result_fields['chr'] }}: {{ result.result_fields['mb'] }}{{ result.result_fields['chr'] }} : {{ result['mb'] }} {{ result.result_fields['mean'] }} {{ result.result_fields['lrs'] }}
-
+ {% endif %} - {% if species_groups[species]['genotype'] %} -
+ {% if trait_type == 'genotype' and species_groups[species]['genotype'] %} @@ -153,14 +154,14 @@ {% endif %} {% endfor %} -
-
+ {% endif %}
{% endfor %}
+ {% endif %}
@@ -168,6 +169,105 @@ {% endblock %} + {# + + + + + + + + + + + + + + {% for result in results.phenotype %} + + + + + + + + + + {% endfor %} + +
IdSpeciesGroupDescriptionLRSYearAuthors
{{ result.result_fields['phenotype_id'] }}{{ result.result_fields['species'] }}{{ result.result_fields['group_name'] }}{{ result.result_fields['description'] }}{{ result.result_fields['lrs'] }} + + {{ result.result_fields['year'] }} + + {{ result.result_fields['authors'] }}
+
+
+ + + + + + + + + + + + + + + + {% for result in results.mrna_assay %} + + + + + + + + + + + + {% endfor %} + +
Record IDSpeciesGroupData SetSymbolDescriptionLocationMean ExprMax LRS
+ + {{ result.result_fields['species'] }}{{ result.result_fields['group_name'] }}{{ result.result_fields['dataset_name'] }}{{ result.result_fields['symbol'] }}{{ result.result_fields['description'] }}{{ result.result_fields['chr'] }} : {{ result['mb'] }}{{ result.result_fields['mean'] }}{{ result.result_fields['lrs'] }}
+
+
+ + + + + + + + + + + + {% for result in results.genotype %} + + + + + + + + {% endfor %} + +
MarkerSpeciesGroupData SetLocation
+ + {{ result.result_fields['marker_name'] }} + + {{ result.result_fields['species'] }}{{ result.result_fields['group_name'] }}{{ result.result_fields['dataset_name'] }}{{ result.result_fields['chr'] }} : {{ result.result_fields['mb'] }}
+
+ #} + + {% block js %} @@ -175,16 +275,9 @@ + {% endblock %} + diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index c3abfc9f..b57c3c21 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -19,11 +19,11 @@ BLAT Specifity -
{{ "%.1f" % (this_trait.probe_set_specificity) }}
+
{{ "%s" % (this_trait.probe_set_specificity) }}
{% endif %} {% if this_trait.probe_set_blat_score %}
BLAT Score
-
{{ "%i" % (this_trait.probe_set_blat_score) }}
+
{{ "%s" % (this_trait.probe_set_blat_score) }}
{% endif %} -- cgit v1.2.3