diff options
32 files changed, 795 insertions, 321 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 4959457a..dbdbb51c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -169,7 +169,7 @@ def mescape(*items): class Markers(object): """Todo: Build in cacheing so it saves us reading the same file more than once""" def __init__(self, name): - json_data_fh = open(locate(name + '.json','genotype/json')) + json_data_fh = open(locate(name + ".json",'genotype/json')) try: markers = json.load(json_data_fh) except: @@ -334,7 +334,10 @@ class DatasetGroup(object): else: marker_class = Markers - self.markers = marker_class(self.name) + if self.genofile: + self.markers = marker_class(self.genofile[:-5]) + else: + self.markers = marker_class(self.name) def get_f1_parent_strains(self): try: diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index e22a51e4..acc055d8 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -206,6 +206,8 @@ class GeneralTrait(object): formatted = self.description if self.probe_target_description: formatted += "; " + self.probe_target_description + else: + formatted = "Not available" elif self.dataset.type == 'Publish': if self.confidential: formatted = self.pre_publication_description @@ -290,7 +292,6 @@ def retrieve_sample_data(trait, dataset, samplelist=None): name, value, variance, num_cases, name2 = item if not samplelist or (samplelist and name in samplelist): trait.data[name] = webqtlCaseData(*item) #name, value, variance, num_cases) - return trait def convert_location_to_value(chromosome, mb): diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index 845a7224..24de8dcb 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -44,9 +44,9 @@ class webqtlCaseData(object): def __repr__(self): str = "<webqtlCaseData> " - if self.value: + if self.value != None: str += "value=%2.3f" % self.value - if self.variance: + if self.variance != None: str += " variance=%2.3f" % self.variance if self.num_cases: str += " ndata=%d" % self.num_cases @@ -66,14 +66,14 @@ class webqtlCaseData(object): @property def display_value(self): - if self.value: + if self.value != None: return "%2.3f" % self.value else: return "x" @property def display_variance(self): - if self.variance: + if self.variance != None: return "%2.3f" % self.variance else: return "x" diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 393ff2df..867bc5c8 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -108,13 +108,13 @@ def js_path(module=None): raise "No JS path found for "+module+" (check JS_GN_PATH)" def pylmm_command(guess=None): - return valid_bin(get_setting("PYLMM_COMMAND",guess)) + return assert_bin(get_setting("PYLMM_COMMAND",guess)) def gemma_command(guess=None): - return valid_bin(get_setting("GEMMA_COMMAND",guess)) + return assert_bin(get_setting("GEMMA_COMMAND",guess)) def plink_command(guess=None): - return valid_bin(get_setting("PLINK_COMMAND",guess)) + return assert_bin(get_setting("PLINK_COMMAND",guess)) def flat_file_exists(subdir): base = get_setting("GENENETWORK_FILES") @@ -126,6 +126,11 @@ def flat_files(subdir=None): return assert_dir(base+"/"+subdir) return assert_dir(base) +def assert_bin(fn): + if not valid_bin(fn): + raise Exception("ERROR: can not find binary "+fn) + return fn + def assert_dir(dir): if not valid_path(dir): raise Exception("ERROR: can not find directory "+dir) @@ -235,9 +240,9 @@ JS_GUIX_PATH = get_setting('JS_GUIX_PATH') JS_GN_PATH = get_setting('JS_GN_PATH') # assert_dir(JS_GN_PATH) -PYLMM_COMMAND = app_set("PYLMM_COMMAND",pylmm_command()) -GEMMA_COMMAND = app_set("GEMMA_COMMAND",gemma_command()) -PLINK_COMMAND = app_set("PLINK_COMMAND",plink_command()) +PYLMM_COMMAND = pylmm_command() +GEMMA_COMMAND = gemma_command() +PLINK_COMMAND = plink_command() TEMPDIR = tempdir() # defaults to UNIX TMPDIR # ---- Handle specific JS modules diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 95a5f6a6..b34beb7b 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -72,7 +72,14 @@ class CorrelationMatrix(object): self.all_sample_list = [] self.traits = [] + self.insufficient_shared_samples = False + this_group = self.trait_list[0][1].group.name #ZS: Getting initial group name before verifying all traits are in the same group in the following loop for trait_db in self.trait_list: + if trait_db[1].group.name != this_group: + self.insufficient_shared_samples = True + break + else: + this_group = trait_db[1].group.name this_trait = trait_db[0] self.traits.append(this_trait) this_sample_data = this_trait.data @@ -81,100 +88,102 @@ class CorrelationMatrix(object): if sample not in self.all_sample_list: self.all_sample_list.append(sample) - self.sample_data = [] - for trait_db in self.trait_list: - this_trait = trait_db[0] - this_sample_data = this_trait.data - - this_trait_vals = [] - for sample in self.all_sample_list: - if sample in this_sample_data: - this_trait_vals.append(this_sample_data[sample].value) - else: - this_trait_vals.append('') - self.sample_data.append(this_trait_vals) + if self.insufficient_shared_samples: + pass + else: + self.sample_data = [] + for trait_db in self.trait_list: + this_trait = trait_db[0] + this_sample_data = this_trait.data - if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples - return False + this_trait_vals = [] + for sample in self.all_sample_list: + if sample in this_sample_data: + this_trait_vals.append(this_sample_data[sample].value) + else: + this_trait_vals.append('') + self.sample_data.append(this_trait_vals) - self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning) + if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples + return False - self.corr_results = [] - self.pca_corr_results = [] - self.trait_data_array = [] - for trait_db in self.trait_list: - this_trait = trait_db[0] - this_db = trait_db[1] + self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning) - this_db_samples = this_db.group.all_samples_ordered() - this_sample_data = this_trait.data + self.corr_results = [] + self.pca_corr_results = [] + self.trait_data_array = [] + for trait_db in self.trait_list: + this_trait = trait_db[0] + this_db = trait_db[1] - this_trait_vals = [] - for index, sample in enumerate(this_db_samples): - if (sample in this_sample_data): - sample_value = this_sample_data[sample].value - this_trait_vals.append(sample_value) - self.trait_data_array.append(this_trait_vals) - - corr_result_row = [] - pca_corr_result_row = [] - is_spearman = False #ZS: To determine if it's above or below the diagonal - for target in self.trait_list: - target_trait = target[0] - target_db = target[1] - target_samples = target_db.group.all_samples_ordered() - target_sample_data = target_trait.data + this_db_samples = this_db.group.all_samples_ordered() + this_sample_data = this_trait.data this_trait_vals = [] - target_vals = [] - for index, sample in enumerate(target_samples): - if (sample in this_sample_data) and (sample in target_sample_data): + for index, sample in enumerate(this_db_samples): + if (sample in this_sample_data): sample_value = this_sample_data[sample].value - target_sample_value = target_sample_data[sample].value this_trait_vals.append(sample_value) - target_vals.append(target_sample_value) - - this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals) - - if num_overlap < self.lowest_overlap: - self.lowest_overlap = num_overlap - if num_overlap == 0: - corr_result_row.append([target_trait, 0, num_overlap]) - pca_corr_result_row.append(0) - else: - pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals) - if is_spearman == False: - sample_r, sample_p = pearson_r, pearson_p - if sample_r == 1: - is_spearman = True + self.trait_data_array.append(this_trait_vals) + + corr_result_row = [] + pca_corr_result_row = [] + is_spearman = False #ZS: To determine if it's above or below the diagonal + for target in self.trait_list: + target_trait = target[0] + target_db = target[1] + target_samples = target_db.group.all_samples_ordered() + target_sample_data = target_trait.data + + this_trait_vals = [] + target_vals = [] + for index, sample in enumerate(target_samples): + if (sample in this_sample_data) and (sample in target_sample_data): + sample_value = this_sample_data[sample].value + target_sample_value = target_sample_data[sample].value + this_trait_vals.append(sample_value) + target_vals.append(target_sample_value) + + this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals) + + if num_overlap < self.lowest_overlap: + self.lowest_overlap = num_overlap + if num_overlap == 0: + corr_result_row.append([target_trait, 0, num_overlap]) + pca_corr_result_row.append(0) else: - sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - - corr_result_row.append([target_trait, sample_r, num_overlap]) - pca_corr_result_row.append(pearson_r) + pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals) + if is_spearman == False: + sample_r, sample_p = pearson_r, pearson_p + if sample_r == 1: + is_spearman = True + else: + sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - self.corr_results.append(corr_result_row) - self.pca_corr_results.append(pca_corr_result_row) + corr_result_row.append([target_trait, sample_r, num_overlap]) + pca_corr_result_row.append(pearson_r) - corr_result_eigen = la.eigenvectors(numarray.array(self.pca_corr_results)) - corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen) + self.corr_results.append(corr_result_row) + self.pca_corr_results.append(pca_corr_result_row) - groups = [] - for sample in self.all_sample_list: - groups.append(1) + corr_result_eigen = la.eigenvectors(numarray.array(self.pca_corr_results)) + corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen) - pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors) + groups = [] + for sample in self.all_sample_list: + groups.append(1) - self.loadings_array = self.process_loadings() + pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors) - self.js_data = dict(traits = [trait.name for trait in self.traits], - groups = groups, - cols = range(len(self.traits)), - rows = range(len(self.traits)), - samples = self.all_sample_list, - sample_data = self.sample_data,) - # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) + self.loadings_array = self.process_loadings() + self.js_data = dict(traits = [trait.name for trait in self.traits], + groups = groups, + cols = range(len(self.traits)), + rows = range(len(self.traits)), + samples = self.all_sample_list, + sample_data = self.sample_data,) + # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) def get_trait_db_obs(self, trait_db_list): diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 8882c515..60424468 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -148,6 +148,10 @@ class MarkerRegression(object): self.showGenes = "ON" self.viewLegend = "ON" + if 'genofile' in start_vars: + if start_vars['genofile'] != "": + self.genofile_string = start_vars['genofile'] + self.dataset.group.genofile = self.genofile_string.split(":")[0] self.dataset.group.get_markers() if self.mapping_method == "gemma": self.score_type = "-log(p)" @@ -162,11 +166,10 @@ class MarkerRegression(object): self.mapping_scale = "morgan" self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] - self.dataset.group.genofile = start_vars['genofile'] self.method = start_vars['mapmethod_rqtl_geno'] self.model = start_vars['mapmodel_rqtl_geno'] - if start_vars['pair_scan'] == "true": - self.pair_scan = True + #if start_vars['pair_scan'] == "true": + # self.pair_scan = True if self.permCheck and self.num_perm > 0: self.perm_output, self.suggestive, self.significant, results = rqtl_mapping.run_rqtl_geno(self.vals, self.dataset, self.method, self.model, self.permCheck, self.num_perm, self.do_control, self.control_marker, self.manhattan_plot, self.pair_scan) else: @@ -198,7 +201,6 @@ class MarkerRegression(object): self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] - self.dataset.group.genofile = start_vars['genofile'] logger.info("Running qtlreaper") results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait, self.dataset, @@ -217,7 +219,6 @@ class MarkerRegression(object): #results = self.run_plink() elif self.mapping_method == "pylmm": logger.debug("RUNNING PYLMM") - self.dataset.group.genofile = start_vars['genofile'] if self.num_perm > 0: self.run_permutations(str(temp_uuid)) results = self.gen_data(str(temp_uuid)) diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index 82a44796..08332e7d 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -171,6 +171,8 @@ class MarkerRegression(object): self.dataset = start_vars['dataset'] self.this_trait = start_vars['this_trait'] self.species = start_vars['species'] + if 'genofile_string' in start_vars: + self.genofile_string = start_vars['genofile_string'] #Needing for form submission when doing single chr mapping or remapping after changing options self.samples = start_vars['samples'] @@ -445,7 +447,7 @@ class MarkerRegression(object): if self.haplotypeAnalystChecked and self.selectedChr > -1: #thisTrait = self.traitList[0] thisTrait = self.this_trait - _strains, _vals, _vars = thisTrait.export_informative() + _strains, _vals, _vars, _aliases = thisTrait.export_informative() smd=[] for ii, _val in enumerate(_vals): temp = GeneralObject(name=_strains[ii], value=_val) @@ -1050,7 +1052,10 @@ class MarkerRegression(object): startPosY = 15 nCol = 2 smallLabelFont = pid.Font(ttf="trebuc", size=12*fontZoom, bold=1) - leftOffset = xLeftOffset+(nCol-1)*200*fontZoom + if self.manhattan_plot: + leftOffset = xLeftOffset + else: + leftOffset = xLeftOffset+(nCol-1)*200*fontZoom canvas.drawPolygon(((leftOffset+6, startPosY-6), (leftOffset, startPosY+6), (leftOffset+12, startPosY+6)), edgeColor=pid.black, fillColor=self.TRANSCRIPT_LOCATION_COLOR, closed=1) canvas.drawString("Sequence Site", (leftOffset+15), (startPosY+5), smallLabelFont, self.TOP_RIGHT_INFO_COLOR) @@ -1141,9 +1146,10 @@ class MarkerRegression(object): labelFont=pid.Font(ttf="trebuc",size=12*fontZoom, bold=1) startPosY = 15 stepPosY = 12*fontZoom - canvas.drawLine(xLeftOffset,startPosY,xLeftOffset+32,startPosY,color=self.LRS_COLOR, width=2) - canvas.drawString(self.LRS_LOD, xLeftOffset+40,startPosY+5,font=labelFont,color=pid.black) - startPosY += stepPosY + if self.manhattan_plot != True: + canvas.drawLine(xLeftOffset,startPosY,xLeftOffset+32,startPosY,color=self.LRS_COLOR, width=2) + canvas.drawString(self.LRS_LOD, xLeftOffset+40,startPosY+5,font=labelFont,color=pid.black) + startPosY += stepPosY if self.additiveChecked: startPosX = xLeftOffset @@ -1434,7 +1440,7 @@ class MarkerRegression(object): #thisTrait = self.traitList[0] thisTrait = self.this_trait - _strains, _vals, _vars = thisTrait.export_informative() + _strains, _vals, _vars, _aliases = thisTrait.export_informative() smd=[] for ii, _val in enumerate(_vals): diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index cebe5c03..7eb5be61 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -181,12 +181,27 @@ class NetworkGraph(object): self.edges_list.append(edge_dict) - node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), - 'label' : this_trait.name, - 'symbol' : this_trait.symbol, - 'geneid' : this_trait.geneid, - 'omim' : this_trait.omim, - 'max_corr' : max_corr } } + if trait_db[1].type == "ProbeSet": + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'name' : str(this_trait.name), + 'dataset' : str(this_trait.dataset.name), + 'label' : this_trait.symbol, + 'symbol' : this_trait.symbol, + 'geneid' : this_trait.geneid, + 'omim' : this_trait.omim, + 'max_corr' : max_corr } } + elif trait_db[1].type == "Publish": + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'name' : str(this_trait.name), + 'dataset' : str(this_trait.dataset.name), + 'label' : this_trait.name, + 'max_corr' : max_corr } } + else: + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'name' : str(this_trait.name), + 'dataset' : str(this_trait.dataset.name), + 'label' : this_trait.name, + 'max_corr' : max_corr } } self.nodes_list.append(node_dict) #self.network_data['dataSchema'] = {'nodes' : [{'name' : "label" , 'type' : "string"}], @@ -211,7 +226,6 @@ class NetworkGraph(object): # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) def get_trait_db_obs(self, trait_db_list): - self.trait_list = [] for i, trait_db in enumerate(trait_db_list): if i == (len(trait_db_list) - 1): diff --git a/wqflask/wqflask/static/new/css/network_graph.css b/wqflask/wqflask/static/new/css/network_graph.css index 1cba546a..1a0bafeb 100644 --- a/wqflask/wqflask/static/new/css/network_graph.css +++ b/wqflask/wqflask/static/new/css/network_graph.css @@ -14,7 +14,6 @@ position: relative; float: left; width: 18.5em; - padding: 1em 1em 1em 1em; background: #fff url('/static/new/images/a1.gif') top right repeat-y; } diff --git a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js new file mode 100644 index 00000000..c267b045 --- /dev/null +++ b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js @@ -0,0 +1,238 @@ +// Generated by CoffeeScript 1.8.0 +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; }; + +console.log("before get_traits_from_collection"); + +collection_list = null; + +this_trait_data = null; + +selected_traits = {}; + +collection_click = function() { + var this_collection_url; + console.log("Clicking on:", $(this)); + this_collection_url = $(this).find('.collection_name').prop("href"); + this_collection_url += "&json"; + console.log("this_collection_url", this_collection_url); + collection_list = $("#collections_holder").html(); + return $.ajax({ + dataType: "json", + url: this_collection_url, + success: process_traits + }); +}; + +submit_click = function() { + var all_vals, sample, samples, scatter_matrix, this_trait_vals, trait, trait_names, trait_vals_csv, traits, _i, _j, _len, _len1, _ref; + selected_traits = {}; + traits = []; + $('#collections_holder').find('input[type=checkbox]:checked').each(function() { + var this_dataset, this_trait, this_trait_url; + this_trait = $(this).parents('tr').find('.trait').text(); + console.log("this_trait is:", this_trait); + this_dataset = $(this).parents('tr').find('.dataset').text(); + console.log("this_dataset is:", this_dataset); + this_trait_url = "/trait/get_sample_data?trait=" + this_trait + "&dataset=" + this_dataset; + return $.ajax({ + dataType: "json", + url: this_trait_url, + async: false, + success: add_trait_data + }); + }); + console.log("SELECTED_TRAITS IS:", selected_traits); + trait_names = []; + samples = $('input[name=allsamples]').val().split(" "); + all_vals = []; + this_trait_vals = get_this_trait_vals(samples); + all_vals.push(this_trait_vals); + _ref = Object.keys(selected_traits); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + trait = _ref[_i]; + trait_names.push(trait); + this_trait_vals = []; + for (_j = 0, _len1 = samples.length; _j < _len1; _j++) { + sample = samples[_j]; + if (__indexOf.call(Object.keys(selected_traits[trait]), sample) >= 0) { + this_trait_vals.push(parseFloat(selected_traits[trait][sample])); + } else { + this_trait_vals.push(null); + } + } + all_vals.push(this_trait_vals); + } + trait_vals_csv = create_trait_data_csv(selected_traits); + scatter_matrix = new ScatterMatrix(trait_vals_csv); + scatter_matrix.render(); + return $.colorbox.close(); +}; + +create_trait_data_csv = function(selected_traits) { + var all_vals, index, sample, sample_vals, samples, this_trait_vals, trait, trait_names, trait_vals_csv, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref; + trait_names = []; + trait_names.push($('input[name=trait_id]').val()); + samples = $('input[name=allsamples]').val().split(" "); + all_vals = []; + this_trait_vals = get_this_trait_vals(samples); + all_vals.push(this_trait_vals); + _ref = Object.keys(selected_traits); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + trait = _ref[_i]; + trait_names.push(trait); + this_trait_vals = []; + for (_j = 0, _len1 = samples.length; _j < _len1; _j++) { + sample = samples[_j]; + if (__indexOf.call(Object.keys(selected_traits[trait]), sample) >= 0) { + this_trait_vals.push(parseFloat(selected_traits[trait][sample])); + } else { + this_trait_vals.push(null); + } + } + all_vals.push(this_trait_vals); + } + console.log("all_vals:", all_vals); + trait_vals_csv = trait_names.join(","); + trait_vals_csv += "\n"; + for (index = _k = 0, _len2 = samples.length; _k < _len2; index = ++_k) { + sample = samples[index]; + if (all_vals[0][index] === null) { + continue; + } + sample_vals = []; + for (_l = 0, _len3 = all_vals.length; _l < _len3; _l++) { + trait = all_vals[_l]; + sample_vals.push(trait[index]); + } + trait_vals_csv += sample_vals.join(","); + trait_vals_csv += "\n"; + } + return trait_vals_csv; +}; + +trait_click = function() { + var dataset, this_trait_url, trait; + console.log("Clicking on:", $(this)); + trait = $(this).parent().find('.trait').text(); + dataset = $(this).parent().find('.dataset').text(); + console.log("BEFORE COVAR:", trait + ":" + dataset) + $('input[name=covariates]').val(trait + ":" + dataset) + console.log("AFTER COVAR:", $('input[name=covariates]').val()) + return $.colorbox.close(); + // this_trait_url = "/trait/get_sample_data?trait=" + trait + "&dataset=" + dataset; + // console.log("this_trait_url", this_trait_url); + // $.ajax({ + // dataType: "json", + // url: this_trait_url, + // success: get_trait_data + // }); + // return $.colorbox.close(); +}; + +add_trait_data = function(trait_data, textStatus, jqXHR) { + var trait_name, trait_sample_data; + trait_name = trait_data[0]; + trait_sample_data = trait_data[1]; + selected_traits[trait_name] = trait_sample_data; + return console.log("selected_traits:", selected_traits); +}; + +get_trait_data = function(trait_data, textStatus, jqXHR) { + var sample, samples, this_trait_vals, trait_sample_data, vals, _i, _len; + console.log("trait:", trait_data[0]); + trait_sample_data = trait_data[1]; + console.log("trait_sample_data:", trait_sample_data); + samples = $('input[name=allsamples]').val().split(" "); + vals = []; + for (_i = 0, _len = samples.length; _i < _len; _i++) { + sample = samples[_i]; + if (__indexOf.call(Object.keys(trait_sample_data), sample) >= 0) { + vals.push(parseFloat(trait_sample_data[sample])); + } else { + vals.push(null); + } + } + if ($('input[name=samples]').length < 1) { + $('#hidden_inputs').append('<input type="hidden" name="samples" value="[' + samples.toString() + ']" />'); + } + $('#hidden_inputs').append('<input type="hidden" name="vals" value="[' + vals.toString() + ']" />'); + this_trait_vals = get_this_trait_vals(samples); + console.log("THE LENGTH IS:", $('input[name=vals]').length); + return color_by_trait(trait_sample_data); +}; + +get_this_trait_vals = function(samples) { + var sample, this_trait_vals, this_val, this_vals_json, _i, _len; + this_trait_vals = []; + for (_i = 0, _len = samples.length; _i < _len; _i++) { + sample = samples[_i]; + this_val = parseFloat($("input[name='value:" + sample + "']").val()); + if (!isNaN(this_val)) { + this_trait_vals.push(this_val); + } else { + this_trait_vals.push(null); + } + } + console.log("this_trait_vals:", this_trait_vals); + this_vals_json = '[' + this_trait_vals.toString() + ']'; + return this_trait_vals; +}; + +assemble_into_json = function(this_trait_vals) { + var json_data, json_ids, num_traits, samples; + num_traits = $('input[name=vals]').length; + samples = $('input[name=samples]').val(); + json_ids = samples; + json_data = '[' + this_trait_vals; + $('input[name=vals]').each((function(_this) { + return function(index, element) { + return json_data += ',' + $(element).val(); + }; + })(this)); + json_data += ']'; + return [json_ids, json_data]; +}; + +color_by_trait = function(trait_sample_data, textStatus, jqXHR) { + console.log('in color_by_trait:', trait_sample_data); + return root.bar_chart.color_by_trait(trait_sample_data); +}; + +process_traits = function(trait_data, textStatus, jqXHR) { + var the_html, trait, _i, _len; + console.log('in process_traits with trait_data:', trait_data); + 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 += "<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 || ' ') + "</td></tr>"; + } + the_html += "</tbody>"; + the_html += "</table>"; + the_html += "<script type='text/javascript' src='/static/new/javascript/get_covariates_from_collection.js'></script>" + $("#collections_holder").html(the_html); + return $('#collections_holder').colorbox.resize(); +}; + +back_to_collections = function() { + console.log("collection_list:", collection_list); + $("#collections_holder").html(collection_list); + $(document).on("click", ".collection_line", collection_click); + return $('#collections_holder').colorbox.resize(); +}; + +console.log("inside get_traits_from_collection"); +$(".collection_line").on("click", collection_click); +$("#submit").on("click", submit_click); +$(".trait").on("click", trait_click); +$("#back_to_collections").on("click", back_to_collections);
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index bcd83889..4abb0735 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -215,6 +215,7 @@ process_traits = function(trait_data, textStatus, jqXHR) { } the_html += "</tbody>"; the_html += "</table>"; + the_html += "<script type='text/javascript' src='/static/new/javascript/get_traits_from_collection.js'></script>" $("#collections_holder").html(the_html); return $('#collections_holder').colorbox.resize(); }; diff --git a/wqflask/wqflask/static/new/javascript/lodheatmap.js b/wqflask/wqflask/static/new/javascript/lodheatmap.js index 45feb75d..f604cd10 100644 --- a/wqflask/wqflask/static/new/javascript/lodheatmap.js +++ b/wqflask/wqflask/static/new/javascript/lodheatmap.js @@ -20,7 +20,7 @@ lodheatmap = function() { chrGap = 8; titlepos = 20; rectcolor = d3.rgb(230, 230, 230); - colors = ["slateblue", "black", "yellow"]; + colors = ["blue", "white", "crimson"]; title = ""; xlab = "Chromosome"; ylab = ""; diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index d1afd47c..03ef1c98 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -12,7 +12,7 @@ window.onload=function() { selector: 'node', style: { 'background-color': '#666', - 'label': 'data(symbol)', + 'label': 'data(label )', 'font-size': 10 } }, @@ -81,10 +81,18 @@ window.onload=function() { function create_qtips(cy){ cy.nodes().qtip({ content: function(){ - gn_link = '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().id + '&dataset=' + this.data().dataset + '" >'+this.data().id +'</a>'+'</b><br>' - ncbi_link = '<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=' + this.data().geneid + '" >NCBI<a>'+'<br>' - omim_link = '<a href="http://www.ncbi.nlm.nih.gov/omim/' + this.data().omim + '" >OMIM<a>'+'<br>' - qtip_content = gn_link + ncbi_link + omim_link + qtip_content = '' + gn_link = '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().name + '&dataset=' + this.data().dataset + '" >'+this.data().id +'</a>'+'</b><br>' + qtip_content += gn_link + if (typeof(this.data().geneid) !== 'undefined'){ + ncbi_link = '<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=' + this.data().geneid + '" >NCBI<a>'+'<br>' + qtip_content += ncbi_link + } + if (typeof(this.data().omim) !== 'undefined'){ + omim_link = '<a href="http://www.ncbi.nlm.nih.gov/omim/' + this.data().omim + '" >OMIM<a>'+'<br>' + qtip_content += omim_link + } + //qtip_content = gn_link + ncbi_link + omim_link return qtip_content //return '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().id + '&dataset=' + this.data().dataset + '" >'+this.data().id +'<a>'+'</b>' }, diff --git a/wqflask/wqflask/static/new/javascript/scatter-matrix.js b/wqflask/wqflask/static/new/javascript/scatter-matrix.js index 278a93bc..31cb384b 100644 --- a/wqflask/wqflask/static/new/javascript/scatter-matrix.js +++ b/wqflask/wqflask/static/new/javascript/scatter-matrix.js @@ -60,7 +60,7 @@ ScatterMatrix.prototype.render = function () { .style({'float':'left', 'margin-right':'50px'}) var svg = container.append('div') .attr('class', 'scatter-matrix-svg') - .style({'float':'right'}) + .style({'float':'left'}) .html('<em>Loading data...</em>'); this.onData(function() { diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index bb1af326..f232c6eb 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -74,6 +74,11 @@ return open_trait_selection(); }; })(this)); + d3.select("#select_covariate").on("click", (function(_this) { + return function() { + return open_covariate_selection(); + }; + })(this)); d3.select("#clear_compare_trait").on("click", (function(_this) { return function() { return $('.scatter-matrix-container').remove(); @@ -84,7 +89,28 @@ return function() { $.colorbox({ inline: true, - href: "#collections_holder" + 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'); + }; + })(this)); + }; + open_covariate_selection = function() { + return $('#collections_holder').load('/collections/list?select_covariates #collections_list', (function(_this) { + return function() { + $.colorbox({ + inline: true, + href: "#collections_holder", + onComplete: function(){ + console.log("before get script") + $.getScript("/static/new/javascript/get_covariates_from_collection.js"); + console.log("after get script") + } }); return $('a.collection_name').attr('onClick', 'return false'); }; diff --git a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css index ab7420a6..a5b9f09c 100644 --- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css +++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css @@ -42,6 +42,7 @@ table.dataTable tfoot td { color: #000000; background-color: #ffffff; border-collapse: collapse; + border-top: #cccccc 2px solid; //padding: 0; padding: 10px 18px 6px 18px; //border-top: 1px solid #111; diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 9ca3d63a..36569b36 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -40,6 +40,9 @@ <a href="/">Search</a> </li> <li class=""> + <a href="/submit_trait">Submit Trait</a> + </li> + <li class=""> <a href="/collections/list">Collections {% if g.user_session.user_ob %} <span class="badge badge-info">{{ g.user_session.user_ob.display_num_collections() }}</span> diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index b1284895..cc60ecff 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -65,7 +65,11 @@ {% endfor %} </tbody> </table> - + {% if "color_by_trait" in params %} + <script language="javascript" type="text/javascript" src="/static/new/javascript/get_traits_from_collection.js"></script> + {% else %} + <script language="javascript" type="text/javascript" src="/static/new/javascript/get_covariates_from_collection.js"></script> + {% endif %} </div> </div> @@ -84,9 +88,6 @@ <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/DataTables/extensions/dataTables.colResize.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> - {% if "color_by_trait" in params %} - <script type="text/javascript" src="/static/new/javascript/get_traits_from_collection.js"></script> - {% endif %} <script> $('#trait_table').dataTable( { "drawCallback": function( settings ) { diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html index 05891c95..605f557c 100644 --- a/wqflask/wqflask/templates/corr_scatterplot.html +++ b/wqflask/wqflask/templates/corr_scatterplot.html @@ -80,7 +80,46 @@ <br>
-<div style="margin-left: 80px;">
+<h2>Correlation Scatterplot</h2>
+
+<table class="table">
+ <tbody>
+ <tr><th class="text-right">num overlap</th> <td>{{jsdata.num_overlap}}</td></tr>
+ <tr><th class="text-right">slope</th> <td>{{jsdata.slope}}</td></tr>
+ <tr><th class="text-right">intercept</th> <td>{{jsdata.intercept}}</td></tr>
+ <tr><th class="text-right">r value</th> <td>{{jsdata.r_value}}</td></tr>
+ <tr><th class="text-right">p value</th> <td>{{jsdata.p_value}}</td></tr>
+ </tbody>
+</table>
+
+<!--
+<table class="table">
+ <tr>
+ <td>Correlation Line Width</td>
+ <td><input type="text" name="lastname" value="2" style="width: 44px;"> px</td>
+ </tr>
+ <tr>
+ <td>Correlation Line Color</td>
+ <td><input type="color" name="favcolor" value="#000000"></td>
+ </tr>
+ <tr>
+ <td>Dot Stroke</td>
+ <td><input type="text" name="lastname" value="5" style="width: 44px;"> px</td>
+ </tr>
+ <tr>
+ <td>Dot Color</td>
+ <td><input type="color" name="favcolor" value="#ff0000"></td>
+ </tr>
+</table>
+-->
+
+<div id="scatterplot2">
+ <svg style="width: 1000px; height: 800px;"></svg>
+</div>
+
+<br>
+
+<div style="margin-left: 75px;">
{% if trait_1.dataset.type == "ProbeSet" %}
<div>
diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index eb675568..ab793d58 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -64,21 +64,15 @@ <br> <br> <h2>Factor Loadings Plot</h2> -<div id="loadings_plot"></div> - +<div id="loadings_plot" style="margin-top: 20px; margin-bottom: 20px; width: 980px; border-style: solid; border-width: 1px;"></div> <h2>Factor Loadings Table</h2> -<table class="table table-hover table-striped" border="1" id='trait_table' style="margin: 20px;" width="40%"> +<table class="table table-hover table-striped" border="1" style="margin-top: 20px; margin-bottom: 20px;" width="30%"> <thead> <tr> <th></th> - <th align="right" >Factor 1</th> - <th align="right" >Factor 2</th> - {% if trait_list|length > 2 %}<th align="right" >Factor 3</th>{% endif %} -<!-- - {% for row in loadings_array %} - <th>Factor {{ loop.index }}</th> - {% endfor %} ---> + <th style="text-align: right;" >Factor 1</th> + <th style="text-align: right;" >Factor 2</th> + {% if trait_list|length > 2 %}<th style="text-align: right;">Factor 3</th>{% endif %} </tr> </thead> <tbody> diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index f5fe2120..fa9e3585 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -21,6 +21,35 @@ and analysis page. </p> + <div> + <form id="correlation_form" action="/corr_matrix" method="post"> + {% if uc %} + <input type="hidden" name="uc_id" id="uc_id" value="{{ uc.id }}" /> + {% endif %} + <input type="hidden" name="trait_list" id="trait_list" value= "" > + + <button id="corr_matrix" class="btn btn-primary submit_special" data-url="/corr_matrix" title="Correlation Matrix" > + Correlation Matrix + </button> + + <button id="network_graph" class="btn btn-primary submit_special" data-url="/network_graph" title="Network Graph" > + Network Graph + </button> + + <button id="wgcna_setup" class="btn btn-primary submit_special" data-url="/wgcna_setup" title="WGCNA Analysis" > + WGCNA Analysis + </button> + + <button id="ctl_setup" class="btn btn-primary submit_special" data-url="/ctl_setup" title="CTL Analysis" > + CTL Analysis + </button> + + <button id="heatmap" class="btn btn-primary submit_special" data-url="/heatmap" title="Heatmap" > + Heatmap + </button> + </form> + </div> + <div> <br /> <button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button> <button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button> @@ -31,9 +60,10 @@ <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ..."> <br /> <br /> + </div> <div style="width: {% if target_dataset.type == "ProbeSet" %}1600px{% elif target_dataset.type == "Publish" %}1400px{% else %}800px{% endif %};"> - <table width="1600px" id="trait_table" class="table table-hover table-striped"> + <table id="trait_table" class="display dataTable nowrap" style="float: left;"> <thead> <tr> <th style="width: 30px;"></th> @@ -99,7 +129,7 @@ <tbody> {% for trait in correlation_results %} <tr> - <td align="center" style="padding-right: 0px;"> <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="padding-right: 0px;" VALUE="{{ data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) }}"></td> + <td style="padding-left: 8px; padding-right: 0px; padding-top: 4px; align: center;"><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="padding-right: 0px;" VALUE="{{ data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) }}"></td> <td align="right">{{ loop.index }}</td> <td> <a href="{{ url_for('show_trait_page', @@ -112,7 +142,7 @@ {% if target_dataset.type == 'ProbeSet' %} <td>{{ trait.symbol }}</td> <td>{{ trait.description_display }}</TD> - <td align="right"style="white-space: nowrap;">{{ trait.location_repr }}</td> + <td style="white-space: nowrap;">{{ trait.location_repr }}</td> <td align="right">{{ '%0.3f' % trait.mean|float }}</td> <td align="right">{% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td> <td align="right">{{ trait.LRS_location_repr }}</td> @@ -167,8 +197,6 @@ <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.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/packages/DT_bootstrap/DT_bootstrap.js"></script> - <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> <script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script> <script type="text/javascript" charset="utf-8"> function getValue(x) { @@ -231,7 +259,6 @@ var y = parseFloat(b); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; - $(document).ready( function () { @@ -242,11 +269,45 @@ } }); + function change_buttons() { + buttons = ["#add", "#remove"]; + num_checked = $('.trait_checkbox:checked').length; + if (num_checked === 0) { + for (_i = 0, _len = buttons.length; _i < _len; _i++) { + button = buttons[_i]; + $(button).prop("disabled", true); + } + } else { + for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) { + button = buttons[_j]; + $(button).prop("disabled", false); + } + } + //}); + if ($(this).is(":checked")) { + if (!$(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').addClass('selected') + } + } + else { + if ($(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').removeClass('selected') + } + } + } + console.time("Creating table"); {% if target_dataset.type == "ProbeSet" %} $('#trait_table').dataTable( { - "paging": false, + "drawCallback": function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, "buttons": [ { extend: 'csvHtml5', @@ -254,19 +315,20 @@ title: 'correlation_results', fieldBoundary: '"', exportOptions: { - columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] } } ], - "columnDefs": [ - { "targets": 0, "orderable": false } - ], + "columnDefs": [ { + "targets": 0, + "orderable": false + } ], "columns": [ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural", "width": "20%" }, + { "type": "natural", "width": "15%" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, @@ -280,17 +342,22 @@ ], "createdRow": function ( row, data, index ) { $('td', row).eq(4).attr('title', $('td', row).eq(4).text()); - if ($('td', row).eq(4).text().length > 60) { - $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 60)); + if ($('td', row).eq(4).text().length > 40) { + $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 40)); $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, "order": [[12, "asc" ]], - "sDom": "Btir", + "sDom": "BRZtir", + "iDisplayLength": -1, "autoWidth": false, - "bDeferRender": true, + "deferRender": true, + "bSortClasses": false, "scrollY": "800px", - "scrollCollapse": false + "scrollCollapse": false, + "scroller": true, + "paging": false, + "orderClasses": true } ); var table = $('#trait_table').DataTable(); @@ -316,8 +383,8 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural", "width": "25%" }, - { "type": "natural", "width": "15%" }, + { "type": "natural", "width": "20%" }, + { "type": "natural", "width": "12%" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, @@ -327,9 +394,14 @@ { "type": "scientific" } ], "createdRow": function ( row, data, index ) { + $('td', row).eq(3).attr('title', $('td', row).eq(3).text()); + if ($('td', row).eq(3).text().length > 50) { + $('td', row).eq(3).text($('td', row).eq(3).text().substring(0, 50)); + $('td', row).eq(3).text($('td', row).eq(3).text() + '...') + } $('td', row).eq(4).attr('title', $('td', row).eq(4).text()); - if ($('td', row).eq(4).text().length > 60) { - $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 60)); + if ($('td', row).eq(4).text().length > 40) { + $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 40)); $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, @@ -376,6 +448,57 @@ {% endif %} console.timeEnd("Creating table"); + submit_special = function(url) { + $("#correlation_form").attr("action", url); + return $("#correlation_form").submit(); + }; + + $("#delete").on("click", function() { + url = $(this).data("url") + return submit_special(url) + }); + + $("#corr_matrix").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + console.log($("#trait_list").val(traits)) + url = $(this).data("url") + //return submit_special(url) + }); + $("#network_graph").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + url = $(this).data("url") + return submit_special(url) + }); + $("#wgcna_setup").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + url = $(this).data("url") + return submit_special(url) + }); + $("#ctl_setup").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + url = $(this).data("url") + return submit_special(url) + }); + $("#heatmap").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + url = $(this).data("url") + return submit_special(url) + }); }); </script> diff --git a/wqflask/wqflask/templates/empty_collection.html b/wqflask/wqflask/templates/empty_collection.html deleted file mode 100644 index 3f2b3786..00000000 --- a/wqflask/wqflask/templates/empty_collection.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} -{% block title %}{{ tool }}{% endblock %} -{% block content %} -<!-- Start of body --> - {{ header("Error") }} - - <div class="container"> - <input type="hidden" name="uc_id" id="uc_id" value="{{ uc_id }}"> - <p>You must select at least one trait to use the {{ tool }}.</p> - </div> - - -<!-- End of body --> - -{% endblock %} diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index e8bb6337..c2f687fd 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -28,7 +28,7 @@ </form> <br /> <div style="width: 2000px;"> - <table width="2000px" id="trait_table" class="table table-hover table-striped nowrap" style="float: left;"> + <table width="2000px" id="trait_table" class="display dataTable nowrap" style="float: left;"> <thead> <tr> <th></th> @@ -42,9 +42,9 @@ <th data-export="Description">Description</th> <th data-export="Location">Location</th> <th data-export="Mean">Mean</th> - <th data-export="Max LRS">Max LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> <th data-export="Max LRS Location">Max LRS Location</th> - <th data-export="Additive Effect">Additive <a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> </tr> </thead> <tbody> @@ -80,9 +80,9 @@ <th>Description</th> <th>Location</th> <th>Mean</th> - <th>Max LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th>Max LRS Location</th> - <th>Additive <a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> + <th data-export="LRS Location">Max LRS Location</th> + <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> </tr> </tfoot> </table> @@ -102,8 +102,6 @@ <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/DataTables/extensions/dataTables.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> - <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script> - <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> <script type="text/javascript" charset="utf-8"> $.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col ) @@ -157,9 +155,14 @@ "order": [[1, "asc" ]], "sDom": "tir", "autoWidth": false, - "bDeferRender": true, - "scrollY": "800px", - "scrollCollapse": false + "deferRender": true, + "bSortClasses": false, + "scrollY": "600px", + "scrollCollapse": true, + "scroller": true, + "scrollX": true, + "paging": false, + "orderClasses": true } ); console.timeEnd("Creating table"); diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 2f7dcaf6..7a8ca07b 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -2,16 +2,13 @@ {% block title %}Search Results{% endblock %} {% block css %} <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> - <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> - <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> - <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > - <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> {% endblock %} {% block content %} <!-- Start of body --> <div class="container"> + <p>You searched for {{ terms }}.</p> <p>To study a record, click on its ID below.<br />Check records below and click Add button to add to selection.</p> <div> @@ -30,28 +27,28 @@ <button class="btn btn-default" id="export_traits">Download CSV</button> </form> <br /> - <div style="width: 1500px; background-color: #eeeeee; border: 1px solid black;"> - <table width="1500px" id="trait_table" class="table table-hover table-striped"> + <div> + <table id="trait_table" class="display dataTable nowrap" style="float: left;"> <thead> <tr> - <th style="background-color: #eeeeee;"></th> - <th data-export="Index" style="background-color: #eeeeee;">Index</th> - <th data-export="Species" style="background-color: #eeeeee;">Species</th> - <th data-export="Group" style="background-color: #eeeeee;">Group</th> - <th data-export="Record" style="background-color: #eeeeee;">Record</th> - <th data-export="Description" style="background-color: #eeeeee;">Description</th> - <th data-export="Authors" style="background-color: #eeeeee;">Authors</th> - <th data-export="Year" style="background-color: #eeeeee;">Year</th> - <th data-export="LRS" style="background-color: #eeeeee; text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th data-export="LRS Location" style="background-color: #eeeeee;">Max LRS Location</th> - <th data-export="Additive Effect" style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th></th> + <th data-export="Index">Index</th> + <th data-export="Species">Species</th> + <th data-export="Group">Group</th> + <th data-export="Record">Record</th> + <th data-export="Description">Description</th> + <th data-export="Authors">Authors</th> + <th data-export="Year">Year</th> + <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> + <th data-export="LRS Location">Max LRS Location</th> + <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> </tr> </thead> <tbody> {% for this_trait in trait_list %} - <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> - <td><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td> - <td data-export="{{ loop.index }}">{{ loop.index }}</td> + <tr id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> + <td align="center" style="padding-right: 0px; padding-left: 5px;"><input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td> + <td align="right" data-export="{{ loop.index }}">{{ loop.index }}</td> <td data-export="{{ this_trait.dataset.group.species }}">{{ this_trait.dataset.group.species }}</td> <td data-export="{{ this_trait.dataset.group.name }}">{{ this_trait.dataset.group.name }}</td> <td data-export="{{ this_trait.name }}"><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></td> @@ -61,22 +58,22 @@ <td data-export="{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}" align="right">{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td> <td data-export="{{ this_trait.LRS_location_repr }}" align="right">{{ this_trait.LRS_location_repr }}</td> <td data-export="{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}" align="right">{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}</td> - </TR> + </tr> {% endfor %} </tbody> <tfoot> <tr> - <th style="background-color: #eeeeee;"></th> - <th style="background-color: #eeeeee;">Index</th> - <th style="background-color: #eeeeee;">Species</th> - <th style="background-color: #eeeeee;">Group</th> - <th style="background-color: #eeeeee;">Record</th> - <th style="background-color: #eeeeee;">Description</th> - <th style="background-color: #eeeeee;">Authors</th> - <th style="background-color: #eeeeee;">Year</th> - <th style="background-color: #eeeeee; text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th style="background-color: #eeeeee;">Max LRS Location</th> - <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th></th> + <th>Index</th> + <th>Species</th> + <th>Group</th> + <th>Record</th> + <th>Description</th> + <th>Authors</th> + <th>Year</th> + <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> + <th data-export="LRS Location">Max LRS Location</th> + <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th> </tr> </tfoot> </table> @@ -96,8 +93,6 @@ <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/DataTables/extensions/dataTables.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> - <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script> - <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> <script type="text/javascript" charset="utf-8"> $.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col ) @@ -117,6 +112,18 @@ console.time("Creating table"); $('#trait_table').DataTable( { + "createdRow": function ( row, data, index ) { + $('td', row).eq(5).attr('title', $('td', row).eq(5).text()); + if ($('td', row).eq(5).text().length > 50) { + $('td', row).eq(5).text($('td', row).eq(5).text().substring(0, 50)); + $('td', row).eq(5).text($('td', row).eq(5).text() + '...') + } + $('td', row).eq(6).attr('title', $('td', row).eq(6).text()); + if ($('td', row).eq(6).text().length > 50) { + $('td', row).eq(6).text($('td', row).eq(6).text().substring(0, 50)); + $('td', row).eq(6).text($('td', row).eq(6).text() + '...') + } + }, "paging": false, "columns": [ { "orderDataType": "dom-checkbox" }, @@ -134,15 +141,21 @@ "columnDefs": [ { "targets": 0, + "orderable": false, "orderDataType": "dom-checkbox" } ], "order": [[1, "asc" ]], "sDom": "tir", "autoWidth": false, - "bDeferRender": true, - "scrollY": "800px", - "scrollCollapse": false + "deferRender": true, + "bSortClasses": false, + "scrollY": "600px", + "scrollCollapse": true, + "scroller": true, + "scrollX": true, + "paging": false, + "orderClasses": true } ); console.timeEnd("Creating table"); }); diff --git a/wqflask/wqflask/templates/heatmap.html b/wqflask/wqflask/templates/heatmap.html index 81c4a9d9..49d7f962 100644 --- a/wqflask/wqflask/templates/heatmap.html +++ b/wqflask/wqflask/templates/heatmap.html @@ -1,44 +1,46 @@ -{% extends "base.html" %}
-{% block title %}Heatmap{% endblock %}
-{% block css %}
- <link rel="stylesheet" type="text/css" href="/static/new/css/d3-tip.min.css" />
- <link rel="stylesheet" type="text/css" href="/static/new/css/panelutil.css" />
-{% endblock %}
-{% block content %} <!-- Start of body -->
-
- {{ header("Heatmap") }}
-
- <div class="container">
- <div>
- <h2>
- Heatmap
- </h2>
- </div>
- <div id="chart_container">
- <div class="qtlcharts" id="chart">
-
- </div>
- </div>
-
- </div>
-
- <!-- End of body -->
-
-{% endblock %}
-
-{% block js %}
- <script>
- js_data = {{ js_data | safe }}
- </script>
-
- <script language="javascript" type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/js_external/d3-tip.min.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/panelutil.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/lodheatmap.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/curvechart.js"></script>
-<!-- <script language="javascript" type="text/javascript" src="/static/new/javascript/create_heatmap.js"></script>-->
- <script language="javascript" type="text/javascript" src="/static/new/javascript/iplotMScanone_noeff.js"></script>
- <script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script>
-
+{% extends "base.html" %} +{% block title %}Heatmap{% endblock %} +{% block css %} + <link rel="stylesheet" type="text/css" href="/static/new/css/d3-tip.min.css" /> + <link rel="stylesheet" type="text/css" href="/static/new/css/panelutil.css" /> +{% endblock %} +{% block content %} <!-- Start of body --> + + {{ header("Heatmap") }} + + <div class="container"> + <div> + <h3> + The following heatmap is a work in progress. The heatmap for each trait runs horizontally (as opposed to vertically in GeneNetwork 1), + and hovering over a given trait's heatmap track will display its corresponding QTL chart below. Black on the heatmap corresponds with a + low positive or negative z-score (darker when closer to 0), while light blue and yellow correspond to high negative and positive z-scores respectively. + </h3> + </div> + <div id="chart_container"> + <div class="qtlcharts" id="chart"> + + </div> + </div> + + </div> + + <!-- End of body --> + +{% endblock %} + +{% block js %} + <script> + js_data = {{ js_data | safe }} + </script> + + <script language="javascript" type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/d3-tip.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/javascript/panelutil.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/javascript/lodheatmap.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/javascript/curvechart.js"></script> +<!-- <script language="javascript" type="text/javascript" src="/static/new/javascript/create_heatmap.js"></script>--> + <script language="javascript" type="text/javascript" src="/static/new/javascript/iplotMScanone_noeff.js"></script> + <script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script> + {% endblock %}
\ No newline at end of file diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index 65debd10..5afd134a 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -14,9 +14,7 @@ <input type="hidden" name="temp_uuid" value="{{ temp_uuid }}"> <input type="hidden" name="trait_id" value="{{ this_trait.name }}"> <input type="hidden" name="dataset" value="{{ dataset.name }}"> - {% if mapping_method == "reaper" or mapping_method == "rqtl_geno" %} - <input type="hidden" name="genofile" value="{{ dataset.group.genofile }}"> - {% endif %} + <input type="hidden" name="genofile" value="{{ genofile_string }}"> <input type="hidden" name="method" value="{{ mapping_method }}"> {% for sample in samples %} <input type="hidden" name="value:{{ sample }}" value="{{ vals[loop.index - 1] }}"> @@ -41,7 +39,10 @@ {% if dataset.type == "ProbeSet" %}<b>Trait ID:</b>{% else %}<b>Record ID:</b>{% endif %} <a href="/show_trait?trait_id={{ this_trait.name }}&dataset={{ dataset.name }}">{{ this_trait.name }}</a><br> {% if dataset.type == "ProbeSet" %} <b>Gene Symbol:</b> <i>{{ this_trait.symbol }}</i><br> - <b>Location:</b> Chr {{ this_trait.chr }} @ {{ this_trait.mb }} Mb + <b>Location:</b> Chr {{ this_trait.chr }} @ {{ this_trait.mb }} Mb<br> + {% endif %} + {% if genofile_string is defined %} + <b>Genotypes:</b> {{ genofile_string.split(":")[1] }} {% endif %} </div> <div id="gn1_map_options" class="col-xs-5" style="outline: 3px double #AAAAAA; padding: 10px; margin: 10px;"> @@ -121,7 +122,7 @@ <span style="color:red;">*</span> <br> <input type="checkbox" name="showGenes" class="checkbox" style="display: inline; margin-top: 0px;" {% if geneChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Gene Track </span> <span style="color:red;">*</span><br> - {% if plotScale != "morgan" and mapping_method != "gemma" %} + {% if plotScale != "morgan" and mapping_method != "gemma" and mapping_method != "plink" %} <input type="checkbox" name="haplotypeAnalystCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if haplotypeAnalystChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Haplotype Analyst </span> <span style="color:red;">*</span><br> {% endif %} <input type="checkbox" name="viewLegend" class="checkbox" style="display: inline; margin-top: 0px;" {% if legendChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Legend </span> @@ -173,7 +174,7 @@ </form> {% if selectedChr == -1 %} - <div style="width:{% if 'additive' in trimmed_markers[0] %}40%{% else %}30%{% endif %};"> + <div style="width:{% if 'additive' in trimmed_markers[0] %}45%{% else %}35%{% endif %};"> <h2>Results</h2> <div id="table_container"> <table id="qtl_results" class="table table-hover table-striped nowrap"> @@ -184,7 +185,7 @@ <th>Locus</th> <th>{{ LRS_LOD }}</th> <th>Chr</th> - {% if plotScale == "centimorgan" %} + {% if plotScale != "physic" %} <th>cM</th> {% else %} <th>Mb</th> @@ -221,7 +222,11 @@ {% endif %} {% endif %} <td align="right">{{marker.chr}}</td> + {% if plotScale != "physic" %} + <td align="right">{{ '%0.3f' | format(marker.Mb|float) }}</td> + {% else %} <td align="right">{{ '%0.6f' | format(marker.Mb|float) }}</td> + {% endif %} {% if 'additive' in marker %} <td align="right">{{ '%0.3f' | format(marker.additive|float) }}</td> {% endif %} @@ -234,8 +239,8 @@ </table> </div> </div> - {% else %} - <div> + {% elif selectedChr != -1 and plotScale =="physic" and (dataset.group.species == 'mouse' or dataset.group.species == 'rat') %} + <div style="width: 100%;"> <h2>Interval Analyst</h2> <div id="table_container"> <table id="interval_analyst" class="table table-hover table-striped nowrap"> @@ -349,9 +354,10 @@ "order": [[3, "asc" ]], "sDom": "RZtir", "iDisplayLength": -1, - "bDeferRender": true, + "autoWidth": false, + "deferRender": true, "bSortClasses": false, - "scrollY": true, + "scrollY": "600px", "scrollCollapse": false, "paging": false } ); diff --git a/wqflask/wqflask/templates/network_graph.html b/wqflask/wqflask/templates/network_graph.html index 57426af7..24293de6 100644 --- a/wqflask/wqflask/templates/network_graph.html +++ b/wqflask/wqflask/templates/network_graph.html @@ -17,7 +17,7 @@ <div class="row" > <div id="content"> <div id="secondaryContent" class="col-xs-3"> - <h3> Visualization Options</h3> + <h3 style="margin-top:0px; margin-bottom: 5px;"> Visualization Options</h3> <table border="0"> <tbody> <tr> @@ -27,12 +27,13 @@ </tr> <tr> <td> - Focus Trait + Focus Trait<sup title="Only show edges connected to the specified node" style="color:#f00"> ?</sup> </td> </tr> <tr> <td> <select name="focus_select"> + <option disabled selected value>Select Trait</option> {% for trait in traits %} <option value="{{ trait.name }}:{{ trait.dataset.name }}">{{ trait.symbol }} ({{ trait.name }})</option> {% endfor %} @@ -40,16 +41,15 @@ </td> </tr> <tr> - <td colspan="1">Correlation Coefficient</td> - </tr> - <tr> - <td> - <font size="2"><b>0 - +/- 1</b></font> + <td colspan="1"> + Correlation Coefficient<sup title="Filter edges to only show correlations less than the negative value specified with the slider and greater than the positive value. For example, moving the slider half way will display correlations less than -0.5 and greater than 0.5" style="color:#f00"> ?</sup> </td> </tr> <tr> - <td> + <td colspan="1"> + <font size="2"><b>0 + + +/- 1</b></font><br> <input type="range" id="slide" min="0" max="1" value="0" step="0.001" list="corr_range"> </td> </tr> @@ -72,7 +72,7 @@ </tr> </tbody> </table> - <h3> Download</h3> + <h3 style="margin-bottom: 5px;"> Download</h3> <table> <tbody> <tr> @@ -82,24 +82,10 @@ </a> </td> </tr> - <tr> - <td> - <a id="image_link" href="javascript:void(0)"> - <button style="width:100px;height:25px;">Table View</button> - </a> - </td> - </tr> - <tr> - <td> - <a id="image_link" href="javascript:void(0)"> - <button style="width:100px;height:25px;">Save Table</button> - </a> - </td> - </tr> </tbody> </table> </div> - <div id="cytoscapeweb" class="col-xs-9" style="min-height:700px !important;"></div> + <div id="cytoscapeweb" class="col-xs-9" style="height:700px !important; border-style: solid; border-width: 1px; border-color: grey;"></div> </div> </div> </div> diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 5a880647..7c4dbc60 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -42,6 +42,7 @@ <input type="hidden" name="temp_uuid" id="temp_uuid" value="{{ temp_uuid }}"> <input type="hidden" name="genofile" value=""> + <input type="hidden" name="covariates" value=""> <div class="container"> <div class="panel-group" id="accordion"> @@ -140,11 +141,10 @@ <script type="text/javascript" src="/static/new/javascript/scatterplot.js"></script> <script type="text/javascript" src="/static/new/javascript/scatter-matrix.js"></script> <script type="text/javascript" src="/static/new/javascript/draw_probability_plot.js"></script> - <script type="text/javascript" src="/static/new/javascript/compare_traits_scatterplot.js"></script> - + <script type="text/javascript" src="/static/new/javascript/compare_traits_scatterplot.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> - <script type="text/javascript" src="/static/new/javascript/get_traits_from_collection.js"></script> <script type="text/javascript" src="/static/new/javascript/validation.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/jsPDF/libs/FileSaver.js/FileSaver.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/jsPDF/libs/Blob.js/BlobBuilder.js"></script> diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 23c09d05..bded60d2 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -44,7 +44,7 @@ <div style="margin-left: 20px;" class="col-xs-8 controls"> <select id="genofile_reaper" class="form-control"> {% for item in genofiles %} - <option value="{{item['location']}}">{{item['title']}}</option> + <option value="{{item['location']}}:{{item['title']}}">{{item['title']}}</option> {% endfor %} </select> </div> @@ -138,21 +138,12 @@ <div style="margin-left: 20px;" class="col-xs-8 controls"> <select id="genofile_pylmm" class="form-control"> {% for item in genofiles %} - <option value="{{item['location']}}">{{item['title']}}</option> + <option value="{{item['location']}}:{{item['title']}}">{{item['title']}}</option> {% endfor %} </select> </div> </div> {% endif %} - <div class="mapping_method_fields form-group"> - <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label> - <div style="margin-left: 20px;" class="col-xs-4 controls"> - <input name="num_perm_pylmm" value="" type="text" class="form-control"> - </div> - </div> - <div id="permutations_alert" class="alert alert-error alert-warning" style="display:none;"> - Please be aware that permutations can take a very long time (~20 minutes for 500 permutations) - </div> <!-- <div class="mapping_method_fields form-group"> <label for="control_for" class="col-xs-3 control-label">Control for</label> @@ -172,8 +163,6 @@ </label> </div> </div> ---> - <div class="mapping_method_fields form-group"> <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label> <div class="col-xs-12 controls"> @@ -187,6 +176,7 @@ </label> </div> </div> +--> <div class="form-group"> <div style="padding-left:15px;" class="controls"> <button id="pylmm_compute" class="btn submit_special btn-primary" title="Compute Marker Regression"> @@ -205,7 +195,7 @@ <div style="margin-left: 20px;" class="col-xs-8 controls"> <select id="genofile_rqtl_geno" class="form-control"> {% for item in genofiles %} - <option value="{{item['location']}}">{{item['title']}}</option> + <option value="{{item['location']}}:{{item['title']}}">{{item['title']}}</option> {% endfor %} </select> </div> @@ -259,13 +249,13 @@ <div class="col-xs-4 controls"> <select name="mapmodel_rqtl_geno" class="form-control"> <option value="normal">normal</option> - <option value="binary">binary</option> - <option value="2part">2part</option> + <!--<option value="binary">binary</option> + <option value="2part">2part</option>--> <option value="np">np</option> </select> </div> </div> - + <!-- <div class="mapping_method_fields form-group"> <label style="text-align:left;" class="col-xs-12 control-label">Pair Scan</label> <div class="col-xs-12 controls"> @@ -279,7 +269,7 @@ </label> </div> </div> - + --> <div class="mapping_method_fields form-group"> <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label> <div class="col-xs-12 controls"> @@ -351,6 +341,7 @@ </div> </div> <div class="col-xs-6"> + {% if dataset.group.mapping_id == "1" %} <dl> <dt>Interval Mapping</dt> <dd>Interval mapping is a process in which the statistical significance of a hypothetical QTL is evaluated at regular points across a chromosome, even in the absence of explicit genotype data at those points.</dd> @@ -359,6 +350,17 @@ <dt>R/qtl</dt> <dd>R/qtl is an extensible, interactive environment for mapping quantitative trait loci (QTL) in experimental crosses.</dd> </dl> + {% else %} + <dl> + <dt>GEMMA</dt> + <dd> + GEMMA is software implementing the Genome-wide Efficient Mixed Model Association algorithm for a standard linear mixed model for genome-wide association studies (GWAS).<br> + <font style="color: red;">Note: There currently exists an issue where GEMMA can't be run on traits from the same group simultaneously. If you recieve an error, please wait a few minutes and try again.</font> + </dd> + <dt>PLINK</dt> + <dd>PLINK is a free, open-source whole genome association analysis toolset.</dd> + </dl> + {% endif %} </div> <div id="mapping_result_holder_wrapper" style="display:none;"> <div id="mapping_result_holder"></div> diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html index ac44b656..d4a8c1f7 100644 --- a/wqflask/wqflask/templates/show_trait_statistics.html +++ b/wqflask/wqflask/templates/show_trait_statistics.html @@ -18,7 +18,8 @@ <a href="#scatterplot_matrix" data-toggle="tab">Scatterplot Matrix</a> </li> {% endif %} - <!--<li> + <!-- + <li> <a href="#box_plot_tab" data-toggle="tab">Box Plot</a> </li>--> </ul> @@ -100,7 +101,7 @@ <option value="{{ group }}">{{ pretty_group }}</option> {% endfor %} </select> - <button type="button" class="btn btn-default" id="down_prob_plot">Export as PNG</button> + <!--<button type="button" class="btn btn-default" id="down_prob_plot">Export as PNG</button>--> <br> <br> {% endif %} @@ -118,7 +119,8 @@ </div> </div> -<!-- <div class="tab-pane" id="box_plot_tab"> +<!-- + <div class="tab-pane" id="box_plot_tab"> {% if sample_groups|length > 1 %} <select class="box_plot_samples_group"> {% for group, pretty_group in sample_group_types.items() %} @@ -130,7 +132,8 @@ <div id="box_plot_container"> <div id="box_plot"></div> </div> - </div>--> + </div> +--> {% if g.user_session.user_ob %} <div class="tab-pane" id="scatterplot_matrix"> diff --git a/wqflask/wqflask/templates/submit_trait.html b/wqflask/wqflask/templates/submit_trait.html index 8d624ffd..e93c1c9d 100644 --- a/wqflask/wqflask/templates/submit_trait.html +++ b/wqflask/wqflask/templates/submit_trait.html @@ -56,6 +56,7 @@ </div> <div style="padding-bottom: 50px;" class="form-horizontal"> <h3>2. Enter Trait Data:</h3> + <h4 style="color:red;">WARNING: File uploading isn't enabled yet, so please paste your values using the second option.</h4> <br> <div class="col-xs-2" style="min-height: 100vh; display: flex; align-items: center;"> <img src="/static/new/images/step2.gif"> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index ca7f04e9..83496000 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -558,6 +558,7 @@ def marker_regression_page(): 'selected_chr', 'chromosomes', 'mapping_scale', + 'plotScale', 'score_type', 'suggestive', 'significant', |