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 +- .../wqflask/marker_regression/marker_regression.py | 5 +++-- wqflask/wqflask/my_pylmm/pyLMM/lmm.py | 24 +++++++++++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'wqflask') 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" diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 6ae1318e..334ce631 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -78,8 +78,9 @@ class MarkerRegression(object): genotype_matrix = np.array(trimmed_genotype_data).T - print("pheno_vector is: ", pf(pheno_vector)) - print("genotype_matrix is: ", pf(genotype_matrix)) + print("pheno_vector: ", pf(pheno_vector)) + print("genotype_matrix: ", pf(genotype_matrix)) + print("genotype_matrix.shape: ", pf(genotype_matrix.shape)) t_stats, p_values = lmm.run( pheno_vector, diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py index fc021a0b..62fb0fbd 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py @@ -58,6 +58,10 @@ def run_human(pheno_vector, identifier = str(uuid.uuid4()) + print("pheno_vector: ", pf(pheno_vector)) + print("kinship_matrix: ", pf(kinship_matrix)) + print("kinship_matrix.shape: ", pf(kinship_matrix.shape)) + lmm_vars = pickle.dumps(dict( pheno_vector = pheno_vector, covariate_matrix = covariate_matrix, @@ -70,12 +74,12 @@ def run_human(pheno_vector, pheno_vector = pheno_vector[keep] #print("pheno_vector shape is now: ", pf(pheno_vector.shape)) covariate_matrix = covariate_matrix[keep,:] - print("kinship_matrix shape is: ", pf(kinship_matrix.shape)) + #print("kinship_matrix shape is: ", pf(kinship_matrix.shape)) #print("len(keep) is: ", pf(keep.shape)) kinship_matrix = kinship_matrix[keep,:][:,keep] n = kinship_matrix.shape[0] - print("n is:", n) + #print("n is:", n) lmm_ob = LMM(pheno_vector, kinship_matrix, covariate_matrix) @@ -86,7 +90,7 @@ def run_human(pheno_vector, p_values = [] t_stats = [] - print("input_file: ", plink_input_file) + #print("input_file: ", plink_input_file) with Bench("Opening and loading pickle file"): with gzip.open(plink_input_file, "rb") as input_file: @@ -103,6 +107,8 @@ def run_human(pheno_vector, with Bench("Create list of inputs"): inputs = list(plink_input) + + print("len(genotypes): ", len(inputs)) with Bench("Divide into chunks"): results = chunks.divide_into_chunks(inputs, 64) @@ -116,7 +122,7 @@ def run_human(pheno_vector, timestamp = datetime.datetime.utcnow().isoformat() - print("Starting adding loop") + #print("Starting adding loop") for part, result in enumerate(results): #data = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) holder = pickle.dumps(dict( @@ -126,10 +132,10 @@ def run_human(pheno_vector, result = result ), pickle.HIGHEST_PROTOCOL) - print("Adding:", part) + #print("Adding:", part) Redis.rpush(key, zlib.compress(holder)) - print("End adding loop") - print("***** Added to {} queue *****".format(key)) + #print("End adding loop") + #print("***** Added to {} queue *****".format(key)) for snp, this_id in plink_input: #with Bench("part before association"): if count > 2000: @@ -157,6 +163,10 @@ def run_human(pheno_vector, return p_values, t_stats +#class HumanAssociation(object): +# def __init__(self): +# + def human_association(snp, n, keep, -- cgit v1.2.3 From 04b61737236b837e91355b66cbaab3549bc39140 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 16 May 2013 23:31:54 +0000 Subject: Made the first level of quick search tabs species, followed by trait type (was the opposite before Rob commented on it earlier today) --- wqflask/wqflask/search_results.py | 19 ++++--- wqflask/wqflask/templates/quick_search.html | 86 +++++++++++------------------ 2 files changed, 45 insertions(+), 60 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 5f3c036f..9b2751e0 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -74,7 +74,6 @@ class SearchResultPage(object): self.search_terms = kw['q'] print("self.search_terms is: ", self.search_terms) self.quick_search() - self.get_group_species_tree() else: self.results = [] #self.quick_search = False @@ -144,12 +143,18 @@ class SearchResultPage(object): 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 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] = collections.defaultdict(list) - 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) + 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'])) diff --git a/wqflask/wqflask/templates/quick_search.html b/wqflask/wqflask/templates/quick_search.html index 9d5b0c74..5877a840 100644 --- a/wqflask/wqflask/templates/quick_search.html +++ b/wqflask/wqflask/templates/quick_search.html @@ -25,33 +25,31 @@ {% endif %} - -

To study a record, click on its ID below.
- Check records below and click Add button to add to selection.

-
+
-
-
+ {% for species in species_groups %} +
+
- {% for species in species_groups.phenotype %} -
+ {% if species_groups[species]['phenotype'] %} +
@@ -85,20 +83,9 @@
- {% endfor %} -
-
-
-
-
- -
- {% for species in species_groups.mrna_assay %} -
+ {% endif %} + {% if species_groups[species]['mrna_assay'] %} +
@@ -136,20 +123,9 @@
- {% endfor %} -
-
-
-
-
- -
- {% for species in species_groups.genotype %} -
+ {% endif %} + {% if species_groups[species]['genotype'] %} +
@@ -179,14 +155,19 @@
- {% endfor %} + {% endif %}
+ {% endfor %}
- + + + +{% endblock %} + {# @@ -285,9 +266,6 @@ #} - - -{% endblock %} {% block js %} @@ -299,6 +277,8 @@ @@ -274,9 +175,14 @@ - @@ -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 From aac1dd2f9c5b216b24c6e35676ba5d50f9d5d3c2 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 13 Jun 2013 20:15:30 +0000 Subject: Put the template html for the quick search page when all trait types are displayed in a separate file that is included in quick_search.html --- wqflask/wqflask/templates/all_results.html | 134 +++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 wqflask/wqflask/templates/all_results.html (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/all_results.html b/wqflask/wqflask/templates/all_results.html new file mode 100644 index 00000000..a42e42d8 --- /dev/null +++ b/wqflask/wqflask/templates/all_results.html @@ -0,0 +1,134 @@ + +
+ {% for species in species_groups %} +
+
+ +
+ {% if species_groups[species]['phenotype'] %} +
+
+ + + + + + + + + + + + + {% for result in results.phenotype %} + {% if result.result_fields['species'] == species %} + + + + + + + + + + {% endif %} + {% 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'] }}
+
+ {% endif %} + {% if species_groups[species]['mrna_assay'] %} +
+ + + + + + + + + + + + + + + + {% for result in results.mrna_assay %} + {% if result.result_fields['species'] == species %} + + + + + + + + + + + + {% endif %} + {% 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'] }}
+
+ {% endif %} + {% if species_groups[species]['genotype'] %} +
+ + + + + + + + + + + + {% for result in results.genotype %} + {% if result.result_fields['species'] == species %} + + + + + + + + {% endif %} + {% 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'] }}
+
+ {% endif %} +
+
+
+ {% endfor %} +
\ No newline at end of file -- cgit v1.2.3