diff options
author | zsloan | 2018-12-21 10:48:33 -0600 |
---|---|---|
committer | zsloan | 2018-12-21 10:48:33 -0600 |
commit | ee1e49b90663be72032c8dee32748e97bc28e1e9 (patch) | |
tree | dd587941f52d7cdb293d6509f00b76102008146a | |
parent | 1671f4c7d4525f92640a8ce2c91c54b921da5f1f (diff) | |
download | genenetwork2-ee1e49b90663be72032c8dee32748e97bc28e1e9.tar.gz |
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
19 files changed, 348 insertions, 179 deletions
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 --- /dev/null +++ b/wqflask/wqflask/external_tools/__init__.py 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 @@ -117,14 +117,14 @@ "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": [ @@ -1347,14 +1347,14 @@ "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": [ @@ -1608,14 +1608,14 @@ "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" ] ] }, @@ -1683,14 +1683,14 @@ ], "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": [ @@ -1713,6 +1713,11 @@ "B6D2F2": { "Brain mRNA": [ [ + "77", + "BRF2_M_0805_R", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" + ], + [ "76", "BRF2_M_0805_M", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" @@ -1723,24 +1728,19 @@ "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": [ @@ -1819,6 +1819,11 @@ ], "Striatum mRNA": [ [ + "84", + "SA_M2_0905_R", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" + ], + [ "83", "SA_M2_0905_M", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" @@ -1827,27 +1832,22 @@ "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", "UCLA BHF2 Adipose (June05) mlratio" @@ -1855,16 +1855,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", "UCLA BHF2 Brain (June05) mlratio" @@ -1879,16 +1879,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", "UCLA BHF2 Liver (June05) mlratio" @@ -2107,21 +2107,26 @@ "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", "UTHSC Brain mRNA U74Av2 (Aug05) RMA" @@ -2132,11 +2137,6 @@ "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" ], [ - "80", - "BR_U_0805_M", - "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" - ], - [ "42", "CB_M_0204_P", "INIA Brain mRNA M430 (Feb04) PDNN" @@ -2233,6 +2233,11 @@ "Eye M430v2 WT Gpnmb (Sep08) RMA" ], [ + "279", + "Eye_M2_0908_R_WT", + "Eye M430v2 WT Tyrp1 (Sep08) RMA" + ], + [ "278", "Eye_M2_0908_R_MT", "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" @@ -2243,11 +2248,6 @@ "Eye M430v2 WT WT (Sep08) RMA" ], [ - "279", - "Eye_M2_0908_R_WT", - "Eye M430v2 WT Tyrp1 (Sep08) RMA" - ], - [ "400", "DBA2J-ONH-1212", "Howell et al. 2011, DBA/2J Glaucoma Optic Nerve Head M430 2.0 (Dec12) RMA" @@ -2531,16 +2531,16 @@ ], "Kidney mRNA": [ [ - "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", "Mouse kidney M430v2 Sex Balanced (Aug06) RMA" @@ -2551,18 +2551,23 @@ "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", "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction B, HFD Cohorts (Mar 2017) log2" @@ -2578,11 +2583,6 @@ "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", "EPFL/LISP BXD Liver Polar Metabolites CD+HFD (Jun14)" @@ -2692,11 +2692,6 @@ "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], [ - "849", - "EPFLMouseLiverCDEx0413", - "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], - [ "848", "EPFLMouseLiverHFCEx0413", "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" @@ -2707,6 +2702,11 @@ "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], [ + "849", + "EPFLMouseLiverCDEx0413", + "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" + ], + [ "433", "EPFLMouseLiverBothExRMA0413", "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" @@ -2835,16 +2835,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", "HQF BXD Neocortex ILM6v1.1 (Dec10v2) RankInv" @@ -2860,14 +2860,14 @@ "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": [ @@ -3095,6 +3095,11 @@ ], "Ventral Tegmental Area mRNA": [ [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" + ], + [ "228", "VCUSal_0609_R", "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" @@ -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" ] ] }, @@ -3441,14 +3441,14 @@ ], "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", @@ -3532,6 +3539,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", "Hippocampus Illumina RSE (Oct08) RankInv beta" @@ -3547,16 +3564,6 @@ "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", "Hippocampus Illumina (Aug07) LOESS" @@ -3647,14 +3654,14 @@ ], "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", @@ -5471,6 +5485,10 @@ ], "D2GM": [ [ + "Phenotypes", + "Phenotypes" + ], + [ "Retina mRNA", "Retina mRNA" ] @@ -5570,6 +5588,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<<t|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<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>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<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>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 @@ +<title>Opening BNW</title> +<form method="post" action="http://bnw.genenetwork.org/BNW/sourcecodes/bn_genenet.php" name="bnwform" id="bnwform"> + <input type="hidden" name="My_Genenet" value="{{ form_value }}"> +</form> +<script type="text/javascript"> + document.bnwform.submit(); +</script>
\ 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 @@ </div> <div class="modal-body" style="margin-left: 20px;"> <form action="/collections/new" data-validate="parsley" id="add_form"> + {% if traits is defined %} <input type="hidden" name="traits" value="{{ traits }}" /> + {% else %} + <input type="hidden" name="hash" value="{{ hash }}" /> + {% endif %} <fieldset> <legend>1. Create a new collection</legend> <div style="margin-left: 20px;"> diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index b6ad7be8..801b58c7 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -59,6 +59,9 @@ Comparison Bar Chart </button> + <button id="send_to_bnw" class="btn btn-primary submit_special" data-url="/bnw_page" title="Bayesian Network" > + BNW + </button> <button id="delete" class="btn btn-danger submit_special" style="margin-left: 15px;" data-url="/collections/delete" title="Delete this collection" > Delete Collection @@ -138,6 +141,7 @@ {% endblock %} {% block js %} + <script type="text/javascript" src="/static/new/js_external/md5.min.js"></script> <script type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> @@ -261,6 +265,15 @@ url = $(this).data("url") return submit_special(url) }); + + $("#send_to_bnw").on("click", function() { + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + url = $(this).data("url") + return submit_special(url) + }); }); </script> diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index eaeb7e6b..7096a18b 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -122,6 +122,7 @@ {% endblock %} {% block js %} + <script language="javascript" type="text/javascript" src="/static/new/js_external/md5.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script> diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 0192bff1..96675306 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -129,11 +129,6 @@ <button type="button" class="btn btn-default" title="View SNPs and Indels">SNPs</button> </a> {% endif %} - {% if UTHSC_BLAT_URL != "" %} - <a href="{{ UTHSC_BLAT_URL }}"> - <button type="button" class="btn btn-default" title="View probes, SNPs, and RNA-seq at UTHSC">RNA-seq</button> - </a> - {% endif %} {% if show_probes == "True" %} <a href="http://genenetwork.org/webqtl/main.py?FormID=showProbeInfo&database={{ this_trait.dataset.name }}&ProbeSetID={{ this_trait.name }}&CellID={{ this_trait.cellid }}&RISet={{ dataset.group.name }}&incparentsf1=ON"> <button type="button" class="btn btn-default" title="Check sequence of probes">Probes</button> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 27e6eed1..a97679db 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -43,6 +43,7 @@ from base.data_set import DataSet # Used by YAML in marker_regression from wqflask.show_trait import show_trait from wqflask.show_trait import export_trait_data from wqflask.heatmap import heatmap +from wqflask.external_tools import send_to_bnw from wqflask.comparison_bar_chart import comparison_bar_chart from wqflask.marker_regression import run_mapping from wqflask.marker_regression import display_mapping_results @@ -466,6 +467,24 @@ def heatmap_page(): return rendered_template +@app.route("/bnw_page", methods=('POST',)) +def bnw_page(): + logger.info("In run BNW, request.form is:", pf(request.form)) + logger.info(request.url) + + start_vars = request.form + + traits = [trait.strip() for trait in start_vars['trait_list'].split(',')] + if traits[0] != "": + template_vars = send_to_bnw.SendToBNW(request.form) + + result = template_vars.__dict__ + rendered_template = render_template("bnw_page.html", **result) + else: + rendered_template = render_template("empty_collection.html", **{'tool':'BNW'}) + + return rendered_template + @app.route("/comparison_bar_chart", methods=('POST',)) def comp_bar_chart_page(): logger.info("In comp bar chart, request.form is:", pf(request.form)) |