From a3365dae23f204e489939d3defc55edc1b4872d8 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 1 Oct 2018 16:09:47 +0000 Subject: - Can now remove cofactors from correlation scatterplot and select them by just clicking their row in collection - Cofactor color picker now works in Safari/Macs - Displays N for relevant samples in trait page sample table - Don't show bar chart when N>256 - Mapping loading page contents better centered - Anonymous collections timeout correctly listed as 30 days now - Minor allele frequency can actually be changed for GEMMA now (previously didn't work) - Fixed transcript position marker location for mapping results - Notifies user if their e-mail isn't associated with an account when they attempt to request forgotten password - Users can now map with submitted traits - Histogram width changes depending upon number of bins (need to improve this still) - Improved Q-q plot (previously called "probability plot") --- wqflask/maintenance/convert_geno_to_bimbam.py | 2 ++ wqflask/maintenance/gen_select_dataset.py | 2 +- wqflask/maintenance/generate_kinship_from_bimbam.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'wqflask/maintenance') diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py index 45522705..a5d2d12a 100644 --- a/wqflask/maintenance/convert_geno_to_bimbam.py +++ b/wqflask/maintenance/convert_geno_to_bimbam.py @@ -154,6 +154,8 @@ class ConvertGenoFile(object): if not input_file.endswith(('geno', '.geno.gz')): continue group_name = ".".join(input_file.split('.')[:-1]) + if group_name == "HSNIH-Palmer": + continue geno_output_file = os.path.join(new_directory, group_name + "_geno.txt") pheno_output_file = os.path.join(new_directory, group_name + "_pheno.txt") snp_output_file = os.path.join(new_directory, group_name + "_snps.txt") diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 18b2dac9..55c642a4 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -219,7 +219,7 @@ def build_datasets(species, group, type_name): if group == 'MDP': dataset_text = "Mouse Phenome Database" else: - dataset_text = "%s Published Phenotypes" % group + dataset_text = "%s Phenotypes" % group elif type_name == "Genotypes": Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py index f322341d..ad0eb036 100644 --- a/wqflask/maintenance/generate_kinship_from_bimbam.py +++ b/wqflask/maintenance/generate_kinship_from_bimbam.py @@ -32,6 +32,8 @@ class GenerateKinshipMatrices(object): if not input_file.endswith(('geno', '.geno.gz')): continue group_name = ".".join(input_file.split('.')[:-1]) + if group_name == "HSNIH-Palmer": + continue geno_input_file = os.path.join(bimbam_dir, group_name + "_geno.txt") pheno_input_file = os.path.join(bimbam_dir, group_name + "_pheno.txt") convertob = GenerateKinshipMatrices(group_name, geno_input_file, pheno_input_file) -- cgit 1.4.1 From 261ba5e41408d212cc3c33df658b6be2431f68ad Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 11 Oct 2018 15:43:41 +0000 Subject: - Added fix for GEMMA LOCO - Added all current SNP browser code (not complete yet) - Added change to convert_geno_to_bimbam that makes it ignore .geno files marked as "filler" (so ones where the .geno file is fake and we sometimes directly receive the genotypes as BIMBAM) - Changes TheSpecies object in species.py to accept species name as well as dataset name --- wqflask/base/species.py | 27 +- wqflask/maintenance/convert_geno_to_bimbam.py | 2 + wqflask/wqflask/marker_regression/gemma_mapping.py | 4 +- wqflask/wqflask/show_trait/show_trait.py | 2 - wqflask/wqflask/snp_browser/__init__.py | 0 wqflask/wqflask/snp_browser/snp_browser.py | 500 +++++++++++++++++++++ wqflask/wqflask/templates/correlation_page.html | 1 - wqflask/wqflask/templates/snp_browser.html | 242 ++++++++++ wqflask/wqflask/views.py | 8 + 9 files changed, 773 insertions(+), 13 deletions(-) create mode 100644 wqflask/wqflask/snp_browser/__init__.py create mode 100644 wqflask/wqflask/snp_browser/snp_browser.py create mode 100644 wqflask/wqflask/templates/snp_browser.html (limited to 'wqflask/maintenance') diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 4ac2213c..6d99af65 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -14,10 +14,13 @@ from utility.logger import getLogger logger = getLogger(__name__ ) class TheSpecies(object): - def __init__(self, dataset): - self.dataset = dataset - #print("self.dataset is:", pf(self.dataset.__dict__)) - self.chromosomes = Chromosomes(self.dataset) + def __init__(self, dataset=None, species_name=None): + if species_name != None: + self.name = species_name + self.chromosomes = Chromosomes(species=self.name) + else: + self.dataset = dataset + self.chromosomes = Chromosomes(dataset=self.dataset) class IndChromosome(object): def __init__(self, name, length): @@ -30,11 +33,21 @@ class IndChromosome(object): return self.length / 1000000 class Chromosomes(object): - def __init__(self, dataset): - self.dataset = dataset + def __init__(self, dataset=None, species=None): self.chromosomes = collections.OrderedDict() + if species != None: + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, Species + where + Chr_Length.SpeciesId = Species.SpeciesId AND + Species.Name = '%s' + Order by OrderId + """ % species.capitalize() + else: + self.dataset = dataset - query = """ + query = """ Select Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, InbredSet where diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py index a5d2d12a..8f331a06 100644 --- a/wqflask/maintenance/convert_geno_to_bimbam.py +++ b/wqflask/maintenance/convert_geno_to_bimbam.py @@ -140,6 +140,8 @@ class ConvertGenoFile(object): key, _separater, value = row.partition(':') key = key.strip() value = value.strip() + if key == "@filler": + raise EmptyConfigurations if key in self.haplotype_notation: self.configurations[value] = self.haplotype_notation[key] continue diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 11feaa98..c17f21aa 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -49,9 +49,7 @@ def run_gemma(this_dataset, samples, vals, covariates, use_loco, maf=0.01): logger.debug("k_command:" + generate_k_command) os.system(generate_k_command) - gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --loco --input %s/gn2/%s.json -- '+GEMMAOPTS+' -g %s/%s_geno.txt -p %s/%s_pheno.txt' % (TEMPDIR, - k_output_filename, - flat_files('genotype/bimbam'), + gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --loco --input %s/gn2/%s.json -- ' % (TEMPDIR, k_output_filename) + GEMMAOPTS + ' -g %s/%s_geno.txt -p %s/%s_pheno.txt' % (flat_files('genotype/bimbam'), genofile_name, flat_files('genotype/bimbam'), genofile_name) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 7b9dc969..3f5030b2 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -16,8 +16,6 @@ import scipy.stats as ss from flask import Flask, g -from htmlgen import HTMLgen2 as HT - from base import webqtlConfig from base import webqtlCaseData from wqflask.show_trait.SampleList import SampleList diff --git a/wqflask/wqflask/snp_browser/__init__.py b/wqflask/wqflask/snp_browser/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py new file mode 100644 index 00000000..df68d4a0 --- /dev/null +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -0,0 +1,500 @@ +from __future__ import absolute_import, print_function, division + +from flask import Flask, g + +import string + +from utility.logger import getLogger +logger = getLogger(__name__ ) + +from base import species + +class SnpBrowser(object): + + MAXSNPRETURN = 5000 + + def __init__(self, start_vars): + self.strain_list = get_browser_sample_list() + self.initialize_parameters(start_vars) + + if self.first_run == "false": + if self.limit_strains == "true": + self.header_fields = get_header_list(self.variant_type, self.chosen_strains) + else: + self.header_fields = get_header_list(self.variant_type, self.strain_list) + self.filtered_results = self.get_table_results() + + def initialize_parameters(self, start_vars): + self.first_run = "true" + self.allele_list = [] + if 'variant' in start_vars: #ZS: Check if not first time loaded (if it has form input) + self.first_run = "false" + self.variant_type = start_vars['variant'] + self.species_name = start_vars['species'] + if self.species_name.capitalize() == "Mouse": + self.species_id = 1 + elif self.species_name.capitalize() == "Rat": + self.species_id = 2 + else: + self.species_id = 0 #Using this to indicate "All Species" + + #ZS: Currently this is just assuming mouse for determining the chromosomes. + # This logic may have to change depending upon what other species are added or how we want to deal with an "All Species" option + self.chr_list = [] + species_ob = species.TheSpecies(species_name="Mouse") + for key in species_ob.chromosomes.chromosomes: + self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) + + if start_vars['gene_name'] != "": + self.gene_name = start_vars['gene_name'] + else: + self.gene_name = "" + self.chr = start_vars['chr'] + try: + self.start_mb = float(start_vars['start_mb']) + self.end_mb = float(start_vars['end_mb']) + except: + self.start_mb = 0.0 + self.end_mb = 0.0 + + if 'limit_strains' in start_vars: + self.limit_strains = "true" + else: + self.limit_strains = "false" + self.chosen_strains = start_vars['chosen_strains'].split(",") + self.domain = start_vars['domain'] + self.function = start_vars['function'] + self.source = start_vars['source'] + self.criteria = start_vars['criteria'] + self.score = start_vars['score'] + + self.redundant = "false" + self.diff_alleles = "false" + if 'redundant' in start_vars: + self.redundant = "true" + if 'diff_alleles' in start_vars: + self.diff_alleles = "true" + + else: #ZS: Default values + self.variant_type = "SNP" + self.species_name = "Mouse" + species_ob = species.TheSpecies(species_name=self.species_name) + self.chr_list = [] + for key in species_ob.chromosomes.chromosomes: + self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) + + self.chr = "19" + self.start_mb = 30.1 + self.end_mb = 30.12 + + self.limit_strains = "true" + + self.chosen_strains = ["C57BL/6J", + "DBA/2J", + "A/J", + "129S1/SvImJ", + "NOD/ShiLtJ", + "NZO/HlLtJ", + "WSB/EiJ", + "PWK/PhJ", + "CAST/EiJ"] + + self.domain = "All" + self.function = "All" + self.source = "All" + self.criteria = ">=" + self.score = 0.0 + + self.redundant = "false" + self.diff_alleles = "true" + + def get_table_results(self): + self.snp_list = None + + if self.gene_name != "": + query = "SELECT geneSymbol, chromosome, txStart, txEnd FROM GeneList WHERE SpeciesId = %s AND geneSymbol = %s" % (self.species_id, self.gene_name) + result = g.db.execute(query).fetchone() + if result: + self.gene_name, self.chr, self.start_mb, self.end_mb = result + else: + result_snp = None + if self.variant_type == "SNP": + if self.gene_name[:2] == "rs": + query = "SELECT Id, Chromosome, Position, Position+0.000001 FROM SnpAll WHERE Rs = %s" % self.gene_name + else: + query = "SELECT Id, Chromosome, Position, Position+0.000001 ForM SnpAll where SpeciesId = %s AND SnpName = %s" % (self.species_id, self.gene_name) + result_snp = g.db.execute(query).fetchall() + if result_snp: + self.snp_list = [item[0] for item in result_snp] + self.chr = result_snp[0][1] + self.start_mb = result_snp[0][2] + self.end_mb = result_snp[0][3] + else: + return + elif self.variant_type == "InDel": + if self.gene_name[0] == "I": + query = "SELECT Id, Chromosome, Mb_start, Mb_end FROM IndelAll WHERE SpeciesId = %s AND Name = %s" % (self.species_id, self.gene_name) + result_snp = g.db.execute(query).fetchall() + if result_snp: + self.snp_list = [item[0] for item in result_snp] + self.chr = result_snp[0][1] + self.start_mb = result_snp[0][2] + self.end_mb = result_snp[0][3] + else: + return + + if self.variant_type == "SNP": + query = """ + SELECT + a.*, b.* + FROM + SnpAll a, SnpPattern b + WHERE + a.SpeciesId = %s AND a.Chromosome = '%s' AND + a.Position >= %.6f AND a.Position < %.6f AND + a.Id = b.SnpId + ORDER BY a.Position + """ % (self.species_id, self.chr, self.start_mb, self.end_mb) + elif self.variant_type == "InDel": + query = """ + SELECT + DISTINCT a.Name, a.Chromosome, a.SourceId, a.Mb_start, a.Mb_end, a.Strand, a.Type, a.Size, a.InDelSequence, b.Name + FROM + IndelAll a, SnpSource b + WHERE + a.SpeciesId = '%s' AND a.Chromosome = '%s' AND + a.Mb_start >= %2.6f AND a.Mb_start < (%2.6f+.0010) AND + b.Id = a.SourceId + ORDER BY a.Mb_start + """ % (self.species_id, self.chr, self.start_mb, self.end_mb) + + results_all = g.db.execute(query).fetchall() + + return self.filter_results(results_all) + + def filter_results(self, results): + filtered_results = [] + strain_index_list = [] #ZS: List of positions of selected strains in strain list + last_mb = -1 + + if self.limit_strains == "true" and len(self.chosen_strains) > 0: + for item in self.chosen_strains: + index = self.strain_list.index(item) + strain_index_list.append(index) + + for seq, result in enumerate(results): + result = list(result) + + if self.variant_type == "SNP": + display_strains = [] + snp_id, species_id, snp_name, rs, chr, mb, mb_2016, alleles, snp_source, conservation_score = result[:10] + effect_list = result[10:26] + self.allele_list = result[27:] + + if self.limit_strains == "true" and len(self.chosen_strains) > 0: + for index in strain_index_list: + display_strains.append(result[27+index]) + self.allele_list = display_strains + + effect_info_dict = get_effect_info(effect_list) + coding_domain_list = ['Start Gained', 'Start Lost', 'Stop Gained', 'Stop Lost', 'Nonsynonymous', 'Synonymous'] + intron_domain_list = ['Splice Site', 'Nonsplice Site'] + + for key in effect_info_dict: + if key in coding_domain_list: + domain = ['Exon', 'Coding'] + elif key in ['3\' UTR', '5\' UTR']: + domain = ['Exon', key] + elif key == "Unknown Effect In Exon": + domain = ['Exon', ''] + elif key in intron_domain_list: + domain = ['Intron', key] + else: + domain = [key, ''] + + if 'Intergenic' in domain: + gene = transcript = exon = function = function_details = '' + if self.redundant == "false" or last_mb != mb: # filter redundant + if self.include_record(domain, function, snp_source, conservation_score): + info_list = [snp_name, rs, chr, mb, alleles, gene, transcript, exon, domain, function, function_details, snp_source, conservation_score, snp_id] + info_list.extend(self.allele_list) + filtered_results.append(info_list) + last_mb = mb + else: + gene_list, transcript_list, exon_list, function_list, function_details_list = effect_info_dict[key] + for index, item in enumerate(gene_list): + gene = item + transcript = transcript_list[index] + if exon_list: + exon = exon_list[index] + else: + exon = "" + + if function_list: + function = function_list[index] + if function == "Unknown Effect In Exon": + function = "Unknown" + else: + function = "" + + if function_details_list: + function_details = "Biotype: " + function_details_list[index] + else: + function_details = "" + + if self.redundant == "false" or last_mb != mb: + if self.include_record(domain, function, snp_source, conservation_score): + info_list = [snp_name, rs, chr, mb, alleles, gene, transcript, exon, domain, function, function_details, snp_source, conservation_score, snp_id] + info_list.extend(self.allele_list) + filtered_results.append(info_list) + last_mb = mb + + elif self.variant == "InDel": + # The order of variables is important; this applies to anything from the variant table as indel + indel_name, indel_chr, source_id, indel_mb_start, indel_mb_end, indel_strand, indel_type, indel_size, indel_sequence, source_name = result + + indel_type = indel_type.title() + if self.redundant == "false" or last_mb != indel_mb_start: + gene = "No Gene" + domain = conservation_score = snp_id = snp_name = rs = flank_3 = flank_5 = ncbi = function = "" + if self.include_record(domain, function, source_name, conservation_score): + filtered_results.append([indel_name, indel_chr, indel_mb_start, indel_mb_end, indel_strand, indel_type, indel_size, indel_sequence, source_name]) + last_mb = indel_mb_start + + else: + filtered_results.append(result) + + return filtered_results + + def include_record(self, domain, function, snp_source, conservation_score): + """ Decide whether to add this record """ + + domain_satisfied = True + function_satisfied = True + different_alleles_satisfied = True + source_satisfied = True + + if domain: + if len(domain) == 0: + if self.domain != "All": + domain_satisfied = False + else: + domain_satisfied = False + if domain[0].startswith(self.domain) or domain[1].startswith(self.domain) or self.domain == "All": + domain_satisfied = True + else: + if self.domain != "All": + domain_satisfied = False + + if snp_source: + if len(snp_source) == 0: + if self.source != "All": + source_satisfied = False + else: + source_satisfied = False + if snp_source.startswith(self.source) or self.source == "All": + source_satisfied = True + else: + if self.source != "All": + source_satisfied = False + + if function: + if len(function) == 0: + if self.function != "All": + function_satisfied = False + else: + function_satisfied = False + if function.startswith(self.function): + function_satisfied = True + else: + if self.function != "All": + function_satisfied = False + + if conservation_score: + score_as_float = float(conservation_score) + try: + input_score_float = float(self.score) # the user-input score + except: + input_score_float = 0.0 + + if self.criteria == ">=": + if score_as_float >= input_score_float: + score_satisfied = True + else: + score_satisfied = False + elif self.criteria == "==": + if score_as_float == input_score_float: + score_satisfied = True + else: + score_satisfied = False + elif self.criteria == "<=": + if score_as_float <= input_score_float: + score_satisfied = True + else: + score_satisfied = False + else: + try: + if float(self.score) > 0: + score_satisfied = False + else: + score_satisfied = True + except: + score_satisfied = True + + if self.variant_type == "SNP" and self.diff_alleles == "true": + this_allele_list = [] + + for item in self.allele_list: + if item and (item.lower() not in this_allele_list) and (item != "-"): + this_allele_list.append(item.lower()) + + total_allele_count = len(this_allele_list) + if total_allele_count <= 1: + different_alleles_satisfied = False + else: + different_alleles_satisfied = True + else: + different_alleles_satisfied = True + + return domain_satisfied and function_satisfied and source_satisfied and score_satisfied and different_alleles_satisfied + +def get_browser_sample_list(species_id=1): + sample_list = [] + query = "SHOW COLUMNS FROM SnpPattern;" + results = g.db.execute(query).fetchall(); + for result in results[1:]: + sample_list.append(result[0]) + + return sample_list + +def get_header_list(variant_type, strain_list): + if variant_type == "SNP": + header_fields = ['Index', 'SNP ID', 'Chr', 'Mb', 'Alleles', 'Source', 'ConScore', 'Gene', 'Transcript', 'Exon', 'Domain 1', 'Domain 2', 'Function', 'Details'] + header_fields.extend(strain_list) + elif variant_type == "InDel": + header_fields = ['Index', 'ID', 'Type', 'InDel Chr', 'Mb Start', 'Mb End', 'Strand', 'Size', 'Sequence', 'Source'] + else: + header_fields = [] + + return header_fields + +def get_effect_details_by_category(effect_name = None, effect_value = None): + gene_list = [] + transcript_list = [] + exon_list = [] + function_list = [] + function_detail_list = [] + tmp_list = [] + + gene_group_list = ['Upstream', 'Downstream', 'Splice Site', 'Nonsplice Site', '3\' UTR'] + biotype_group_list = ['Unknown Effect In Exon', 'Start Gained', 'Start Lost', 'Stop Gained', 'Stop Lost', 'Nonsynonymous', 'Synonymous'] + new_codon_group_list = ['Start Gained'] + codon_effect_group_list = ['Start Lost', 'Stop Gained', 'Stop Lost', 'Nonsynonymous', 'Synonymous'] + + effect_detail_list = string.split(string.strip(effect_value), '|') + effect_detail_list = map(string.strip, effect_detail_list) + + for index, item in enumerate(effect_detail_list): + item_list = string.split(string.strip(item), ',') + item_list = map(string.strip, item_list) + + gene_id = item_list[0] + gene_name = item_list[1] + gene_list.append([gene_id, gene_name]) + transcript_list.append(item_list[2]) + + if effect_name not in gene_group_list: + exon_id = item_list[3] + exon_rank = item_list[4] + exon_list.append([exon_id, exon_rank]) + + if effect_name in biotype_group_list: + biotype = item_list[5] + function_list.append(effect_name) + + if effect_name in new_codon_group_list: + new_codon = item_list[6] + tmp_list = [biotype, new_codon] + function_detail_list.append(string.join(tmp_list, ", ")) + elif effect_name in codon_effect_group_list: + old_new_AA = item_list[6] + old_new_codon = item_list[7] + codon_num = item_list[8] + tmp_list = [biotype, old_new_AA, old_new_codon, codon_num] + function_detail_list.append(string.join(tmp_list, ", ")) + else: + function_detail_list.append(biotype) + + return [gene_list, transcript_list, exon_list, function_list, function_detail_list] + +def get_effect_info(effect_list): + domain = "" + effect_detail_list = [] + effect_info_dict = {} + + prime3_utr, prime5_utr, upstream, downstream, intron, nonsplice_site, splice_site, intergenic = effect_list[:8] + exon, non_synonymous_coding, synonymous_coding, start_gained, start_lost, stop_gained, stop_lost, unknown_effect_in_exon = effect_list[8:] + + if intergenic: + domain = "Intergenic" + effect_info_dict[domain] = "" + else: + # if not exon, get gene list/transcript list info + if upstream: + domain = "Upstream" + effect_detail_list = get_effect_details_by_category(effect_name='Upstream', effect_value=upstream) + effect_info_dict[domain] = effect_detail_list + if downstream: + domain = "Downstream" + effect_detail_list = get_effect_details_by_category(effect_name='Downstream', effect_value=downstream) + effect_info_dict[domain] = effect_detail_list + if intron: + if splice_site: + domain = "Splice Site" + effect_detail_list = get_effect_details_by_category(effect_name='Splice Site', effect_value=splice_site) + effect_info_dict[domain] = effect_detail_list + if nonsplice_site: + domain = "Downstream" + effect_detail_list = get_effect_details_by_category(effect_name='Nonsplice Site', effect_value=nonsplice_site) + effect_info_dict[domain] = effect_detail_list + # get gene, transcript_list, and exon info + if prime3_utr: + domain = "3\' UTR" + effect_detail_list = get_effect_details_by_category(effect_name='3\' UTR', effect_value=prime3_utr) + effect_info_dict[domain] = effect_detail_list + if prime5_utr: + domain = "5\' UTR" + effect_detail_list = get_effect_details_by_category(effect_name='5\' UTR', effect_value=prime5_utr) + effect_info_dict[domain] = effect_detail_list + + if start_gained: + domain = "Start Gained" + effect_detail_list = get_effect_details_by_category(effect_name='Start Gained', effect_value=start_gained) + effect_info_dict[domain] = effect_detail_list + if unknown_effect_in_exon: + domain = "Unknown Effect In Exon" + effect_detail_list = get_effect_details_by_category(effect_name='Unknown Effect In Exon', effect_value=unknown_effect_in_exon) + effect_info_dict[domain] = effect_detail_list + if start_lost: + domain = "Start Lost" + effect_detail_list = get_effect_details_by_category(effect_name='Start Lost', effect_value=start_lost) + effect_info_dict[domain] = effect_detail_list + if stop_gained: + domain = "Stop Gained" + effect_detail_list = get_effect_details_by_category(effect_name='Stop Gained', effect_value=stop_gained) + effect_info_dict[domain] = effect_detail_list + if stop_lost: + domain = "Stop Lost" + effect_detail_list = get_effect_details_by_category(effect_name='Stop Lost', effect_value=stop_lost) + effect_info_dict[domain] = effect_detail_list + + if non_synonymous_coding: + domain = "Nonsynonymous" + effect_detail_list = get_effect_details_by_category(effect_name='Nonsynonymous', effect_value=non_synonymous_coding) + effect_info_dict[domain] = effect_detail_list + if synonymous_coding: + domain = "Synonymous" + effect_detail_list = get_effect_details_by_category(effect_name='Synonymous', effect_value=synonymous_coding) + effect_info_dict[domain] = effect_detail_list + + return effect_info_dict diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 05136ad8..2d4ed2a4 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -1,6 +1,5 @@ {% extends "base.html" %} {% block css %} - {% endblock %} diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html new file mode 100644 index 00000000..cbce1449 --- /dev/null +++ b/wqflask/wqflask/templates/snp_browser.html @@ -0,0 +1,242 @@ +{% extends "base.html" %} +{% block css %} + + + +{% endblock %} +{% block content %} + +
+

Variant Browser Info

+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
Or select
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ Non-redundant SNP Only +
+
+
+ +
+ Different Alleles Only +
+
+
+ +
+ + {% if filtered_results is defined %} + + + + + {% for header in header_fields %} + + {% endfor %} + + + + {% for result in filtered_results %} + + + + {% for item in result %} + {% if loop.index > 1 %} + + {% endif %} + {% endfor %} + + {% endfor %} + +
{{ header }}
{{ loop.index }}{{ item }}
+ {% endif %} + +
+ +{% endblock %} +{% block js %} + + + +{% endblock %} + diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index d4ececd0..fdb80040 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -52,6 +52,7 @@ from wqflask.correlation_matrix import show_corr_matrix from wqflask.correlation import corr_scatter_plot from wqflask.wgcna import wgcna_analysis from wqflask.ctl import ctl_analysis +from wqflask.snp_browser import snp_browser #from wqflask.trait_submission import submit_trait from utility import temp_data @@ -766,6 +767,13 @@ def corr_scatter_plot_page(): indent=" ") return render_template("corr_scatterplot.html", **template_vars.__dict__) +@app.route("/snp_browser", methods=('GET',)) +def snp_browser_page(): + logger.info(request.url) + template_vars = snp_browser.SnpBrowser(request.args) + + return render_template("snp_browser.html", **template_vars.__dict__) + @app.route("/submit_bnw", methods=('POST',)) def submit_bnw(): logger.info(request.url) -- cgit 1.4.1 From dc3bc97b2ae2e751f68ad63359734d569895c711 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 20 Nov 2018 12:08:47 -0600 Subject: Added option to select chromosome from trait page when mapping Put transform/blocking tools into their own tab (still need to change formatting of tab's contents) Improved appearance of search result page table (still need to change a few other tables) Fixed issue that caused parent/f1 strains to not be blocked correctly when using "block by index" tool Basic Stats figures now load when the user clicks the tab, to improve initial page load time --- bin/genenetwork2 | 2 +- .../maintenance/generate_kinship_from_bimbam.py | 4 +- wqflask/maintenance/geno_to_json.py | 6 +- wqflask/wqflask/show_trait/SampleList.py | 5 +- wqflask/wqflask/show_trait/show_trait.py | 8 +- wqflask/wqflask/static/new/css/show_trait.css | 4 + .../new/javascript/dataset_menu_structure.json | 96 +++++++++++++++++++--- .../wqflask/static/new/javascript/show_trait.js | 80 +++++++++++++----- .../new/javascript/show_trait_mapping_tools.js | 29 +------ wqflask/wqflask/static/new/javascript/stats.js | 12 --- wqflask/wqflask/templates/mapping_results.html | 5 +- wqflask/wqflask/templates/search_result_page.html | 9 +- wqflask/wqflask/templates/show_trait.html | 33 +++++--- wqflask/wqflask/templates/show_trait_details.html | 9 +- .../wqflask/templates/show_trait_edit_data.html | 12 +-- .../templates/show_trait_mapping_tools.html | 67 ++++++++------- .../wqflask/templates/show_trait_statistics.html | 10 +-- .../templates/show_trait_transform_and_filter.html | 79 ++++++++++++++++++ 18 files changed, 323 insertions(+), 147 deletions(-) create mode 100644 wqflask/wqflask/templates/show_trait_transform_and_filter.html (limited to 'wqflask/maintenance') diff --git a/bin/genenetwork2 b/bin/genenetwork2 index 10e99d8b..21f0db13 100755 --- a/bin/genenetwork2 +++ b/bin/genenetwork2 @@ -25,7 +25,7 @@ # webserver) run from the base-dir with settings file and add that # script with a -c switch, e.g. # -# env GN2_PROFILE=/usr/local/guix-profiles/gn2-latest SQL_URI=mysql://webqtlout:webqtlout@lily.uthsc.edu/db_webqtl ./bin/genenetwork2 ./etc/default_settings.py -c ./maintenance/gen_select_dataset.py +# env GN2_PROFILE=/usr/local/guix-profiles/gn-latest-20181119 TMPDIR=/export/local/home/zas1024/gn2-zach/tmp WEBSERVER_MODE=DEBUG LOG_LEVEL=DEBUG SERVER_PORT=5002 GENENETWORK_FILES=/export/local/home/zas1024/gn2-zach/genotype_files SQL_URI=mysql://webqtlout:webqtlout@lily.uthsc.edu/db_webqtl ./bin/genenetwork2 ./etc/default_settings.py -c ./maintenance/gen_select_dataset.py # # To run any script in the environment # diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py index ad0eb036..b53f5dda 100644 --- a/wqflask/maintenance/generate_kinship_from_bimbam.py +++ b/wqflask/maintenance/generate_kinship_from_bimbam.py @@ -54,8 +54,8 @@ class GenerateKinshipMatrices(object): if __name__=="__main__": - Geno_Directory = """/home/zas1024/genotype_files/genotype/""" - Bimbam_Directory = """/home/zas1024/genotype_files/genotype/bimbam/""" + Geno_Directory = """/export/local/home/zas1024/genotype_files/genotype/""" + Bimbam_Directory = """/export/local/home/zas1024/genotype_files/genotype/bimbam/""" GenerateKinshipMatrices.process_all(Geno_Directory, Bimbam_Directory) #./gemma -g /home/zas1024/genotype_files/genotype/bimbam/BXD_geno.txt -p /home/zas1024/genotype_files/genotype/bimbam/BXD_pheno.txt -gk 1 -o BXD \ No newline at end of file diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py index 789a1691..9579812a 100644 --- a/wqflask/maintenance/geno_to_json.py +++ b/wqflask/maintenance/geno_to_json.py @@ -24,6 +24,8 @@ import simplejson as json from pprint import pformat as pf +#from utility.tools import flat_files + class EmptyConfigurations(Exception): pass @@ -183,8 +185,8 @@ class ConvertGenoFile(object): if __name__=="__main__": - Old_Geno_Directory = """/home/zas1024/genotype_files/genotype/""" - New_Geno_Directory = """/home/zas1024/genotype_files/genotype/json/""" + Old_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype""" + New_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype/json""" #Input_File = """/home/zas1024/gene/genotype_files/genotypes/BXD.geno""" #Output_File = """/home/zas1024/gene/wqflask/wqflask/pylmm/data/bxd.snps""" #convertob = ConvertGenoFile("/home/zas1024/gene/genotype_files/genotypes/SRxSHRSPF2.geno", "/home/zas1024/gene/genotype_files/new_genotypes/SRxSHRSPF2.json") diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 31d47ff2..6d9f07a0 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -63,10 +63,7 @@ class SampleList(object): sample.extra_info['url'] = "/mouseCross.html#AXB/BXA" sample.extra_info['css_class'] = "fs12" - if sample_group_type == 'primary': - sample.this_id = "Primary_" + str(counter) - else: - sample.this_id = "Other_" + str(counter) + sample.this_id = str(counter) #### For extra attribute columns; currently only used by several datasets - Zach if self.sample_attribute_values: diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 34447853..7d6dd74e 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -153,7 +153,8 @@ class ShowTrait(object): hddn['group'] = self.temp_group hddn['species'] = self.temp_species hddn['use_outliers'] = False - hddn['method'] = "pylmm" + hddn['method'] = "gemma" + hddn['selected_chr'] = -1 hddn['mapping_display_all'] = True hddn['suggestive'] = 0 hddn['num_perm'] = 0 @@ -182,6 +183,11 @@ class ShowTrait(object): self.sample_group_types['samples_primary'] = self.dataset.group.name sample_lists = [group.sample_list for group in self.sample_groups] + #ZS: Get list of chromosomes to select for mapping + self.chr_list = [["All", -1]] + for i, this_chr in enumerate(self.species.chromosomes.chromosomes): + self.chr_list.append([self.species.chromosomes.chromosomes[this_chr].name, i]) + self.genofiles = get_genofiles(self.dataset) self.has_num_cases = has_num_cases(self.this_trait) diff --git a/wqflask/wqflask/static/new/css/show_trait.css b/wqflask/wqflask/static/new/css/show_trait.css index aa47d13f..c03b6103 100644 --- a/wqflask/wqflask/static/new/css/show_trait.css +++ b/wqflask/wqflask/static/new/css/show_trait.css @@ -27,6 +27,10 @@ table.dataTable thead .sorting_desc { background-image: url("../packages/DataTables/images/sort_desc_disabled.png"); } +table.dataTable thead th { + padding: 4px 18px 4px 10px; +} + table.dataTable tbody td { padding: 3px 20px 1px 10px; } diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 9c806a7f..72008225 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -1557,6 +1557,42 @@ ] ] }, + "AIL-LGSM-F34-A": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-APublish", + "AIL-LGSM-F34-A Phenotypes" + ] + ] + }, + "AIL-LGSM-F34-F39-43-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-F39-43-GBSPublish", + "AIL-LGSM-F34-F39-43-GBS Phenotypes" + ] + ] + }, + "AIL-LGSM-F34-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-GBSPublish", + "AIL-LGSM-F34-GBS Phenotypes" + ] + ] + }, + "AIL-LGSM-F39-43-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F39-43-GBSPublish", + "AIL-LGSM-F39-43-GBS Phenotypes" + ] + ] + }, "AKXD": { "Genotypes": [ [ @@ -2590,6 +2626,11 @@ ] ], "Liver mRNA": [ + [ + "857", + "EPFLMouseLiverCDHFDRMA0818", + "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" + ], [ "859", "EPFLMouseLiverCDRMA0818", @@ -2620,11 +2661,6 @@ "NIA-AgBXD-Liv_HFD-0818", "NIA Aging BXD HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" ], - [ - "857", - "EPFLMouseLiverCDHFDRMA0818", - "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" - ], [ "430", "EPFLMouseLiverRMA0413", @@ -2640,6 +2676,11 @@ "EPFLMouseLiverCDRMA0413", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], + [ + "848", + "EPFLMouseLiverHFCEx0413", + "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" + ], [ "433", "EPFLMouseLiverBothExRMA0413", @@ -2650,11 +2691,6 @@ "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" - ], [ "700", "UTHSC-VGX_MmBXDHepatocytesRMA1014", @@ -4001,6 +4037,22 @@ "AIL", "AIL Advanced Intercross Line" ], + [ + "AIL-LGSM-F34-A", + "AIL LGSM F34 (Array)" + ], + [ + "AIL-LGSM-F34-GBS", + "AIL LGSM F34 (GBS)" + ], + [ + "AIL-LGSM-F34-F39-43-GBS", + "AIL LGSM F34 and F39-43 (GBS)" + ], + [ + "AIL-LGSM-F39-43-GBS", + "AIL LGSM F39-43 (GBS)" + ], [ "AKXD", "AKXD RI Family" @@ -4929,6 +4981,30 @@ "Striatum mRNA" ] ], + "AIL-LGSM-F34-A": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F34-F39-43-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F34-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F39-43-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], "AKXD": [ [ "Genotypes", diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index df86e764..717d98b9 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -417,16 +417,27 @@ } console.log("towards end:", sample_sets); update_stat_values(sample_sets); - console.log("redrawing histogram"); - redraw_histogram(); - console.log("redrawing bar chart"); - redraw_bar_chart(); - console.log("redrawing box plot"); - redraw_box_plot(); - console.log("redrawing violin plot"); - redraw_violin_plot(); - console.log("redrawing probability plot"); - return redraw_prob_plot(); + + 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; @@ -853,7 +864,13 @@ } }; root.bar_layout = layout - Plotly.newPlot('bar_chart', root.bar_data, root.bar_layout, root.modebar_options) + $('.bar_chart_tab').click(function() { + if ($('#bar_chart').hasClass('js-plotly-plot')){ + redraw_bar_chart(); + } else { + Plotly.newPlot('bar_chart', root.bar_data, root.bar_layout, root.modebar_options) + } + }); } if (full_sample_lists.length > 1) { @@ -957,11 +974,18 @@ ] } - obj = { + box_obj = { data: box_data, layout: root.box_layout } - Plotly.newPlot('box_plot', obj, root.modebar_options); + + $('.box_plot_tab').click(function() { + if ($('#box_plot').hasClass('js-plotly-plot')){ + redraw_box_plot(); + } else { + Plotly.newPlot('box_plot', box_obj, root.modebar_options); + } + }); // Violin Plot @@ -1066,12 +1090,18 @@ ] } - obj = { + violin_obj = { data: violin_data, layout: root.violin_layout } - Plotly.plot('violin_plot', obj, root.modebar_options) + $('.violin_plot_tab').click(function() { + if ($('#violin_plot').hasClass('js-plotly-plot')){ + redraw_violin_plot(); + } else { + Plotly.plot('violin_plot', violin_obj, root.modebar_options); + } + }); // Histogram var hist_trace = { @@ -1091,9 +1121,16 @@ b: 60 } }; - Plotly.newPlot('histogram', data, layout, root.modebar_options) - update_histogram_width() + $('.histogram_tab').click(function() { + if ($('#histogram').hasClass('js-plotly-plot')){ + redraw_histogram(); + update_histogram_width(); + } else { + Plotly.newPlot('histogram', data, layout, root.modebar_options) + update_histogram_width() + } + }); $('.histogram_samples_group').val(root.stats_group); $('.histogram_samples_group').change(function() { @@ -1119,13 +1156,18 @@ root.prob_plot_group = 'samples_primary'; $('.prob_plot_samples_group').val(root.prob_plot_group); + $('.prob_plot_tab').click(function() { + return redraw_prob_plot(); + }); $('.prob_plot_samples_group').change(function() { root.prob_plot_group = $(this).val(); return redraw_prob_plot(); }); - make_table(); - edit_data_change(); + $('.stats_panel').click(function() { + make_table(); + edit_data_change(); + }); $('#edit_sample_lists').change(edit_data_change); $('.edit_sample_value').change(edit_data_change); $('#block_by_index').click(edit_data_change); diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index daa5b3f2..4e82fff2 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -154,36 +154,12 @@ }; })(this)); - $("#pylmm_mapping_compute").on("mouseover", (function(_this) { - return function() { - if ($(".outlier").length && $(".outlier-alert").length < 1) { - return showalert(outlier_text, "alert-success outlier-alert"); - } - }; - })(this)); - - $("#pylmm_compute").on("click", (function(_this) { - return function() { - var form_data, url; - //$("#progress_bar_container").modal(); - url = "/loading"; - $('input[name=method]').val("pylmm"); - $('input[name=genofile]').val($('#genofile_pylmm').val()); - $('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val()); - $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_pylmm]:checked').val()); - form_data = $('#trait_data_form').serialize(); - console.log("form_data is:", form_data); - return submit_special(url); - //return do_ajax_post(url, form_data); - }; - })(this)); - $("#rqtl_geno_compute").on("click", (function(_this) { return function() { var form_data, url; - //$("#progress_bar_container").modal(); url = "/loading"; $('input[name=method]').val("rqtl_geno"); + $('input[name=selected_chr]').val($('#chr_rqtl_geno').val()); $('input[name=genofile]').val($('#genofile_rqtl_geno').val()); $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val()); @@ -203,7 +179,6 @@ } else { return submit_special(url); - //return do_ajax_post(url, form_data); } }; })(this)); @@ -214,6 +189,7 @@ console.log("RUNNING GEMMA"); url = "/loading"; $('input[name=method]').val("gemma"); + $('input[name=selected_chr]').val($('#chr_gemma').val()); $('input[name=num_perm]').val(0); $('input[name=genofile]').val($('#genofile_gemma').val()); $('input[name=maf]').val($('input[name=maf_gemma]').val()); @@ -230,6 +206,7 @@ //$("#progress_bar_container").modal(); url = "/loading"; $('input[name=method]').val("reaper"); + $('input[name=selected_chr]').val($('#chr_reaper').val()); $('input[name=genofile]').val($('#genofile_reaper').val()); $('input[name=num_perm]').val($('input[name=num_perm_reaper]').val()); $('input[name=control_marker]').val($('input[name=control_reaper]').val()); diff --git a/wqflask/wqflask/static/new/javascript/stats.js b/wqflask/wqflask/static/new/javascript/stats.js index 4f99982e..356d1cb0 100644 --- a/wqflask/wqflask/static/new/javascript/stats.js +++ b/wqflask/wqflask/static/new/javascript/stats.js @@ -154,16 +154,4 @@ Stats = (function() { })(); -bxd_only = new Stats([3, 5, 7, 8]); - -console.log("[xred] bxd_only mean:", bxd_only.mean()); - -console.log("[xgreen] bxd_only median:", bxd_only.median()); - -console.log("[xpurple] bxd_only std_dev:", bxd_only.std_dev()); - -console.log("[xmagenta] bxd_only std_error:", bxd_only.std_error()); - -console.log("[xyellow] bxd_only min:", bxd_only.min()); - window.Stats = Stats; diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 5fb2c95e..00d725ea 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -257,7 +257,7 @@

Interval Analyst

- +
{% for header in gene_table_header %} @@ -355,9 +355,7 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": "600px", "scrollCollapse": false, - "scroller": true, "paging": false } ); @@ -372,7 +370,6 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": "600px", "scrollCollapse": false, "paging": false } ); diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 9ad8a53e..a325ec9f 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -4,6 +4,7 @@ + {% endblock %} {% block content %} @@ -84,9 +85,9 @@ {% for header in header_fields %} {% if header == 'Max LRS' %} - + {% elif header == 'Additive Effect' %} - + {% else %} {% endif %} @@ -99,9 +100,9 @@ {% for header in header_fields %} {% if header == 'Max LRS' %} - + {% elif header == 'Additive Effect' %} - + {% else %} {% endif %} diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 8726226c..f5e81060 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -52,7 +52,7 @@
-
+

Statistics

@@ -62,26 +62,38 @@ {% include 'show_trait_statistics.html' %}
-
+

- Calculate Correlations + Transform and Filter Data

+
+ {% include 'show_trait_transform_and_filter.html' %} +
+
+
+
+
+

+ Calculate Correlations +

+
+
{% include 'show_trait_calculate_correlations.html' %}
-
+

Mapping Tools

-
+
{% include 'show_trait_mapping_tools.html' %}
@@ -89,12 +101,12 @@
-
+

Review and Edit Data

-
+
{% include 'show_trait_edit_data.html' %}
@@ -210,7 +222,7 @@ "iDisplayLength": -1, "autoWidth": true, "bLengthChange": true, - "bDeferRender": true, + "deferRender": false, "bSortClasses": false, "scrollY": "600px", "scrollCollapse": false, @@ -221,7 +233,7 @@ } ); {% else %} - + $('#samples_primary, #samples_other').DataTable( { "columns": [ { "bSortable": false, "width": "8%" }, @@ -242,7 +254,7 @@ "iDisplayLength": -1, "autoWidth": true, "bLengthChange": true, - "bDeferRender": true, + "deferRender": false, "bSortClasses": false, "scrollY": "600px", "scrollCollapse": false, @@ -251,6 +263,7 @@ }, "paging": false } ); + {% endif %} var slider = document.getElementById('p_range_slider'); diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index c1f8f824..0192bff1 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -4,10 +4,6 @@
{% if this_trait.dataset.type == 'Publish' %} - - - - @@ -24,6 +20,11 @@ + {% else %} + + + + {% endif %} {% if this_trait.dataset.type == 'ProbeSet' %} {% if this_trait.symbol != None %} diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index cfcf2ce5..ab134663 100644 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -1,6 +1,7 @@
+

@@ -81,7 +77,7 @@
- +--> {% for sample_type in sample_groups %} @@ -94,7 +90,7 @@ - + {% if sample_type.se_exists() %} @@ -113,7 +109,7 @@ {% for sample in sample_type.sample_list %} - + diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 8e003897..e0bc8eb8 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -14,11 +14,6 @@
  • R/qtl
  • - {% endif %} {% for mapping_method in dataset.group.mapping_names %} {% if mapping_method == "GEMMA" %} @@ -39,6 +34,16 @@
    +
    + +
    + +
    +
    {% if genofiles and genofiles|length>0 %}
    @@ -61,11 +66,11 @@
    @@ -110,6 +115,16 @@ {% if dataset.group.mapping_id == "1" %}
    +
    + +
    + +
    +
    {% if genofiles and genofiles|length>0 %}
    @@ -202,6 +217,16 @@
    +
    + +
    + +
    +
    {% if genofiles and genofiles|length>0 %}
    @@ -304,30 +329,6 @@
    -
    -
    - {% if genofiles and genofiles|length>0 %} -
    - -
    - -
    -
    - {% endif %} -
    - -
    - -
    -
    -
    -
    {% endif %}
    @@ -341,10 +342,6 @@
    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.
    R/qtl
    R/qtl is an extensible, interactive environment for mapping quantitative trait loci (QTL) in experimental crosses.
    - {% endif %}
    diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html index ac0c753a..a0bdc987 100644 --- a/wqflask/wqflask/templates/show_trait_statistics.html +++ b/wqflask/wqflask/templates/show_trait_statistics.html @@ -5,15 +5,15 @@ Basic Statistics
  • - Histogram + Histogram
  • {% if num_values < 256 %}
  • - Bar Chart + Bar Chart
  • {% endif %}
  • - Probability Plot + Probability Plot
  • {% if g.user_session.logged_in %}
  • @@ -21,10 +21,10 @@
  • {% endif %}
  • - Box Plot + Box Plot
  • - Violin Plot + Violin Plot
  • diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html new file mode 100644 index 00000000..5d14a30e --- /dev/null +++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html @@ -0,0 +1,79 @@ +
    +
    + Block samples +

    Edit or delete values in the Trait Data boxes, and use the + Reset option as + needed. +

    + +
    + + + + +
    + + {% if sample_groups[0].attributes %} +
    + + + + +
    + {% endif %} +
    + + + + + + + +
    +
    + + +
    + +
    +
    + +
    +

    Outliers highlighted in + yellow + can be hidden using + the Hide Outliers button. +

    + +

    Samples with no value (x) can be hidden by clicking + Hide No Value button. +

    +
    +
    +
    \ No newline at end of file -- cgit 1.4.1 From 4fbeea6d1ed1ac2b81eb431ee837201945abc841 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 5 Dec 2018 11:48:24 -0600 Subject: Fixed issue where SNP track for mapping did not appear correctly Updated style for a variety of tables Moved transform/blocking tools for trait sample table into its own tab Added some new customization options to network graph Started work on implementing third party link-outs Updated drop-down generation script to order datasets according to CreateTime --- wqflask/maintenance/gen_select_dataset.py | 2 +- wqflask/wqflask/external_tools/send_to_bnw.py | 0 wqflask/wqflask/heatmap/heatmap.py | 2 - .../marker_regression/display_mapping_results.py | 3 +- wqflask/wqflask/marker_regression/run_mapping.py | 6 +- .../wqflask/static/new/css/marker_regression.css | 36 +++- wqflask/wqflask/static/new/css/show_trait.css | 2 +- .../new/javascript/dataset_menu_structure.json | 224 +++++++++++---------- .../wqflask/static/new/javascript/network_graph.js | 125 +++++++++--- wqflask/wqflask/templates/collections/list.html | 8 +- wqflask/wqflask/templates/collections/view.html | 36 ++-- wqflask/wqflask/templates/gsearch_gene.html | 13 +- wqflask/wqflask/templates/gsearch_pheno.html | 23 ++- wqflask/wqflask/templates/mapping_results.html | 41 +--- wqflask/wqflask/templates/network_graph.html | 48 ++++- wqflask/wqflask/templates/search_result_page.html | 43 ++-- .../wqflask/templates/show_trait_edit_data.html | 6 +- .../templates/show_trait_transform_and_filter.html | 2 +- 18 files changed, 368 insertions(+), 252 deletions(-) create mode 100644 wqflask/wqflask/external_tools/send_to_bnw.py (limited to 'wqflask/maintenance') diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 55c642a4..4ad921a2 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -248,7 +248,7 @@ def build_datasets(species, group, type_name): ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = '%s' and ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and ProbeSetFreeze.confidentiality < 1 and ProbeSetFreeze.public > 0 order by - ProbeSetFreeze.OrderList asc""" % (species, group, type_name)) + ProbeSetFreeze.CreateTime desc""" % (species, group, type_name)) dataset_results = Cursor.fetchall() datasets = [] diff --git a/wqflask/wqflask/external_tools/send_to_bnw.py b/wqflask/wqflask/external_tools/send_to_bnw.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py index af75d441..7b328cb5 100644 --- a/wqflask/wqflask/heatmap/heatmap.py +++ b/wqflask/wqflask/heatmap/heatmap.py @@ -46,9 +46,7 @@ from flask import Flask, g class Heatmap(object): def __init__(self, start_vars, temp_uuid): - trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] - helper_functions.get_trait_db_obs(self, trait_db_list) self.temp_uuid = temp_uuid diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 09646f57..e63e4af2 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -772,7 +772,8 @@ class DisplayMappingResults(object): fontZoom = 1.5 drawSNPLocationY = yTopOffset + plotHeight - chrName = self.genotype[0].name + #chrName = self.genotype[0].name + chrName = self.ChrList[self.selectedChr][0] stepMb = (endMb-startMb)/plotWidth strainId1, strainId2 = self.diffCol diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index aee3cc2a..3057e340 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -652,9 +652,9 @@ def trim_markers_for_table(markers): else: sorted_markers = sorted(markers, key=lambda k: k['lrs_value'], reverse=True) - #ZS: So we end up with a list of just 200 markers - if len(sorted_markers) >= 200: - trimmed_sorted_markers = sorted_markers[:200] + #ZS: So we end up with a list of just 2000 markers + if len(sorted_markers) >= 2000: + trimmed_sorted_markers = sorted_markers[:2000] return trimmed_sorted_markers else: return sorted_markers \ No newline at end of file diff --git a/wqflask/wqflask/static/new/css/marker_regression.css b/wqflask/wqflask/static/new/css/marker_regression.css index d81b5021..8d205143 100644 --- a/wqflask/wqflask/static/new/css/marker_regression.css +++ b/wqflask/wqflask/static/new/css/marker_regression.css @@ -35,4 +35,38 @@ rect.pane { /*rect { stroke: WhiteSmoke; fill: Azure; -}*/ \ No newline at end of file +}*/ + +tr .outlier { + background-color: #ffff99; +} + +table.dataTable thead th{ + border-right: 1px solid white; + color: white; + background-color: #369; +} + +table.dataTable thead .sorting_asc { + background-image: url("../packages/DataTables/images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc { + background-image: url("../packages/DataTables/images/sort_desc_disabled.png"); +} + +table.dataTable thead th { + padding: 4px 18px 4px 10px; +} + +table.dataTable tbody td { + padding: 3px 20px 1px 10px; +} + +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { + border-top: 1px solid #ccc; + border-right: 1px solid #ccc; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ccc; +} \ No newline at end of file diff --git a/wqflask/wqflask/static/new/css/show_trait.css b/wqflask/wqflask/static/new/css/show_trait.css index c03b6103..59901404 100644 --- a/wqflask/wqflask/static/new/css/show_trait.css +++ b/wqflask/wqflask/static/new/css/show_trait.css @@ -32,7 +32,7 @@ table.dataTable thead th { } table.dataTable tbody td { - padding: 3px 20px 1px 10px; + padding: 4px 20px 2px 10px; } table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 72008225..a4ec6ece 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -1346,15 +1346,15 @@ "HLC_0311", "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], - [ - "383", - "HLCM_0311", - "GSE9588 Human Liver Normal (Mar11) Males" - ], [ "384", "HLCF_0311", "GSE9588 Human Liver Normal (Mar11) Females" + ], + [ + "383", + "HLCM_0311", + "GSE9588 Human Liver Normal (Mar11) Males" ] ], "Phenotypes": [ @@ -1717,16 +1717,16 @@ "BRF2_M_0805_M", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" ], - [ - "77", - "BRF2_M_0805_R", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" - ], [ "78", "BRF2_M_0805_P", "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", @@ -1823,30 +1823,30 @@ "SA_M2_0905_M", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" ], - [ - "84", - "SA_M2_0905_R", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" - ], [ "85", "SA_M2_0905_P", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN" + ], + [ + "84", + "SA_M2_0905_R", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" ] ] }, "BHF2": { "Adipose mRNA": [ - [ - "196", - "UCLA_BHF2_ADIPOSE_MALE", - "UCLA BHF2 Adipose Male mlratio" - ], [ "197", "UCLA_BHF2_ADIPOSE_FEMALE", "UCLA BHF2 Adipose Female mlratio" ], + [ + "196", + "UCLA_BHF2_ADIPOSE_MALE", + "UCLA BHF2 Adipose Male mlratio" + ], [ "165", "UCLA_BHF2_ADIPOSE_0605", @@ -1854,16 +1854,16 @@ ] ], "Brain mRNA": [ - [ - "198", - "UCLA_BHF2_BRAIN_MALE", - "UCLA BHF2 Brain Male mlratio" - ], [ "199", "UCLA_BHF2_BRAIN_FEMALE", "UCLA BHF2 Brain Female mlratio" ], + [ + "198", + "UCLA_BHF2_BRAIN_MALE", + "UCLA BHF2 Brain Male mlratio" + ], [ "166", "UCLA_BHF2_BRAIN_0605", @@ -1878,16 +1878,16 @@ ] ], "Liver mRNA": [ - [ - "200", - "UCLA_BHF2_LIVER_MALE", - "UCLA BHF2 Liver Male mlratio" - ], [ "201", "UCLA_BHF2_LIVER_FEMALE", "UCLA BHF2 Liver Female mlratio" ], + [ + "200", + "UCLA_BHF2_LIVER_MALE", + "UCLA BHF2 Liver Male mlratio" + ], [ "167", "UCLA_BHF2_LIVER_0605", @@ -2016,7 +2016,7 @@ [ "779", "EL_BXDCDScWAT_0216", - "EPFL/LISP BXD CD Subcutaneous WAT Affy MTA 1.0 Gene Level (Feb16) RMA **" + "EPFL/LISP BXD CD Subcutaneous WAT Affy MTA 1.0 Gene Level (Feb16) RMA" ] ], "Adrenal Gland mRNA": [ @@ -2122,9 +2122,9 @@ "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], [ - "80", - "BR_U_0805_M", - "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" + "82", + "BR_U_0805_R", + "UTHSC Brain mRNA U74Av2 (Aug05) RMA" ], [ "81", @@ -2132,9 +2132,9 @@ "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" ], [ - "82", - "BR_U_0805_R", - "UTHSC Brain mRNA U74Av2 (Aug05) RMA" + "80", + "BR_U_0805_M", + "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" ], [ "42", @@ -2237,16 +2237,16 @@ "Eye_M2_0908_R_MT", "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" ], - [ - "279", - "Eye_M2_0908_R_WT", - "Eye M430v2 WT Tyrp1 (Sep08) RMA" - ], [ "382", "Eye_M2_0908_WTWT", "Eye M430v2 WT WT (Sep08) RMA" ], + [ + "279", + "Eye_M2_0908_R_WT", + "Eye M430v2 WT Tyrp1 (Sep08) RMA" + ], [ "400", "DBA2J-ONH-1212", @@ -2530,16 +2530,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", @@ -2562,6 +2562,26 @@ ] ], "Liver Metabolome": [ + [ + "838", + "UTHSC-ETHZ-EPFL_LivPMetExtBHFD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction B, HFD Cohorts (Mar 2017) log2" + ], + [ + "835", + "UTHSC-ETHZ-EPFL_LivPMetExtACD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction A, Chow Diet Cohorts (Mar 2017) log2" + ], + [ + "837", + "UTHSC-ETHZ-EPFL_LivPMetExtBCD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction B, Chow Diet Cohorts (Mar 2017) log2" + ], + [ + "836", + "UTHSC-ETHZ-EPFL_LivPMetExtAHFD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction A, HFD Cohorts (Mar 2017) log2" + ], [ "473", "EPFL-LISP_LivPMetCDHFD1213", @@ -2631,36 +2651,36 @@ "EPFLMouseLiverCDHFDRMA0818", "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" ], + [ + "858", + "EPFLMouseLiverHFDRMA0818", + "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" + ], [ "859", "EPFLMouseLiverCDRMA0818", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" ], [ - "851", - "NIA-AgBXD-Liv_CDHFD-0818", - "NIA Aging BXD CD+HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" + "854", + "NIA-AgBXD-Liv_CDHFD-rna-seq-0818", + "NIA Aging BXD CD+HFD Liver RNA-Seq (Aug18) Log2" + ], + [ + "855", + "NIA-AgBXD-Liv_HFD-rna-seq-0818", + "NIA Aging BXD HFD Liver RNA-Seq (Aug18) Log2" ], [ - "853", - "NIA-AgBXD-Liv_CD-0818", - "NIA Aging BXD CD Liver Affy Clariom S Gene Level (Aug18) RMA **" + "856", + "NIA-AgBXD-Liv_CD-rna-seq-0818", + "NIA Aging BXD CD Liver RNA-Seq (Aug18) Log2" ], [ "818", "UCLA_BXD_Liv_Jan16", "UCLA BXD Liver Affy M430 2.0 (Jan16) RMA" ], - [ - "858", - "EPFLMouseLiverHFDRMA0818", - "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" - ], - [ - "852", - "NIA-AgBXD-Liv_HFD-0818", - "NIA Aging BXD HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" - ], [ "430", "EPFLMouseLiverRMA0413", @@ -2672,25 +2692,25 @@ "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], [ - "432", - "EPFLMouseLiverCDRMA0413", - "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" ], [ "848", "EPFLMouseLiverHFCEx0413", "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" ], + [ + "432", + "EPFLMouseLiverCDRMA0413", + "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" + ], [ "433", "EPFLMouseLiverBothExRMA0413", "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" ], - [ - "849", - "EPFLMouseLiverCDEx0413", - "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], [ "700", "UTHSC-VGX_MmBXDHepatocytesRMA1014", @@ -2839,15 +2859,15 @@ "HQFNeoc_0208_RankInv", "HQF BXD Neocortex ILM6v1.1 (Feb08) RankInv" ], - [ - "274", - "DevNeocortex_ILM6.2P3RInv_1110", - "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" - ], [ "275", "DevNeocortex_ILM6.2P14RInv_1110", "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" + ], + [ + "274", + "DevNeocortex_ILM6.2P3RInv_1110", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -3079,15 +3099,15 @@ "VCUSal_0609_R", "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" ], - [ - "229", - "VCUEtOH_0609_R", - "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" - ], [ "230", "VCUEtvsSal_0609_R", "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" + ], + [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" ] ] }, @@ -3105,17 +3125,7 @@ [ "843", "UTHSC-BXD-Harv_Liv-0118", - "UTHSC BXD Harvested Liver RNA-Seq (Aug18) Log2 **" - ], - [ - "842", - "UTHSC-BXD-Liv-0917", - "UTHSC BXD Liver Affy Clariom S GeneLevel Main (Sep17) RMA **" - ], - [ - "850", - "UTHSC-BXD-Liv-0818", - "UTHSC BXD Liver Affy Clariom S GeneLevel Main (Aug18) RMA **" + "UTHSC BXD Harvested Liver RNA-Seq (Aug18) Log2" ] ], "Phenotypes": [ @@ -3521,26 +3531,26 @@ ] ], "Hippocampus mRNA": [ - [ - "211", - "Illum_LXS_Hipp_RSS_1008", - "Hippocampus Illumina RSS (Oct08) RankInv beta" - ], [ "212", "Illum_LXS_Hipp_RSE_1008", "Hippocampus Illumina RSE (Oct08) RankInv beta" ], - [ - "213", - "Illum_LXS_Hipp_NOS_1008", - "Hippocampus Illumina NOS (Oct08) RankInv beta" - ], [ "214", "Illum_LXS_Hipp_NOE_1008", "Hippocampus Illumina NOE (Oct08) RankInv beta" ], + [ + "211", + "Illum_LXS_Hipp_RSS_1008", + "Hippocampus Illumina RSS (Oct08) RankInv beta" + ], + [ + "213", + "Illum_LXS_Hipp_NOS_1008", + "Hippocampus Illumina NOS (Oct08) RankInv beta" + ], [ "219", "Illum_LXS_Hipp_NON_1008", @@ -3707,16 +3717,16 @@ }, "Retina-RGC-Rheaume": { "Retina Single-cell RNA-Seq": [ - [ - "866", - "UConn-RGC-RSeq_log2-0918", - "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Log2" - ], [ "865", "UConn-RGC-RSeq_r-0918", "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Raw" ], + [ + "866", + "UConn-RGC-RSeq_log2-0918", + "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Log2" + ], [ "867", "UConn-RGC-RSeq_s-0918", diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index 0ecf4743..bc02181f 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -1,18 +1,9 @@ -window.onload=function() { - // id of Cytoscape Web container div - //var div_id = "cytoscapeweb"; - - var cy = cytoscape({ - container: $('#cytoscapeweb'), // container to render in - - elements: elements_list, - - style: [ // the stylesheet for the graph +var default_style = [ // the stylesheet for the graph { selector: 'node', style: { 'background-color': '#666', - 'label': 'data(label )', + 'label': 'data(label)', 'font-size': 10 } }, @@ -27,16 +18,28 @@ window.onload=function() { 'font-size': 8 } } - ], - - zoom: 12, - layout: { name: 'circle', + ] + +var default_layout = { name: 'circle', fit: true, // whether to fit the viewport to the graph padding: 30 // the padding on fit //idealEdgeLength: function( edge ){ return edge.data['correlation']*10; }, - }, + } + +window.onload=function() { + // id of Cytoscape Web container div + //var div_id = "cytoscapeweb"; + var cy = cytoscape({ + container: $('#cytoscapeweb'), // container to render in + + elements: elements_list, + style: default_style, + + zoom: 12, + layout: default_layout, + zoomingEnabled: true, userZoomingEnabled: true, panningEnabled: true, @@ -131,22 +134,25 @@ window.onload=function() { create_qtips(cy) - $('#slide').change(function() { + $('#neg_slide').change(function() { eles.restore() + + pos_slide_val = $('#pos_slide').val(); + cy.$("node[max_corr > " + $(this).val() + "][max_corr < " + pos_slide_val + "]").remove(); + cy.$("edge[correlation > " + $(this).val() + "][correlation < " + pos_slide_val + "]").remove(); + + cy.layout({ name: $('select[name=layout_select]').val(), + fit: true, // whether to fit the viewport to the graph + padding: 25 // the padding on fit + }); - console.log(eles) - - // nodes_to_restore = eles.filter("node[max_corr >= " + $(this).val() + "], edge[correlation >= " + $(this).val() + "][correlation <= -" + $(this).val() + "]") - // nodes_to_restore.restore() - - // edges_to_restore = eles.filter("edge[correlation >= " + $(this).val() + "][correlation <= -" + $(this).val() + "]") - // edges_to_restore.restore() - - //cy.$("node[max_corr >= " + $(this).val() + "]").restore(); - //cy.$("edge[correlation >= " + $(this).val() + "][correlation <= -" + $(this).val() + "]").restore(); - - cy.$("node[max_corr < " + $(this).val() + "]").remove(); - cy.$("edge[correlation < " + $(this).val() + "][correlation > -" + $(this).val() + "]").remove(); + }); + $('#pos_slide').change(function() { + eles.restore() + + neg_slide_val = $('#neg_slide').val(); + cy.$("node[max_corr > " + neg_slide_val +"][max_corr < " + $(this).val() + "]").remove(); + cy.$("edge[correlation > " + neg_slide_val +"][correlation < " + $(this).val() + "]").remove(); cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph @@ -157,7 +163,8 @@ window.onload=function() { $('#reset_graph').click(function() { eles.restore() - $('#slide').val(0) + $('#pos_slide').val(0) + $('#neg_slide').val(0) cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit @@ -178,13 +185,67 @@ window.onload=function() { $('select[name=layout_select]').change(function() { layout_type = $(this).val() - console.log("LAYOUT:", layout_type) cy.layout({ name: layout_type, fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit }); }); + $('select[name=font_size]').change(function() { + font_size = $(this).val() + + new_style = default_style + new_style[0]['style']['font-size'] = parseInt(font_size) + cy.style().fromJson(new_style).update() + }); + $('select[name=edge_width]').change(function() { + //eles.restore() + + //ZS: This is needed, or else it alters the original object + orig_elements = JSON.parse(JSON.stringify(elements_list)); + + width_multiplier = $(this).val() + updated_elements = [] + for (i=0; i < orig_elements.length; i++){ + this_element = orig_elements[i] + if ('source' in this_element['data']) { + orig_width = this_element['data']['width'] + this_element['data']['width'] = orig_width * width_multiplier + } + updated_elements.push(this_element) + } + cy.remove(eles) + cy.add(updated_elements) + cy.layout({ name: $('select[name=layout_select]').val(), + fit: true, // whether to fit the viewport to the graph + padding: 25 // the padding on fit + }); + }); + + $('select[name=edge_width]').change(function() { + //eles.restore() + + //ZS: This is needed, or else it alters the original object + orig_elements = JSON.parse(JSON.stringify(elements_list)); + + width_multiplier = $(this).val() + updated_elements = [] + for (i=0; i < orig_elements.length; i++){ + this_element = orig_elements[i] + if ('source' in this_element['data']) { + orig_width = this_element['data']['width'] + this_element['data']['width'] = orig_width * width_multiplier + } + updated_elements.push(this_element) + } + cy.remove(eles) + cy.add(updated_elements) + cy.layout({ name: $('select[name=layout_select]').val(), + fit: true, // whether to fit the viewport to the graph + padding: 25 // the padding on fit + }); + }); + $("a#image_link").click(function(e) { var pngData = cy.png(); diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 64d5a676..5a2df5e3 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -4,6 +4,7 @@ + {% endblock %} {% block content %} @@ -15,7 +16,6 @@ 'You have {}.'.format(numify(collections|count, "collection", "collections"))) }} {% endif %} -

    -
    Max LRS Max LRS ?Additive Effect Additive Effect ?{{header}}Max LRS Max LRS ?Additive Effect Additive Effect ?{{header}} {{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}
    Tissue{{ this_trait.dataset.tissue }}
    Phenotype
    {{ this_trait.description_fmt }}
    Journal {{ this_trait.journal }} ({{ this_trait.year }})
    Tissue{{ this_trait.dataset.tissue }}
    IndexID Sample Value
    {{ loop.index }}
    +
    @@ -51,9 +51,9 @@ {% for uc in collections %} {% if g.user_session.logged_in %} - + {% else %} - + {% endif %}
    {{ loop.index }} {% if g.user_session.logged_in %} diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 864299a2..b6ad7be8 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -3,6 +3,7 @@ {% block css %} + {% endblock %} {% block content %} @@ -82,7 +83,7 @@
    - +
    @@ -92,21 +93,21 @@ - + - + {% for this_trait in trait_obs %} - - +
    Description Location MeanMax LRS Max LRS ? Max LRS LocationAdditive Effect Additive Effect ?
    + {{ loop.index }}{{ this_trait.dataset.name }}{{ this_trait.dataset.fullname }} 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() + '...') } }, "columns": [ - { "type": "natural", "width": "2%" }, - { "type": "natural", "width": "5%" }, - { "type": "natural", "width": "12%" }, - { "type": "natural", "width": "12%" }, + { "type": "natural", "width": 10 }, + { "type": "natural", "width": 50 }, + { "type": "natural" }, + { "type": "natural", "width": 120 }, { "type": "natural" }, - { "type": "natural", "width": "12%" }, - { "type": "natural", "width": "5%" }, - { "type": "natural", "width": "5%" }, - { "type": "natural", "width": "12%" }, - { "type": "natural", "width": "8%" } + { "type": "natural", "width": 130 }, + { "type": "natural", "width": 35 }, + { "type": "natural", "width": 35 }, + { "type": "natural", "width": 130 }, + { "type": "natural" } ], "columnDefs": [ { "targets": 0, @@ -194,8 +198,6 @@ "autoWidth": false, "bDeferRender": true, "bSortClasses": false, - "scrollY": "600px", - "scrollCollapse": true, "paging": false, "orderClasses": true } ); diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 0612bfcc..ff5c56f1 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -2,6 +2,7 @@ {% block title %}Search Results{% endblock %} {% block css %} + {% endblock %} {% block content %} @@ -28,7 +29,7 @@
    - +
    @@ -42,14 +43,14 @@ - - + + {% for this_trait in trait_list %} - + @@ -78,8 +79,8 @@ - - + +
    Description Location MeanMax LRS Additive Effect Max LRS ?Additive Effect ?
    {{ loop.index }} {{ this_trait.name }} {{ this_trait.species }}Description Location MeanMax LRS Additive Effect Max LRS ?Additive Effect ?
    diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index c2cbdadd..01b2403e 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -2,6 +2,7 @@ {% block title %}Search Results{% endblock %} {% block css %} + {% endblock %} {% block content %} @@ -28,7 +29,7 @@
    - +
    @@ -39,8 +40,8 @@ - - + + @@ -55,7 +56,7 @@ - + {% endfor %} @@ -110,14 +111,16 @@ console.time("Creating table"); $('#trait_table').DataTable( { "createdRow": function ( row, data, index ) { + $('td', row).eq(0).attr('style', 'padding: 0px;'); + $('td', row).eq(0).attr('align', 'center'); $('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)); + if ($('td', row).eq(6).text().length > 40) { + $('td', row).eq(6).text($('td', row).eq(6).text().substring(0, 40)); $('td', row).eq(6).text($('td', row).eq(6).text() + '...') } }, @@ -128,11 +131,11 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural", "width": "30%"}, - { "type": "natural", "width": "25%"}, { "type": "natural" }, - { "type": "natural", "width": "8%"}, - { "type": "natural" } + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural", "width": "5%"}, + { "type": "natural", "width": "8%" } ], "columnDefs": [ { diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 00d725ea..3138d855 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -181,7 +181,7 @@ {% if selectedChr == -1 %} -
    +

    Mapping Statistics


    @@ -190,8 +190,8 @@

    -
    -
    Description Authors YearMax LRS Additive Effect Max LRS ?Additive Effect ?
    {{ this_trait.authors }} {{ this_trait.pubmed_text }} {% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}{% if this_trait.additive %}{{ '%0.6f' % this_trait.additive }}{% else %}N/A{% endif %}
    +
    +
    @@ -215,7 +215,7 @@ {% for marker in trimmed_markers %} -