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 ++ 1 file changed, 2 insertions(+) (limited to 'wqflask/maintenance/convert_geno_to_bimbam.py') 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") -- cgit v1.2.3 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/convert_geno_to_bimbam.py') 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 v1.2.3 From ee1e49b90663be72032c8dee32748e97bc28e1e9 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 21 Dec 2018 10:48:33 -0600 Subject: Fixed collections so they can be very large (1000+ traits) Added option to submit traits in collection to BNW Fixed issue with "x" values for user-submitted traits Fixed issue where post-publications descriptions were wrongly appearing in global search results --- wqflask/base/data_set.py | 11 +- wqflask/maintenance/convert_geno_to_bimbam.py | 4 +- wqflask/wqflask/collect.py | 48 ++-- wqflask/wqflask/external_tools/__init__.py | 0 wqflask/wqflask/external_tools/send_to_bnw.py | 72 ++++++ .../wqflask/external_tools/send_to_geneweaver.py | 21 ++ wqflask/wqflask/gsearch.py | 22 +- wqflask/wqflask/search_results.py | 12 - wqflask/wqflask/show_trait/SampleList.py | 2 +- wqflask/wqflask/show_trait/show_trait.py | 4 +- .../new/javascript/dataset_menu_structure.json | 262 +++++++++++---------- .../static/new/javascript/search_results.js | 18 +- wqflask/wqflask/static/new/js_external/md5.min.js | 2 + wqflask/wqflask/templates/bnw_page.html | 7 + wqflask/wqflask/templates/collections/add.html | 4 + wqflask/wqflask/templates/collections/view.html | 13 + wqflask/wqflask/templates/search_result_page.html | 1 + wqflask/wqflask/templates/show_trait_details.html | 5 - wqflask/wqflask/views.py | 19 ++ 19 files changed, 348 insertions(+), 179 deletions(-) create mode 100644 wqflask/wqflask/external_tools/__init__.py create mode 100644 wqflask/wqflask/external_tools/send_to_geneweaver.py create mode 100644 wqflask/wqflask/static/new/js_external/md5.min.js create mode 100644 wqflask/wqflask/templates/bnw_page.html (limited to 'wqflask/maintenance/convert_geno_to_bimbam.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 4a422ee4..55782576 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -371,23 +371,16 @@ class DatasetGroup(object): result = Redis.get(key) if result is not None: - #logger.debug("Sample List Cache hit!!!") - #logger.debug("Before unjsonifying {}: {}".format(type(result), result)) self.samplelist = json.loads(result) - #logger.debug(" type: ", type(self.samplelist)) - #logger.debug(" self.samplelist: ", self.samplelist) else: logger.debug("Cache not hit") genotype_fn = locate_ignore_error(self.name+".geno",'genotype') - mapping_fn = locate_ignore_error(self.name+".fam",'mapping') - if mapping_fn: - self.samplelist = get_group_samplelists.get_samplelist("plink", mapping_fn) - elif genotype_fn: + if genotype_fn: self.samplelist = get_group_samplelists.get_samplelist("geno", genotype_fn) else: self.samplelist = None - logger.debug("Sample list: ",self.samplelist) + if USE_REDIS: Redis.set(key, json.dumps(self.samplelist)) Redis.expire(key, 60*5) diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py index 8f331a06..528b98cf 100644 --- a/wqflask/maintenance/convert_geno_to_bimbam.py +++ b/wqflask/maintenance/convert_geno_to_bimbam.py @@ -180,8 +180,8 @@ class ConvertGenoFile(object): break if __name__=="__main__": - Old_Geno_Directory = """/home/zas1024/genotype_files/genotype/""" - New_Geno_Directory = """/home/zas1024/genotype_files/genotype/bimbam/""" + Old_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype""" + New_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype/bimbam""" #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/collect.py b/wqflask/wqflask/collect.py index e51fa157..a04e4b13 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -85,9 +85,9 @@ class AnonCollection(object): num_members = collection['num_members'] return num_members - def add_traits(self, params): + def add_traits(self, unprocessed_traits): #assert collection_name == "Default", "Unexpected collection name for anonymous user" - self.traits = list(process_traits(params['traits'])) + self.traits = list(process_traits(unprocessed_traits)) existing_collections = Redis.get(self.key) logger.debug("existing_collections:", existing_collections) if existing_collections != None and existing_collections != "None": @@ -144,7 +144,6 @@ class AnonCollection(object): return str(len_now) def process_traits(unprocessed_traits): - #print("unprocessed_traits are:", unprocessed_traits) if isinstance(unprocessed_traits, basestring): unprocessed_traits = unprocessed_traits.split(",") traits = set() @@ -167,26 +166,38 @@ def report_change(len_before, len_now): else: logger.debug("No new traits were added.") +@app.route("/collections/store_trait_list", methods=('POST',)) +def store_traits_list(): + params = request.form + + traits = params['traits'] + hash = params['hash'] + + Redis.set(hash, traits) + + return hash @app.route("/collections/add") def collections_add(): - traits=request.args['traits'] - if g.user_session.logged_in: - user_collections = g.user_session.user_collections - #logger.debug("user_collections are:", user_collections) - return render_template("collections/add.html", - traits = traits, - collections = user_collections, - ) + collections = g.user_session.user_collections else: anon_collections = user_manager.AnonUser().get_collections() - collection_names = [] + collections = [] for collection in anon_collections: - collection_names.append({'id':collection['id'], 'name':collection['name']}) + collections.append({'id':collection['id'], 'name':collection['name']}) + + if 'traits' in request.args: + traits=request.args['traits'] return render_template("collections/add.html", traits = traits, - collections = collection_names, + collections = collections, + ) + else: + hash = request.args['hash'] + return render_template("collections/add.html", + hash = hash, + collections = collections, ) @app.route("/collections/new") @@ -231,7 +242,12 @@ def collections_new(): def create_new(collection_name): params = request.args - unprocessed_traits = params['traits'] + if "hash" in params: + unprocessed_traits = Redis.get(params['hash']) + Redis.delete(hash) + else: + unprocessed_traits = params['traits'] + traits = process_traits(unprocessed_traits) if g.user_session.logged_in: @@ -241,7 +257,7 @@ def create_new(collection_name): else: ac = AnonCollection(collection_name) ac.changed_timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p') - ac.add_traits(params) + ac.add_traits(unprocessed_traits) return redirect(url_for('view_collection', collection_id=ac.id)) @app.route("/collections/list") diff --git a/wqflask/wqflask/external_tools/__init__.py b/wqflask/wqflask/external_tools/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/wqflask/external_tools/send_to_bnw.py b/wqflask/wqflask/external_tools/send_to_bnw.py index e69de29b..e8f168f4 100644 --- a/wqflask/wqflask/external_tools/send_to_bnw.py +++ b/wqflask/wqflask/external_tools/send_to_bnw.py @@ -0,0 +1,72 @@ +## Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Dr. Robert W. Williams at rwilliams@uthsc.edu +# +# +# This module is used by GeneNetwork project (www.genenetwork.org) + +from __future__ import absolute_import, print_function, division + +from base.trait import GeneralTrait +from utility import helper_functions, corr_result_helpers + +import utility.logger +logger = utility.logger.getLogger(__name__ ) + +class SendToBNW(object): + def __init__(self, start_vars): + trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] + helper_functions.get_trait_db_obs(self, trait_db_list) + + trait_samples_list = [] + + for trait_db in self.trait_list: + trait_1 = trait_db[0] + this_sample_data = trait_1.data + + trait1_samples = list(this_sample_data.keys()) + trait_samples_list.append(trait1_samples) + + shared_samples = list(set(trait_samples_list[0]).intersection(*trait_samples_list)) + + self.form_value = "" #ZS: string that is passed to BNW through form + values_list = [] + for trait_db in self.trait_list: + this_trait = trait_db[0] + this_sample_data = this_trait.data + + trait_vals = [] + for sample in this_sample_data: + if sample in shared_samples: + trait_vals.append(this_sample_data[sample].value) + + values_list.append(trait_vals) + self.form_value += "_" + this_trait.name + "," + + values_list = zip(*values_list) + self.form_value = self.form_value[:-1] + self.form_value += ";" + + for row in values_list: + has_none = False + for cell in row: + if not cell: + has_none = True + break + if has_none: + continue + self.form_value += ",".join(str(cell) for cell in row) + self.form_value += ";" \ No newline at end of file diff --git a/wqflask/wqflask/external_tools/send_to_geneweaver.py b/wqflask/wqflask/external_tools/send_to_geneweaver.py new file mode 100644 index 00000000..956286af --- /dev/null +++ b/wqflask/wqflask/external_tools/send_to_geneweaver.py @@ -0,0 +1,21 @@ +## Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Dr. Robert W. Williams at rwilliams@uthsc.edu +# +# +# This module is used by GeneNetwork project (www.genenetwork.org) + +from __future__ import absolute_import, print_function, division \ No newline at end of file diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 37eb46cb..94965507 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -91,6 +91,7 @@ class GSearch(object): InbredSet.`Name`, PublishFreeze.`Name`, PublishXRef.`Id`, + Phenotype.`Pre_publication_description`, Phenotype.`Post_publication_description`, Publication.`Authors`, Publication.`Year`, @@ -126,23 +127,26 @@ class GSearch(object): this_trait['dataset'] = line[2] this_trait['species'] = line[0] this_trait['group'] = line[1] - this_trait['description'] = line[4] - this_trait['authors'] = line[5] - this_trait['year'] = line[6] + if line[8] != None: + this_trait['description'] = line[5] + else: + this_trait['description'] = line[4] + this_trait['authors'] = line[6] + this_trait['year'] = line[7] if this_trait['year'].isdigit(): this_trait['pubmed_text'] = this_trait['year'] else: this_trait['pubmed_text'] = "N/A" - if line[7] != "" and line[7] != None: - this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[7] + if line[8] != "" and line[8] != None: + this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8] else: this_trait['pubmed_link'] = "N/A" this_trait['LRS_score_repr'] = "N/A" - if line[8] != "" and line[8] != None: - this_trait['LRS_score_repr'] = '%3.1f' % line[8] + if line[9] != "" and line[9] != None: + this_trait['LRS_score_repr'] = '%3.1f' % line[9] this_trait['additive'] = "N/A" - if line[9] != "": - this_trait['additive'] = line[9] + if line[10] != "": + this_trait['additive'] = line[10] #dataset = create_dataset(line[2], "Publish") #trait_id = line[3] diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 53c96591..171fd0f9 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -44,18 +44,6 @@ views.py). # Names and IDs of group / F2 set ########################################### - # All Phenotypes is a special case we'll deal with later - #if kw['dataset'] == "All Phenotypes": - # self.cursor.execute(""" - # select PublishFreeze.Name, InbredSet.Name, InbredSet.Id from PublishFreeze, - # InbredSet where PublishFreeze.Name not like 'BXD300%' and InbredSet.Id = - # PublishFreeze.InbredSetId""") - # results = self.cursor.fetchall() - # self.dataset = map(lambda x: DataSet(x[0], self.cursor), results) - # self.dataset_groups = map(lambda x: x[1], results) - # self.dataset_group_ids = map(lambda x: x[2], results) - #else: - self.uc_id = uuid.uuid4() logger.debug("uc_id:", self.uc_id) # contains a unique id diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 6d9f07a0..f2259b55 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -46,7 +46,7 @@ class SampleList(object): sample_name = sample_name.replace("_2nd_", "") if type(self.this_trait) is list: #ZS: self.this_trait will be a list if it is a Temp trait - if counter <= len(self.this_trait) and self.this_trait[counter-1] != 'X': + if counter <= len(self.this_trait) and str(self.this_trait[counter-1]).upper() != 'X': sample = webqtlCaseData.webqtlCaseData(name=sample_name, value=float(self.this_trait[counter-1])) else: sample = webqtlCaseData.webqtlCaseData(name=sample_name) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 514c2300..2955f69a 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -185,8 +185,8 @@ class ShowTrait(object): #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]) + for i, this_chr in enumerate(self.dataset.species.chromosomes.chromosomes): + self.chr_list.append([self.dataset.species.chromosomes.chromosomes[this_chr].name, i]) self.genofiles = get_genofiles(self.dataset) diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index a4ec6ece..3f2673c1 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -116,15 +116,15 @@ "B30_K_1206_M", "Barley1 Leaf MAS 5.0 SCRI (Dec06)" ], - [ - "125", - "B30_K_1206_R", - "Barley1 Leaf gcRMA SCRI (Dec06)" - ], [ "126", "B30_K_1206_Rn", "Barley1 Leaf gcRMAn SCRI (Dec06)" + ], + [ + "125", + "B30_K_1206_R", + "Barley1 Leaf gcRMA SCRI (Dec06)" ] ], "Phenotypes": [ @@ -1346,15 +1346,15 @@ "HLC_0311", "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], - [ - "384", - "HLCF_0311", - "GSE9588 Human Liver Normal (Mar11) Females" - ], [ "383", "HLCM_0311", "GSE9588 Human Liver Normal (Mar11) Males" + ], + [ + "384", + "HLCF_0311", + "GSE9588 Human Liver Normal (Mar11) Females" ] ], "Phenotypes": [ @@ -1607,15 +1607,15 @@ "NCI_Agil_Mam_Tum_RMA_0409", "NCI Mammary LMT miRNA v2 (Apr09) RMA" ], - [ - "36", - "MA_M_0704_M", - "NCI Mammary mRNA M430 (July04) MAS5" - ], [ "37", "MA_M_0704_R", "NCI Mammary mRNA M430 (July04) RMA" + ], + [ + "36", + "MA_M_0704_M", + "NCI Mammary mRNA M430 (July04) MAS5" ] ] }, @@ -1682,15 +1682,15 @@ ] ], "Liver mRNA": [ - [ - "38", - "LVF2_M_0704_M", - "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" - ], [ "39", "LVF2_M_0704_R", "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" + ], + [ + "38", + "LVF2_M_0704_M", + "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" ] ], "Phenotypes": [ @@ -1712,6 +1712,11 @@ }, "B6D2F2": { "Brain mRNA": [ + [ + "77", + "BRF2_M_0805_R", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" + ], [ "76", "BRF2_M_0805_M", @@ -1722,25 +1727,20 @@ "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", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN" ], - [ - "31", - "BRF2_M_0304_M", - "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" - ], [ "32", "BRF2_M_0304_R", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" + ], + [ + "31", + "BRF2_M_0304_M", + "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" ] ], "Genotypes": [ @@ -1818,6 +1818,11 @@ ] ], "Striatum mRNA": [ + [ + "84", + "SA_M2_0905_R", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" + ], [ "83", "SA_M2_0905_M", @@ -1827,26 +1832,21 @@ "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": [ - [ - "197", - "UCLA_BHF2_ADIPOSE_FEMALE", - "UCLA BHF2 Adipose Female mlratio" - ], [ "196", "UCLA_BHF2_ADIPOSE_MALE", "UCLA BHF2 Adipose Male mlratio" ], + [ + "197", + "UCLA_BHF2_ADIPOSE_FEMALE", + "UCLA BHF2 Adipose Female mlratio" + ], [ "165", "UCLA_BHF2_ADIPOSE_0605", @@ -1854,16 +1854,16 @@ ] ], "Brain mRNA": [ - [ - "199", - "UCLA_BHF2_BRAIN_FEMALE", - "UCLA BHF2 Brain Female mlratio" - ], [ "198", "UCLA_BHF2_BRAIN_MALE", "UCLA BHF2 Brain Male mlratio" ], + [ + "199", + "UCLA_BHF2_BRAIN_FEMALE", + "UCLA BHF2 Brain Female mlratio" + ], [ "166", "UCLA_BHF2_BRAIN_0605", @@ -1878,16 +1878,16 @@ ] ], "Liver mRNA": [ - [ - "201", - "UCLA_BHF2_LIVER_FEMALE", - "UCLA BHF2 Liver Female mlratio" - ], [ "200", "UCLA_BHF2_LIVER_MALE", "UCLA BHF2 Liver Male mlratio" ], + [ + "201", + "UCLA_BHF2_LIVER_FEMALE", + "UCLA BHF2 Liver Female mlratio" + ], [ "167", "UCLA_BHF2_LIVER_0605", @@ -2106,21 +2106,26 @@ "IBR_M_0606_R", "INIA Brain mRNA M430 (Jun06) RMA" ], - [ - "101", - "IBR_M_0106_P", - "INIA Brain mRNA M430 (Jan06) PDNN" - ], [ "102", "IBR_M_0106_R", "INIA Brain mRNA M430 (Jan06) RMA" ], + [ + "101", + "IBR_M_0106_P", + "INIA Brain mRNA M430 (Jan06) PDNN" + ], [ "95", "BR_U_1105_P", "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], + [ + "80", + "BR_U_0805_M", + "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" + ], [ "82", "BR_U_0805_R", @@ -2131,11 +2136,6 @@ "BR_U_0805_P", "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" ], - [ - "80", - "BR_U_0805_M", - "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" - ], [ "42", "CB_M_0204_P", @@ -2232,6 +2232,11 @@ "Eye_M2_0908_R_ND", "Eye M430v2 WT Gpnmb (Sep08) RMA" ], + [ + "279", + "Eye_M2_0908_R_WT", + "Eye M430v2 WT Tyrp1 (Sep08) RMA" + ], [ "278", "Eye_M2_0908_R_MT", @@ -2242,11 +2247,6 @@ "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": [ - [ - "240", - "MA_M2M_0706_R", - "Mouse kidney M430v2 Male (Aug06) RMA" - ], [ "239", "MA_M2F_0706_R", "Mouse kidney M430v2 Female (Aug06) RMA" ], + [ + "240", + "MA_M2M_0706_R", + "Mouse kidney M430v2 Male (Aug06) RMA" + ], [ "118", "MA_M2_0806_R", @@ -2550,18 +2550,23 @@ "MA_M2_0806_P", "Mouse Kidney M430v2 Sex Balanced (Aug06) PDNN" ], - [ - "115", - "MA_M2_0706_R", - "Mouse Kidney M430v2 (Jul06) RMA" - ], [ "116", "MA_M2_0706_P", "Mouse Kidney M430v2 (Jul06) PDNN" + ], + [ + "115", + "MA_M2_0706_R", + "Mouse Kidney M430v2 (Jul06) RMA" ] ], "Liver Metabolome": [ + [ + "836", + "UTHSC-ETHZ-EPFL_LivPMetExtAHFD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction A, HFD Cohorts (Mar 2017) log2" + ], [ "838", "UTHSC-ETHZ-EPFL_LivPMetExtBHFD0817", @@ -2577,11 +2582,6 @@ "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", @@ -2691,11 +2691,6 @@ "EPFLMouseLiverHFDRMA0413", "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], - [ - "849", - "EPFLMouseLiverCDEx0413", - "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], [ "848", "EPFLMouseLiverHFCEx0413", @@ -2706,6 +2701,11 @@ "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" + ], [ "433", "EPFLMouseLiverBothExRMA0413", @@ -2834,16 +2834,16 @@ ] ], "Neocortex mRNA": [ - [ - "374", - "DevNeocortex_ILM6.2P3RInv_1111", - "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" - ], [ "375", "DevNeocortex_ILM6.2P14RInv_1111", "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" ], + [ + "374", + "DevNeocortex_ILM6.2P3RInv_1111", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" + ], [ "284", "HQFNeoc_1210v2_RankInv", @@ -2859,15 +2859,15 @@ "HQFNeoc_0208_RankInv", "HQF BXD Neocortex ILM6v1.1 (Feb08) 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" + ], + [ + "275", + "DevNeocortex_ILM6.2P14RInv_1110", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -3094,6 +3094,11 @@ ] ], "Ventral Tegmental Area mRNA": [ + [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" + ], [ "228", "VCUSal_0609_R", @@ -3103,11 +3108,6 @@ "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" ] ] }, @@ -3440,15 +3440,15 @@ ] ], "Hippocampus mRNA": [ - [ - "99", - "HC_M2CB_1205_P", - "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" - ], [ "100", "HC_M2CB_1205_R", "Hippocampus Consortium M430v2 CXB (Dec05) RMA" + ], + [ + "99", + "HC_M2CB_1205_P", + "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" ] ], "Liver mRNA": [ @@ -3474,6 +3474,13 @@ ] }, "D2GM": { + "Phenotypes": [ + [ + "None", + "D2GMPublish", + "D2GM Phenotypes" + ] + ], "Retina mRNA": [ [ "847", @@ -3531,6 +3538,16 @@ ] ], "Hippocampus mRNA": [ + [ + "213", + "Illum_LXS_Hipp_NOS_1008", + "Hippocampus Illumina NOS (Oct08) RankInv beta" + ], + [ + "219", + "Illum_LXS_Hipp_NON_1008", + "Hippocampus Illumina NON (Oct08) RankInv beta" + ], [ "212", "Illum_LXS_Hipp_RSE_1008", @@ -3546,16 +3563,6 @@ "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", - "Hippocampus Illumina NON (Oct08) RankInv beta" - ], [ "143", "Illum_LXS_Hipp_loess0807", @@ -3646,15 +3653,15 @@ ] ], "Hippocampus mRNA": [ - [ - "272", - "HC_M2_0606_MDP", - "Hippocampus Consortium M430v2 (Jun06) RMA MDP" - ], [ "273", "UMUTAffyExon_0209_RMA_MDP", "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" + ], + [ + "272", + "HC_M2_0606_MDP", + "Hippocampus Consortium M430v2 (Jun06) RMA MDP" ] ], "Liver mRNA": [ @@ -3716,6 +3723,13 @@ ] }, "Retina-RGC-Rheaume": { + "Phenotypes": [ + [ + "None", + "Retina-RGC-RheaumePublish", + "Retina-RGC-Rheaume Phenotypes" + ] + ], "Retina Single-cell RNA-Seq": [ [ "865", @@ -5470,6 +5484,10 @@ ] ], "D2GM": [ + [ + "Phenotypes", + "Phenotypes" + ], [ "Retina mRNA", "Retina mRNA" @@ -5569,6 +5587,10 @@ ] ], "Retina-RGC-Rheaume": [ + [ + "Phenotypes", + "Phenotypes" + ], [ "Retina Single-cell RNA-Seq", "Retina Single-cell RNA-Seq" diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 2b878087..abcdf7e6 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -93,12 +93,24 @@ $(function() { traits = $("#trait_table input:checked").map(function() { return $(this).val(); }).get(); - console.log("checked length is:", traits.length); - console.log("checked is:", traits); + + var traits_hash = md5(traits.toString()); + + $.ajax({ + type: "POST", + url: "/collections/store_trait_list", + data: { + hash: traits_hash, + traits: traits.toString() + } + }); + return $.colorbox({ - href: "/collections/add?traits=" + traits + href: "/collections/add?hash=" + traits_hash }); + }; + removed_traits = function() { console.log('in removed_traits with checked_traits:', checked_traits); return checked_traits.closest("tr").fadeOut(); diff --git a/wqflask/wqflask/static/new/js_external/md5.min.js b/wqflask/wqflask/static/new/js_external/md5.min.js new file mode 100644 index 00000000..7d8a3f53 --- /dev/null +++ b/wqflask/wqflask/static/new/js_external/md5.min.js @@ -0,0 +1,2 @@ +!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t>5]|=(255&n.charCodeAt(t/8))<16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this); +//# sourceMappingURL=md5.min.js.map \ No newline at end of file diff --git a/wqflask/wqflask/templates/bnw_page.html b/wqflask/wqflask/templates/bnw_page.html new file mode 100644 index 00000000..e506d8a8 --- /dev/null +++ b/wqflask/wqflask/templates/bnw_page.html @@ -0,0 +1,7 @@ +Opening BNW +
+ +
+ \ No newline at end of file diff --git a/wqflask/wqflask/templates/collections/add.html b/wqflask/wqflask/templates/collections/add.html index 889687ea..37cabdbd 100644 --- a/wqflask/wqflask/templates/collections/add.html +++ b/wqflask/wqflask/templates/collections/add.html @@ -6,7 +6,11 @@