From 5813a1a3006dc67278eb094513c455b9cb2fa91f Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 4 Dec 2017 17:50:14 +0000 Subject: Fixed drop-down scripts to more appropriately deal with BXD300 groups (though there's still a minor issue with a few datasets) Added some header data to mapping output file Fixed links in Network Group nodes/edges --- wqflask/maintenance/gen_select_dataset.py | 5 +- .../wqflask/marker_regression/marker_regression.py | 26 +++--- .../new/javascript/dataset_menu_structure.json | 96 ++++++++++++++++++++++ .../new/javascript/dataset_select_menu_orig.js | 5 ++ .../wqflask/static/new/javascript/network_graph.js | 11 +-- 5 files changed, 122 insertions(+), 21 deletions(-) diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 6553f090..1123f997 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -96,13 +96,14 @@ def get_groups(species): Cursor.execute("""select InbredSet.Name, InbredSet.FullName from InbredSet, Species, ProbeFreeze, GenoFreeze, PublishFreeze where Species.Name = '%s' - and InbredSet.SpeciesId = Species.Id and InbredSet.Name != 'BXD300' and + and InbredSet.SpeciesId = Species.Id and (PublishFreeze.InbredSetId = InbredSet.Id or GenoFreeze.InbredSetId = InbredSet.Id or ProbeFreeze.InbredSetId = InbredSet.Id) group by InbredSet.Name order by InbredSet.Name""" % species_name) - groups[species_name] = list(Cursor.fetchall()) + results = Cursor.fetchall() + groups[species_name] = list(results) return groups diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 9e01be3e..bcb14451 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -277,7 +277,7 @@ class MarkerRegression(object): if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()): self.qtl_results.append(marker) - export_mapping_results(self.qtl_results, self.mapping_results_path, self.mapping_scale, self.score_type) + export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path, self.mapping_scale, self.score_type) self.trimmed_markers = trim_markers_for_table(results) @@ -608,29 +608,35 @@ def create_snp_iterator_file(group): with gzip.open(snp_file_base, "wb") as fh: pickle.dump(data, fh, pickle.HIGHEST_PROTOCOL) -def export_mapping_results(markers, results_path, mapping_scale, score_type): +def export_mapping_results(dataset, trait, markers, results_path, mapping_scale, score_type): with open(results_path, "w+") as output_file: - output_file.write("Name\tChr\t") + output_file.write("Population: " + dataset.group.species.title() + " " + dataset.group.name + "\n") + output_file.write("Data Set: " + dataset.fullname + "\n") + if dataset.type == "ProbeSet": + output_file.write("Gene Symbol: " + trait.symbol + "\n") + output_file.write("Location: " + str(trait.chr) + " @ " + str(trait.mb) + " Mb\n") + output_file.write("\n") + output_file.write("Name,Chr,") if mapping_scale == "physic": - output_file.write("Mb\t" + score_type) + output_file.write("Mb," + score_type) else: - output_file.write("Cm\t" + score_type) + output_file.write("Cm," + score_type) if "additive" in markers[0].keys(): - output_file.write("\tAdditive") + output_file.write(",Additive") if "dominance" in markers[0].keys(): - output_file.write("\tDominance") + output_file.write(",Dominance") output_file.write("\n") for i, marker in enumerate(markers): logger.debug("THE MARKER:", marker) - output_file.write(marker['name'] + "\t" + str(marker['chr']) + "\t" + str(marker['Mb']) + "\t") + output_file.write(marker['name'] + "," + str(marker['chr']) + "," + str(marker['Mb']) + ",") if "lod_score" in marker.keys(): output_file.write(str(marker['lod_score'])) else: output_file.write(str(marker['lrs_value'])) if "additive" in marker.keys(): - output_file.write("\t" + str(marker['additive'])) + output_file.write("," + str(marker['additive'])) if "dominance" in marker.keys(): - output_file.write("\t" + str(marker['dominance'])) + output_file.write("," + str(marker['dominance'])) if i < (len(markers) - 1): output_file.write("\n") diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 75767f47..8bdd91db 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -2020,6 +2020,21 @@ "BR_M2_1106_R", "UCHSC BXD Whole Brain M430 2.0 (Nov06) RMA" ], + [ + "113", + "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" + ], [ "95", "BR_U_1105_P", @@ -2064,6 +2079,36 @@ ] ], "Cerebellum mRNA": [ + [ + "72", + "GCB_M2_0505_R", + "GE-NIAAA Cerebellum mRNA M430v2 (May05) RMA" + ], + [ + "73", + "GCB_M2_0505_P", + "GE-NIAAA Cerebellum mRNA M430v2 (May05) PDNN" + ], + [ + "71", + "GCB_M2_0505_M", + "GE-NIAAA Cerebellum mRNA M430v2 (May05) MAS5" + ], + [ + "56", + "CB_M_0305_R", + "SJUT Cerebellum mRNA M430 (Mar05) RMA" + ], + [ + "55", + "CB_M_0305_P", + "SJUT Cerebellum mRNA M430 (Mar05) PDNN" + ], + [ + "54", + "CB_M_0305_M", + "SJUT Cerebellum mRNA M430 (Mar05) MAS5" + ], [ "46", "CB_M_1004_R", @@ -2909,6 +2954,39 @@ ] ] }, + "BXD300": { + "Genotypes": [ + [ + "None", + "BXD300Geno", + "BXD300 Genotypes" + ] + ], + "Liver mRNA": [ + [ + "105", + "LV_G_0106_B", + "UNC Agilent G4121A Liver LOWESS Stanford (Jan06) Both Sexes" + ], + [ + "103", + "LV_G_0106_M", + "UNC Agilent G4121A Liver LOWESS Stanford (Jan06) Males" + ], + [ + "104", + "LV_G_0106_F", + "UNC Agilent G4121A Liver LOWESS Stanford (Jan06) Females" + ] + ], + "Phenotypes": [ + [ + "None", + "BXD300Publish", + "BXD300 Published Phenotypes" + ] + ] + }, "BXH": { "Bone Femur mRNA": [ [ @@ -3765,6 +3843,10 @@ "BXD-Bone", "BXD Bone" ], + [ + "BXD300", + "BXD300" + ], [ "BXH", "BXH" @@ -4905,6 +4987,20 @@ "Phenotypes" ] ], + "BXD300": [ + [ + "Phenotypes", + "Phenotypes" + ], + [ + "Genotypes", + "Genotypes" + ], + [ + "Liver mRNA", + "Liver mRNA" + ] + ], "BXH": [ [ "Phenotypes", diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js index fd96eb78..d5ce6f84 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -24,6 +24,11 @@ $(function() { console.log("in populate group"); species = $('#species').val(); group_list = this.jdata.groups[species]; + for (_i = 0, _len = group_list.length; _i < (_len - 1); _i++) { + if (group_list[_i][0] == "BXD300"){ + group_list.splice(_i, 1) + } + } redo_dropdown($('#group'), group_list); if ($('#type').length > 0) { //This is to determine if it's the index page or the submit_trait page (which only has species and group selection and no make default option) return populate_type(); diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index 0129bcae..0ecf4743 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -82,7 +82,7 @@ window.onload=function() { cy.nodes().qtip({ content: function(){ qtip_content = '' - gn_link = ''+''+this.data().id +''+'
' + gn_link = ''+''+this.data().id +''+'
' qtip_content += gn_link if (typeof(this.data().geneid) !== 'undefined'){ ncbi_link = 'NCBI'+'
' @@ -92,15 +92,8 @@ window.onload=function() { omim_link = '
OMIM'+'
' qtip_content += omim_link } - //qtip_content = gn_link + ncbi_link + omim_link return qtip_content - //return ''+'
'+this.data().id +''+'' }, - // content: { - // title: ''+''+this.target() +''+'', - // text: this.target, - // button: true - // }, position: { my: 'top center', at: 'bottom center' @@ -119,7 +112,7 @@ window.onload=function() { correlation_line = 'Sample r: ' + this.data().correlation + '
' p_value_line = 'Sample p(r): ' + this.data().p_value + '
' overlap_line = 'Overlap: ' + this.data().overlap + '
' - scatter_plot = '
View Scatterplot' + scatter_plot = 'View Scatterplot' return correlation_line + p_value_line + overlap_line + scatter_plot }, position: { -- cgit v1.2.3