aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/base/trait.py4
-rw-r--r--wqflask/utility/Plot.py3
-rw-r--r--wqflask/wqflask/search_results.py11
-rw-r--r--wqflask/wqflask/show_trait/SampleList.py32
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py22
-rw-r--r--wqflask/wqflask/static/new/javascript/dataset_menu_structure.json79
-rw-r--r--wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js76
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js65
-rw-r--r--wqflask/wqflask/templates/search_result_page.html22
-rw-r--r--wqflask/wqflask/templates/show_trait.html30
-rw-r--r--wqflask/wqflask/templates/show_trait_mapping_tools.html2
-rw-r--r--wqflask/wqflask/templates/show_trait_transform_and_filter.html1
12 files changed, 221 insertions, 126 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index e57d4176..9f76306f 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -206,6 +206,7 @@ def jsonable(trait):
return dict(name=trait.name,
symbol=trait.symbol,
dataset=dataset.name,
+ dataset_name = dataset.shortname,
description=trait.description_display,
mean=trait.mean,
location=trait.location_repr,
@@ -217,6 +218,7 @@ def jsonable(trait):
if trait.pubmed_id:
return dict(name=trait.name,
dataset=dataset.name,
+ dataset_name = dataset.shortname,
description=trait.description_display,
authors=trait.authors,
pubmed_text=trait.pubmed_text,
@@ -228,6 +230,7 @@ def jsonable(trait):
else:
return dict(name=trait.name,
dataset=dataset.name,
+ dataset_name = dataset.shortname,
description=trait.description_display,
authors=trait.authors,
pubmed_text=trait.pubmed_text,
@@ -238,6 +241,7 @@ def jsonable(trait):
elif dataset.type == "Geno":
return dict(name=trait.name,
dataset=dataset.name,
+ dataset_name = dataset.shortname,
location=trait.location_repr
)
else:
diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py
index 529cd117..cce8435d 100644
--- a/wqflask/utility/Plot.py
+++ b/wqflask/utility/Plot.py
@@ -98,8 +98,6 @@ def find_outliers(vals):
"""
- logger.debug("xerxes vals is:", pf(vals))
-
if vals:
#logger.debug("vals is:", pf(vals))
stats = corestats.Stats(vals)
@@ -114,7 +112,6 @@ def find_outliers(vals):
upper_bound = None
lower_bound = None
- logger.debug(pf(locals()))
return upper_bound, lower_bound
# parameter: data is either object returned by reaper permutation function (called by MarkerRegressionPage.py)
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index c67063b0..893fd172 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -112,7 +112,7 @@ views.py).
trait_dict['hmac'] = user_manager.data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name))
if this_trait.dataset.type == "ProbeSet":
trait_dict['symbol'] = this_trait.symbol
- trait_dict['description'] = this_trait.description_display
+ trait_dict['description'] = insert_newlines(this_trait.description_display)
trait_dict['location'] = this_trait.location_repr
trait_dict['mean'] = "N/A"
trait_dict['additive'] = "N/A"
@@ -125,7 +125,7 @@ views.py).
elif this_trait.dataset.type == "Geno":
trait_dict['location'] = this_trait.location_repr
elif this_trait.dataset.type == "Publish":
- trait_dict['description'] = this_trait.description_display
+ trait_dict['description'] = insert_newlines(this_trait.description_display)
trait_dict['authors'] = this_trait.authors
trait_dict['pubmed_id'] = "N/A"
if this_trait.pubmed_id:
@@ -222,3 +222,10 @@ views.py).
return the_search
else:
return None
+
+def insert_newlines(string, every=64):
+ """ This is because it is seemingly impossible to change the width of the description column, so I'm just manually adding line breaks """
+ lines = []
+ for i in xrange(0, len(string), every):
+ lines.append(string[i:i+every])
+ return '\n'.join(lines)
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index 50d7b6c0..50026bba 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -39,7 +39,7 @@ class SampleList(object):
#self.sample_qnorm = get_transform_vals(self.dataset, this_trait)
- if self.this_trait and self.dataset and self.dataset.type == 'ProbeSet':
+ if self.this_trait and self.dataset:
self.get_extra_attribute_values()
for counter, sample_name in enumerate(sample_names, 1):
@@ -72,10 +72,9 @@ class SampleList(object):
self.sample_list.append(sample)
- logger.debug("self.attributes is", pf(self.attributes))
+ #logger.debug("attribute vals are", pf(self.sample_attribute_values))
self.do_outliers()
- logger.debug("*the_samples are [%i]: %s" % (len(self.sample_list), pf(self.sample_list)))
def __repr__(self):
return "<SampleList> --> %s" % (pf(self.__dict__))
@@ -98,11 +97,11 @@ class SampleList(object):
# Get attribute names and distinct values for each attribute
results = g.db.execute('''
- SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttributeXRef.Value
- FROM CaseAttribute, CaseAttributeXRef
- WHERE CaseAttributeXRef.CaseAttributeId = CaseAttribute.Id
- AND CaseAttributeXRef.ProbeSetFreezeId = %s
- ORDER BY CaseAttribute.Name''', (str(self.dataset.id),))
+ SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttributeXRefNew.Value
+ FROM CaseAttribute, CaseAttributeXRefNew
+ WHERE CaseAttributeXRefNew.CaseAttributeId = CaseAttribute.Id
+ AND CaseAttributeXRefNew.InbredSetId = %s
+ ORDER BY CaseAttribute.Name''', (str(self.dataset.group.id),))
self.attributes = {}
for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name)):
@@ -115,16 +114,17 @@ class SampleList(object):
def get_extra_attribute_values(self):
if self.attributes:
- results = g.db.execute('''
- SELECT Strain.Name AS SampleName, CaseAttributeId AS Id, CaseAttributeXRef.Value
- FROM Strain, StrainXRef, InbredSet, CaseAttributeXRef
+ query = '''
+ SELECT Strain.Name AS SampleName, CaseAttributeId AS Id, CaseAttributeXRefNew.Value
+ FROM Strain, StrainXRef, InbredSet, CaseAttributeXRefNew
WHERE StrainXRef.StrainId = Strain.Id
AND InbredSet.Id = StrainXRef.InbredSetId
- AND CaseAttributeXRef.StrainId = Strain.Id
- AND InbredSet.Name = %s
- AND CaseAttributeXRef.ProbeSetFreezeId = %s
- ORDER BY SampleName''',
- (self.dataset.group.name, self.this_trait.dataset.id))
+ AND CaseAttributeXRefNew.StrainId = Strain.Id
+ AND InbredSet.Id = CaseAttributeXRefNew.InbredSetId
+ AND CaseAttributeXRefNew.InbredSetId = %s
+ ORDER BY SampleName''' % self.dataset.group.id
+
+ results = g.db.execute(query)
for sample_name, items in itertools.groupby(results.fetchall(), lambda row: row.SampleName):
attribute_values = {}
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 0d1ed345..9b4470fe 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -350,6 +350,28 @@ def quantile_normalize_vals(sample_groups):
return qnorm_by_group
+def get_z_scores(sample_groups):
+ zscore_by_group = []
+ for sample_type in sample_groups:
+ trait_vals = []
+ for sample in sample_type.sample_list:
+ try:
+ trait_vals.append(float(sample.value))
+ except:
+ continue
+
+ qnorm_vals = normf(trait_vals)
+ qnorm_vals_with_x = []
+ counter = 0
+ for sample in sample_type.sample_list:
+ if sample.display_value == "x":
+ qnorm_vals_with_x.append("x")
+ else:
+ qnorm_vals_with_x.append(qnorm_vals[counter])
+ counter += 1
+
+ qnorm_by_group.append(qnorm_vals_with_x)
+
def get_nearest_marker(this_trait, this_db):
this_chr = this_trait.locus_chr
logger.debug("this_chr:", this_chr)
diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
index 3f2673c1..7d00d509 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
+++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
@@ -1560,7 +1560,7 @@
"AIL-LGSM-F34-A": {
"Phenotypes": [
[
- "None",
+ "655",
"AIL-LGSM-F34-APublish",
"AIL-LGSM-F34-A Phenotypes"
]
@@ -1569,7 +1569,7 @@
"AIL-LGSM-F34-F39-43-GBS": {
"Phenotypes": [
[
- "None",
+ "654",
"AIL-LGSM-F34-F39-43-GBSPublish",
"AIL-LGSM-F34-F39-43-GBS Phenotypes"
]
@@ -1578,7 +1578,7 @@
"AIL-LGSM-F34-GBS": {
"Phenotypes": [
[
- "None",
+ "656",
"AIL-LGSM-F34-GBSPublish",
"AIL-LGSM-F34-GBS Phenotypes"
]
@@ -1587,7 +1587,7 @@
"AIL-LGSM-F39-43-GBS": {
"Phenotypes": [
[
- "None",
+ "657",
"AIL-LGSM-F39-43-GBSPublish",
"AIL-LGSM-F39-43-GBS Phenotypes"
]
@@ -1713,11 +1713,6 @@
"B6D2F2": {
"Brain mRNA": [
[
- "77",
- "BRF2_M_0805_R",
- "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA"
- ],
- [
"76",
"BRF2_M_0805_M",
"OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5"
@@ -1728,6 +1723,11 @@
"OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN"
],
[
+ "77",
+ "BRF2_M_0805_R",
+ "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA"
+ ],
+ [
"33",
"BRF2_M_0304_P",
"OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN"
@@ -2082,16 +2082,16 @@
],
"Brain mRNA": [
[
- "164",
- "UTHSC_BXD_WB_RNASeq1112",
- "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Untrimmed"
- ],
- [
"590",
"UTHSC_BXD_WB_RNASeqtrim1_1112",
"UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Trimmed 1.0"
],
[
+ "164",
+ "UTHSC_BXD_WB_RNASeq1112",
+ "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Untrimmed"
+ ],
+ [
"394",
"UTHSC_BXD_WB_RNASeqEx1112",
"UTHSC Mouse BXD Whole Brain RNA Sequence Exon Level (Nov12) RPKM"
@@ -2233,11 +2233,6 @@
"Eye M430v2 WT Gpnmb (Sep08) RMA"
],
[
- "279",
- "Eye_M2_0908_R_WT",
- "Eye M430v2 WT Tyrp1 (Sep08) RMA"
- ],
- [
"278",
"Eye_M2_0908_R_MT",
"Eye M430v2 Mutant Tyrp1 (Sep08) RMA"
@@ -2248,6 +2243,11 @@
"Eye M430v2 WT WT (Sep08) RMA"
],
[
+ "279",
+ "Eye_M2_0908_R_WT",
+ "Eye M430v2 WT Tyrp1 (Sep08) RMA"
+ ],
+ [
"400",
"DBA2J-ONH-1212",
"Howell et al. 2011, DBA/2J Glaucoma Optic Nerve Head M430 2.0 (Dec12) RMA"
@@ -2531,16 +2531,16 @@
],
"Kidney mRNA": [
[
- "239",
- "MA_M2F_0706_R",
- "Mouse kidney M430v2 Female (Aug06) RMA"
- ],
- [
"240",
"MA_M2M_0706_R",
"Mouse kidney M430v2 Male (Aug06) RMA"
],
[
+ "239",
+ "MA_M2F_0706_R",
+ "Mouse kidney M430v2 Female (Aug06) RMA"
+ ],
+ [
"118",
"MA_M2_0806_R",
"Mouse kidney M430v2 Sex Balanced (Aug06) RMA"
@@ -2692,6 +2692,11 @@
"EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA"
],
[
+ "849",
+ "EPFLMouseLiverCDEx0413",
+ "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level"
+ ],
+ [
"848",
"EPFLMouseLiverHFCEx0413",
"EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level"
@@ -2702,11 +2707,6 @@
"EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA"
],
[
- "849",
- "EPFLMouseLiverCDEx0413",
- "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level"
- ],
- [
"433",
"EPFLMouseLiverBothExRMA0413",
"EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level"
@@ -3121,6 +3121,13 @@
]
},
"BXD-Harvested": {
+ "Hippocampus mRNA": [
+ [
+ "873",
+ "JAX-BXD-Hip-Pro-0219",
+ "JAX BXD Hippocampal Proteome (Feb19)"
+ ]
+ ],
"Liver mRNA": [
[
"843",
@@ -3539,11 +3546,6 @@
],
"Hippocampus mRNA": [
[
- "213",
- "Illum_LXS_Hipp_NOS_1008",
- "Hippocampus Illumina NOS (Oct08) RankInv beta"
- ],
- [
"219",
"Illum_LXS_Hipp_NON_1008",
"Hippocampus Illumina NON (Oct08) RankInv beta"
@@ -3564,6 +3566,11 @@
"Hippocampus Illumina RSS (Oct08) RankInv beta"
],
[
+ "213",
+ "Illum_LXS_Hipp_NOS_1008",
+ "Hippocampus Illumina NOS (Oct08) RankInv beta"
+ ],
+ [
"143",
"Illum_LXS_Hipp_loess0807",
"Hippocampus Illumina (Aug07) LOESS"
@@ -5333,6 +5340,10 @@
"Phenotypes"
],
[
+ "Hippocampus mRNA",
+ "Hippocampus mRNA"
+ ],
+ [
"Liver mRNA",
"Liver mRNA"
]
diff --git a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
index f2e694d8..fc6e5a78 100644
--- a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
@@ -2,12 +2,65 @@
var add_trait_data, assemble_into_json, back_to_collections, collection_click, collection_list, color_by_trait, create_trait_data_csv, get_this_trait_vals, get_trait_data, process_traits, selected_traits, submit_click, this_trait_data, trait_click,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
-collection_list = null;
-
this_trait_data = null;
selected_traits = {};
+$('#collections_list').attr("style", "width: 100%;");
+$('#trait_table').dataTable( {
+ "drawCallback": function( settings ) {
+ $('#trait_table tr').click(function(event) {
+ if (event.target.type !== 'checkbox') {
+ $(':checkbox', this).trigger('click');
+ }
+ });
+ },
+ "columns": [
+ { "type": "natural", "width": "3%" },
+ { "type": "natural", "width": "8%" },
+ { "type": "natural", "width": "20%" },
+ { "type": "natural", "width": "25%" },
+ { "type": "natural", "width": "25%" },
+ { "type": "natural", "width": "15%" }
+ ],
+ "columnDefs": [ {
+ "targets": 0,
+ "orderable": false
+ } ],
+ "order": [[1, "asc" ]],
+ "sDom": "RZtr",
+ "iDisplayLength": -1,
+ "autoWidth": true,
+ "bDeferRender": true,
+ "bSortClasses": false,
+ "paging": false,
+ "orderClasses": true
+} );
+
+$('#collection_table').dataTable( {
+ "createdRow": function ( row, data, index ) {
+ if ($('td', row).eq(2).text().length > 40) {
+ $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40));
+ $('td', row).eq(2).text($('td', row).eq(2).text() + '...')
+ }
+ if ($('td', row).eq(4).text().length > 50) {
+ $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50));
+ $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
+ }
+ },
+ "columnDefs": [ {
+ "targets": 0,
+ "orderable": false
+ } ],
+ "order": [[1, "asc" ]],
+ "sDom": "ZRtr",
+ "iDisplayLength": -1,
+ "autoWidth": true,
+ "bSortClasses": false,
+ "paging": false,
+ "orderClasses": true
+} );
+
collection_click = function() {
var this_collection_url;
console.log("Clicking on:", $(this));
@@ -28,16 +81,20 @@ submit_click = function() {
$('#collections_holder').find('input[type=checkbox]:checked').each(function() {
var this_dataset, this_trait;
this_trait = $(this).parents('tr').find('.trait').text();
+ this_description = $(this).parents('tr').find('.description').text();
console.log("this_trait is:", this_trait);
- this_dataset = $(this).parents('tr').find('.dataset').text();
+ this_dataset = $(this).parents('tr').find('.dataset').data("dataset");
console.log("this_dataset is:", this_dataset);
covariates_string += this_trait + ":" + this_dataset + ","
- covariates_display_string += this_trait + "\n"
+ this_covariate_display_string = this_trait + ": " + this_description
+ if (this_covariate_display_string.length > 50) {
+ this_covariate_display_string = this_covariate_display_string.substring(0, 45) + "..."
+ }
+ covariates_display_string += this_covariate_display_string + "\n"
});
// Trim the last comma
covariates_string = covariates_string.substring(0, covariates_string.length - 1)
//covariates_display_string = covariates_display_string.substring(0, covariates_display_string.length - 2)
- console.log("COVARIATES:", covariates_string)
$("input[name=covariates]").val(covariates_string)
$(".selected_covariates").val(covariates_display_string)
@@ -125,17 +182,16 @@ process_traits = function(trait_data, textStatus, jqXHR) {
the_html = "<button id='back_to_collections' class='btn btn-inverse btn-small'>";
the_html += "<i class='icon-white icon-arrow-left'></i> Back </button>";
the_html += " <button id='submit' class='btn btn-primary btn-small'> Submit </button>";
- the_html += "<table class='table table-hover'>";
- the_html += "<thead><tr><th></th><th>Record</th><th>Data Set</th><th>Description</th><th>Mean</th></tr></thead>";
+ the_html += "<table id='collection_table' style='padding-top: 10px;' class='table table-hover'>";
+ the_html += "<thead><tr><th></th><th>Record</th><th>Data Set</th><th>Description</th></tr></thead>";
the_html += "<tbody>";
for (_i = 0, _len = trait_data.length; _i < _len; _i++) {
trait = trait_data[_i];
the_html += "<tr class='trait_line'>";
the_html += "<td class='select_trait'><input type='checkbox' name='selectCheck' class='checkbox edit_sample_checkbox'></td>";
the_html += "<td class='trait'>" + trait.name + "</td>";
- the_html += "<td class='dataset'>" + trait.dataset + "</td>";
- the_html += "<td>" + trait.description + "</td>";
- the_html += "<td>" + (trait.mean || '&nbsp;') + "</td></tr>";
+ the_html += "<td class='dataset' data-dataset='" + trait.dataset + "'>" + trait.dataset_name + "</td>";
+ the_html += "<td class='description'>" + trait.description + "</td>";
}
the_html += "</tbody>";
the_html += "</table>";
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 210945f0..bcb67527 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -2,8 +2,6 @@ var Stat_Table_Rows, is_number,
__hasProp = {}.hasOwnProperty,
__slice = [].slice;
-console.log("start_b");
-
is_number = function(o) {
return !isNaN((o - 0) && o !== null);
};
@@ -65,7 +63,6 @@ var add, block_by_attribute_value, block_by_index, block_outliers, change_stats_
add = function() {
var trait;
trait = $("input[name=trait_hmac]").val();
- console.log("trait is:", trait);
return $.colorbox({
href: "/collections/add?traits=" + trait
});
@@ -100,9 +97,7 @@ open_trait_selection = function() {
inline: true,
href: "#collections_holder",
onComplete: function(){
- console.log("before get script")
$.getScript("/static/new/javascript/get_traits_from_collection.js");
- console.log("after get script")
}
});
return $('a.collection_name').attr('onClick', 'return false');
@@ -115,10 +110,10 @@ open_covariate_selection = function() {
$.colorbox({
inline: true,
href: "#collections_holder",
+ width: "1000px",
+ height: "700px",
onComplete: function(){
- console.log("before get cov script")
$.getScript("/static/new/javascript/get_covariates_from_collection.js");
- console.log("after get cov script")
}
});
return $('a.collection_name').attr('onClick', 'return false');
@@ -142,21 +137,16 @@ stats_mdp_change = function() {
change_stats_value = function(sample_sets, category, value_type, decimal_places, effects) {
var current_value, id, in_box, the_value, title_value;
id = "#" + process_id(category, value_type);
- console.log("the_id:", id);
in_box = $(id).html;
current_value = parseFloat($(in_box)).toFixed(decimal_places);
the_value = sample_sets[category][value_type]();
- console.log("After running sample_sets, the_value is:", the_value);
if (decimal_places > 0) {
title_value = the_value.toFixed(decimal_places * 2);
the_value = the_value.toFixed(decimal_places);
} else {
title_value = null;
}
- console.log("*-* the_value:", the_value);
- console.log("*-* current_value:", current_value);
if (the_value !== current_value) {
- console.log("object:", $(id).html(the_value));
if (effects) {
$(id).html(the_value).effect("highlight");
} else {
@@ -179,7 +169,6 @@ update_stat_values = function(sample_sets) {
_results1 = [];
for (_j = 0, _len1 = Stat_Table_Rows.length; _j < _len1; _j++) {
row = Stat_Table_Rows[_j];
- console.log("Calling change_stats_value");
_results1.push(change_stats_value(sample_sets, category, row.vn, row.digits, show_effects));
}
return _results1;
@@ -356,7 +345,6 @@ process_id = function() {
processed = "";
for (_i = 0, _len = values.length; _i < _len; _i++) {
value = values[_i];
- console.log("value:", value);
value = value.replace(" ", "_");
if (processed.length) {
processed += "-";
@@ -378,7 +366,6 @@ edit_data_change = function() {
samples_other: {},
samples_all: {}
};
- console.log("at beginning:", sample_sets);
tables = ['samples_primary', 'samples_other'];
for (_i = 0, _len = tables.length; _i < _len; _i++) {
table = tables[_i];
@@ -412,39 +399,30 @@ edit_data_change = function() {
}
}
}
- console.log("towards end:", sample_sets);
update_stat_values(sample_sets);
if ($('#histogram').hasClass('js-plotly-plot')){
- console.log("redrawing histogram");
redraw_histogram();
}
if ($('#bar_chart').hasClass('js-plotly-plot')){
- console.log("redrawing bar chart");
redraw_bar_chart();
}
if ($('#box_plot').hasClass('js-plotly-plot')){
- console.log("redrawing box plot");
redraw_box_plot();
}
if ($('#violin_plot').hasClass('js-plotly-plot')){
- console.log("redrawing violin plot");
redraw_violin_plot();
}
if ($('#prob_plot_div').hasClass('js-plotly-plot')){
- console.log("redrawing probability plot");
return redraw_prob_plot();
}
};
show_hide_outliers = function() {
var label;
- console.log("FOOBAR in beginning of show_hide_outliers");
label = $('#show_hide_outliers').val();
- console.log("lable is:", label);
if (label === "Hide Outliers") {
return $('#show_hide_outliers').val("Show Outliers");
} else if (label === "Show Outliers") {
- console.log("Found Show Outliers");
$('#show_hide_outliers').val("Hide Outliers");
return console.log("Should be now Hide Outliers");
}
@@ -452,7 +430,6 @@ show_hide_outliers = function() {
on_corr_method_change = function() {
var corr_method;
corr_method = $('select[name=corr_type]').val();
- console.log("corr_method is:", corr_method);
$('.correlation_desc').hide();
$('#' + corr_method + "_r_desc").show().effect("highlight");
if (corr_method === "lit") {
@@ -487,7 +464,6 @@ create_value_dropdown = function(value) {
};
populate_sample_attributes_values_dropdown = function() {
var attribute_info, key, sample_attributes, selected_attribute, value, _i, _len, _ref, _ref1, _results;
- console.log("in beginning of psavd");
$('#attribute_values').empty();
sample_attributes = {};
_ref = js_data.attribute_names;
@@ -496,9 +472,7 @@ populate_sample_attributes_values_dropdown = function() {
attribute_info = _ref[key];
sample_attributes[attribute_info.name] = attribute_info.distinct_values;
}
- console.log("[visa] attributes is:", sample_attributes);
selected_attribute = $('#exclude_menu').val().replace("_", " ");
- console.log("selected_attribute is:", selected_attribute);
_ref1 = sample_attributes[selected_attribute];
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
@@ -507,7 +481,7 @@ populate_sample_attributes_values_dropdown = function() {
}
return _results;
};
-if (js_data.attribute_names.length > 0) {
+if (Object.keys(js_data.attribute_names).length > 0) {
populate_sample_attributes_values_dropdown();
}
$('#exclude_menu').change(populate_sample_attributes_values_dropdown);
@@ -547,21 +521,15 @@ block_by_index = function() {
}
} else {
index = parseInt(index_set);
- console.log("index:", index);
index_list.push(index);
}
}
- console.log("index_list:", index_list);
_results = [];
for (_k = 0, _len1 = index_list.length; _k < _len1; _k++) {
index = index_list[_k];
if ($('#block_group').val() === "primary") {
- console.log("block_group:", $('#block_group').val());
- console.log("row:", $('#Primary_' + index.toString()));
_results.push($('#Primary_' + index.toString()).find('.trait_value_input').val("x"));
} else if ($('#block_group').val() === "other") {
- console.log("block_group:", $('#block_group').val());
- console.log("row:", $('#Other_' + index.toString()));
_results.push($('#Other_' + index.toString()).find('.trait_value_input').val("x"));
} else {
_results.push(void 0);
@@ -592,9 +560,7 @@ reset_samples_table = function() {
$('input[name="transform"]').val("");
return $('.trait_value_input').each((function(_this) {
return function(_index, element) {
- console.log("value is:", $(element).val());
$(element).val($(element).data('value'));
- console.log("data-value is:", $(element).data('value'));
return $(element).parents('.value_se').show();
};
})(this));
@@ -629,6 +595,21 @@ sqrt_normalize_data = function() {
})(this));
};
+invert_data = function() {
+ return $('.edit_sample_value').each((function(_this) {
+ return function(_index, element) {
+ current_value = parseFloat($(element).val());
+ if(isNaN(current_value)) {
+ return current_value
+ } else {
+ $(element).val(-(current_value));
+ return -(current_value)
+ }
+ };
+ })(this));
+};
+
+
qnorm_data = function() {
return $('.edit_sample_value').each((function(_this) {
return function(_index, element) {
@@ -656,6 +637,9 @@ normalize_data = function() {
$('input[name="transform"]').val("sqrt")
}
}
+ else if ($('#norm_method option:selected').val() == 'invert'){
+ invert_data()
+ }
else if ($('#norm_method option:selected').val() == 'qnorm'){
if ($('input[name="transform"]').val() != "qnorm") {
qnorm_data()
@@ -696,7 +680,6 @@ get_sample_table_data = function(table_name) {
attribute_info = _ref[key];
row_data[attribute_info.name] = $.trim($(element).find('.column_name-' + attribute_info.name.replace(" ", "_")).text());
}
- console.log("row_data is:", row_data);
return samples.push(row_data);
};
})(this));
@@ -707,18 +690,14 @@ export_sample_table_data = function() {
sample_data = {};
sample_data.primary_samples = get_sample_table_data('samples_primary');
sample_data.other_samples = get_sample_table_data('samples_other');
- console.log("sample_data is:", sample_data);
json_sample_data = JSON.stringify(sample_data);
- console.log("json_sample_data is:", json_sample_data);
$('input[name=export_data]').val(json_sample_data);
- console.log("export_data is", $('input[name=export_data]').val());
format = $('input[name=export_format]').val();
if (format === "excel") {
$('#trait_data_form').attr('action', '/export_trait_excel');
} else {
$('#trait_data_form').attr('action', '/export_trait_csv');
}
- console.log("action is:", $('#trait_data_form').attr('action'));
return $('#trait_data_form').submit();
};
@@ -728,9 +707,7 @@ $('.export_format').change(function() {
});
$('.export').click(export_sample_table_data);
-console.log("before registering block_outliers");
$('#block_outliers').click(block_outliers);
-console.log("after registering block_outliers");
_.mixin(_.str.exports());
get_sample_vals = function(sample_list) {
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 36a25665..31a5b94e 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -117,7 +117,7 @@
</form>
<br />
- <div id="table_container">
+ <div id="table_container" style="width: 1400px;">
<table class="table-hover table-striped cell-border" id='trait_table' style="float: left;">
<tbody>
<td colspan="100%" align="center"><br><b><font size="15">Loading...</font></b><br></td>
@@ -224,10 +224,6 @@
}
$('td', row).eq(4).attr('title', $('td', row).eq(4).text());
$('td', row).eq(4).attr('data-export', $('td', row).eq(4).text());
- if ($('td', row).eq(4).text().length > 55) {
- $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 55));
- $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
- }
$('td', row).slice(6,10).attr("align", "right");
$('td', row).eq(5).attr('data-export', $('td', row).eq(5).text());
$('td', row).eq(6).attr('data-export', $('td', row).eq(6).text());
@@ -237,16 +233,8 @@
{% elif dataset.type == 'Publish' %}
$('td', row).eq(3).attr('title', $('td', row).eq(3).text());
$('td', row).eq(3).attr('data-export', $('td', row).eq(3).text());
- if ($('td', row).eq(3).text().length > 20) {
- $('td', row).eq(3).text($('td', row).eq(3).text().substring(0, 20));
- $('td', row).eq(3).text($('td', row).eq(3).text() + '...')
- }
$('td', row).eq(4).attr('title', $('td', row).eq(4).text());
$('td', row).eq(4).attr('data-export', $('td', row).eq(4).text());
- if ($('td', row).eq(4).text().length > 55) {
- $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 55));
- $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
- }
$('td', row).slice(6,9).attr("align", "right");
$('td', row).eq(5).attr('data-export', $('td', row).eq(5).text());
$('td', row).eq(6).attr('data-export', $('td', row).eq(6).text());
@@ -288,6 +276,7 @@
{
'title': "Description",
'type': "natural",
+ 'width': "500px",
'data': "description"
},
{
@@ -321,11 +310,13 @@
{
'title': "Description",
'type': "natural",
+ 'width': "500px",
'data': "description"
},
{
'title': "Authors",
'type': "natural",
+ 'width': "300px",
'data': "authors"
},
{
@@ -351,17 +342,20 @@
{
'title': "Max LRS Location",
'type': "natural",
+ 'width': "160px",
'data': "lrs_location"
},
{
- 'title': "Additive Effect<a href=\"http://genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'title': "Additive<br>Effect<a href=\"http://genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
'type': "natural",
+ 'width': "100px",
'data': "additive",
'orderSequence': [ "desc", "asc"]
}{% elif dataset.type == 'Geno' %},
{
'title': "Location",
'type': "natural",
+ 'width': "160px",
'data': "location"
}{% endif %}
],
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index def40f5d..9d2cb7ed 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -10,7 +10,6 @@
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
<link rel="stylesheet" type="text/css" href="/static/new/packages/noUiSlider/nouislider.css" />
<link rel="stylesheet" type="text/css" href="/static/new/packages/noUiSlider/nouislider.pips.css" />
- <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" />
{% endblock %}
@@ -142,7 +141,6 @@
<script type="text/javascript" src="/static/new/javascript/scatter-matrix.js"></script>
<script type="text/javascript" src="/static/new/javascript/plotly_probability_plot.js"></script>
<script type="text/javascript" src="/static/new/javascript/compare_traits_scatterplot.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/get_covariates_from_collection.js"></script>
<script type="text/javascript" src="/static/new/javascript/show_trait_mapping_tools.js"></script>
<script type="text/javascript" src="/static/new/javascript/show_trait.js"></script>
@@ -152,6 +150,8 @@
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.scientific.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/noUiSlider/nouislider.js"></script>
+ <script language="javascript" type="text/javascript" src="/static/new/javascript/get_covariates_from_collection.js"></script>
+
<script type="text/javascript" charset="utf-8">
$.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col )
@@ -177,6 +177,22 @@
}
});
+ //ZS: This variable is just created to get the column position of the first case attribute, since it's needed to set the row classes in createdRow for the DataTable
+ {% if sample_groups[0].attributes|length > 0 %}
+ {% if sample_groups[0].se_exists() %}
+ {% if has_num_cases %}
+ attribute_start_pos = 6
+ {% else %}
+ attribute_start_pos = 5
+ {% endif %}
+ {% else %}
+ {% if has_num_cases %}
+ attribute_start_pos = 4
+ {% else %}
+ attribute_start_pos = 3
+ {% endif %}
+ {% endif %}
+ {% endif %}
$('#samples_primary').DataTable( {
'initComplete': function(settings, json) {
@@ -210,6 +226,11 @@
$('td', row).eq(4).addClass("column_name-num_cases")
$('td', row).eq(4).attr("style", "text-align: right; padding-top: 2px; padding-bottom: 0px;");
{% endif %} {% endif %}
+ {% if sample_groups[0].attributes|length > 0 %}
+ {% for attribute in sample_groups[0].attributes|sort() %}
+ $('td', row).eq(attribute_start_pos + {{ loop.index }}).addClass("column_name-{{ sample_groups[0].attributes[attribute].name }}")
+ {% endfor %}
+ {% endif %}
},
'data': js_data['sample_lists'][0],
'columns': [
@@ -335,6 +356,11 @@
$('td', row).eq(4).addClass("column_name-num_cases")
$('td', row).eq(4).attr("style", "text-align: right; padding-top: 2px; padding-bottom: 0px;");
{% endif %} {% endif %}
+ {% if sample_groups[1].attributes|length > 0 %}
+ {% for attribute in sample_groups[1].attributes|sort() %}
+ $('td', row).eq(attribute_start_pos + {{ loop.index }}).addClass("column_name-{{ sample_groups[1].attributes[attribute].name }}")
+ {% endfor %}
+ {% endif %}
},
'data': js_data['sample_lists'][1],
'columns': [
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index e7f3eca3..e79cf1ab 100644
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -89,7 +89,7 @@
<button type="button" id="select_covariates" class="btn btn-default">Select</button>
<button type="button" id="remove_covariates" class="btn btn-default">Remove</button>
</div>
- <textarea rows="3" cols="20" readonly placeholder="No covariates selected" style="overflow-y: scroll; resize: none;" class="selected_covariates"></textarea>
+ <textarea rows="3" cols="50" readonly placeholder="No covariates selected" style="overflow-y: scroll; resize: none;" class="selected_covariates"></textarea>
{% endif %}
{% elif g.cookie_session.display_num_collections() == "" %}
No collections available. Please add traits to a collection to use them as covariates.
diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
index d1765778..04ceaeaf 100644
--- a/wqflask/wqflask/templates/show_trait_transform_and_filter.html
+++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
@@ -54,6 +54,7 @@
<option value="log2">Log2</option>
<option value="qnorm">Quantile</option>
<option value="sqrt">Square Root</option>
+ <option value="invert">Invert +/-</option>
</select>
</div>
<!--