From 909a1cca82d86f824c6778b59b2ee339a7ee8ffd Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 13 Sep 2016 16:13:13 +0000 Subject: Fixed the path for the json file in gen_select_dataset.py since it was wrong and uncommented simplejson import Added "Reset" option to network graph that returns all the nodes/edges Made the visualization options area in the network graph a little wider --- wqflask/maintenance/gen_select_dataset.py | 4 +- wqflask/wqflask/network_graph/network_graph.py | 9 +- wqflask/wqflask/static/new/css/network_graph.css | 2 +- .../new/javascript/dataset_menu_structure.json | 178 ++++++++++++--------- .../wqflask/static/new/javascript/network_graph.js | 11 +- wqflask/wqflask/templates/network_graph.html | 7 +- 6 files changed, 128 insertions(+), 83 deletions(-) (limited to 'wqflask') diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 23adc4f9..542c0d83 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -49,7 +49,7 @@ from utility.tools import locate, locate_ignore_error, TEMPDIR, SQL_URI import MySQLdb -# import simplejson as json +import simplejson as json import urlparse @@ -289,7 +289,7 @@ def main(): #print("data:", data) - output_file = """./wqflask/wqflask/static/new/javascript/dataset_menu_structure.json""" + output_file = """./wqflask/static/new/javascript/dataset_menu_structure.json""" with open(output_file, 'w') as fh: json.dump(data, fh, indent=" ", sort_keys=True) diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index 1d725c4c..cebe5c03 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -167,9 +167,9 @@ class NetworkGraph(object): if abs(sample_r) > max_corr: max_corr = abs(sample_r) - edge_data = {'id' : this_trait.name + '_to_' + target_trait.name, - 'source' : this_trait.name + ":" + this_trait.dataset.name, - 'target' : target_trait.name + ":" + target_trait.dataset.name, + edge_data = {'id' : str(this_trait.name) + '_to_' + str(target_trait.name), + 'source' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'target' : str(target_trait.name) + ":" + str(target_trait.dataset.name), 'correlation' : round(sample_r, 3), 'abs_corr' : abs(round(sample_r, 3)), 'p_value' : round(sample_p, 3), @@ -181,8 +181,9 @@ class NetworkGraph(object): self.edges_list.append(edge_dict) - node_dict = { 'data' : {'id' : this_trait.name + ":" + this_trait.dataset.name, + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), 'label' : this_trait.name, + 'symbol' : this_trait.symbol, 'geneid' : this_trait.geneid, 'omim' : this_trait.omim, 'max_corr' : max_corr } } diff --git a/wqflask/wqflask/static/new/css/network_graph.css b/wqflask/wqflask/static/new/css/network_graph.css index c01c0d24..1cba546a 100644 --- a/wqflask/wqflask/static/new/css/network_graph.css +++ b/wqflask/wqflask/static/new/css/network_graph.css @@ -13,7 +13,7 @@ #secondaryContent { position: relative; float: left; - width: 16.5em; + width: 18.5em; padding: 1em 1em 1em 1em; background: #fff url('/static/new/images/a1.gif') top right repeat-y; } diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 750a9118..d3db1853 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -317,6 +317,30 @@ ] }, "GTEx": { + "Adipose tissue, subcutaneous mRNA": [ + [ + "580", + "GTEx_log2_Subcu_0314", + "GTEx Human Subcutaneous (Mar14) RPKM Log2" + ], + [ + "530", + "GTEx_Subcu_0414", + "GTEx Human Subcutaneous (Apr14) RPKM" + ] + ], + "Adipose tissue, visceral mRNA": [ + [ + "587", + "GTEx_log2_Visce_0314", + "GTEx Human Visceral (Mar14) RPKM Log2" + ], + [ + "537", + "GTEx_Visce_0414", + "GTEx Human Visceral (Apr14) RPKM" + ] + ], "Adrenal Gland mRNA": [ [ "545", @@ -773,18 +797,6 @@ "GTEx Human Stomach (Apr14) RPKM" ] ], - "Subcutaneous mRNA": [ - [ - "580", - "GTEx_log2_Subcu_0314", - "GTEx Human Subcutaneous (Mar14) RPKM Log2" - ], - [ - "530", - "GTEx_Subcu_0414", - "GTEx Human Subcutaneous (Apr14) RPKM" - ] - ], "Substantia Nigra mRNA": [ [ "581", @@ -857,18 +869,6 @@ "GTEx Human Vagina (Apr14) RPKM" ] ], - "Visceral mRNA": [ - [ - "587", - "GTEx_log2_Visce_0314", - "GTEx Human Visceral (Mar14) RPKM Log2" - ], - [ - "537", - "GTEx_Visce_0414", - "GTEx Human Visceral (Apr14) RPKM" - ] - ], "Whole Blood mRNA": [ [ "588", @@ -883,6 +883,20 @@ ] }, "GTEx_v5": { + "Adipose tissue, subcutaneous mRNA": [ + [ + "718", + "GTEXv5_AdipSub_0915", + "GTEXv5 Human Adipose Subcutaneous RefSeq (Sep15) RPKM log2" + ] + ], + "Adipose tissue, visceral mRNA": [ + [ + "719", + "GTEXv5_AdiVis_0915", + "GTEXv5 Human Adipose Visceral Omentum RefSeq (Sep15) RPKM log2" + ] + ], "Adrenal Gland mRNA": [ [ "720", @@ -1191,13 +1205,6 @@ "GTEXv5 Human Stomach RefSeq (Sep15) RPKM log2" ] ], - "Subcutaneous mRNA": [ - [ - "718", - "GTEXv5_AdipSub_0915", - "GTEXv5 Human Adipose Subcutaneous RefSeq (Sep15) RPKM log2" - ] - ], "Substantia Nigra mRNA": [ [ "737", @@ -1240,13 +1247,6 @@ "GTEXv5 Human Vagina RefSeq (Sep15) RPKM log2" ] ], - "Visceral mRNA": [ - [ - "719", - "GTEXv5_AdiVis_0915", - "GTEXv5 Human Adipose Visceral Omentum RefSeq (Sep15) RPKM log2" - ] - ], "Whole Blood mRNA": [ [ "770", @@ -1609,8 +1609,29 @@ ] ] }, + "B6D2": { + "Phenotypes": [ + [ + "None", + "B6D2Publish", + "B6D2 Published Phenotypes" + ] + ], + "Retina mRNA": [ + [ + "803", + "UTHSC_mm9_B6D2_Ret_0916", + "UTHSC B6D2 Retina Affy MoGene 1.0ST (Sep16) Gene Level RMA" + ] + ] + }, "B6D2F2": { "Brain mRNA": [ + [ + "78", + "BRF2_M_0805_P", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" + ], [ "77", "BRF2_M_0805_R", @@ -1621,11 +1642,6 @@ "BRF2_M_0805_M", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" ], - [ - "78", - "BRF2_M_0805_P", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" - ], [ "33", "BRF2_M_0304_P", @@ -2305,16 +2321,16 @@ ] ], "Kidney mRNA": [ - [ - "239", - "MA_M2F_0706_R", - "Mouse kidney M430v2 Female (Aug06) RMA" - ], [ "240", "MA_M2M_0706_R", "Mouse kidney M430v2 Male (Aug06) RMA" ], + [ + "239", + "MA_M2F_0706_R", + "Mouse kidney M430v2 Female (Aug06) RMA" + ], [ "118", "MA_M2_0806_R", @@ -2494,16 +2510,16 @@ ] ], "Neocortex mRNA": [ - [ - "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" ], + [ + "375", + "DevNeocortex_ILM6.2P14RInv_1111", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" + ], [ "284", "HQFNeoc_1210v2_RankInv", @@ -3016,6 +3032,11 @@ ] ], "Hippocampus mRNA": [ + [ + "214", + "Illum_LXS_Hipp_NOE_1008", + "Hippocampus Illumina NOE (Oct08) RankInv beta" + ], [ "211", "Illum_LXS_Hipp_RSS_1008", @@ -3036,11 +3057,6 @@ "Illum_LXS_Hipp_RSE_1008", "Hippocampus Illumina RSE (Oct08) RankInv beta" ], - [ - "214", - "Illum_LXS_Hipp_NOE_1008", - "Hippocampus Illumina NOE (Oct08) RankInv beta" - ], [ "143", "Illum_LXS_Hipp_loess0807", @@ -3471,6 +3487,10 @@ "B6BTBRF2", "B6BTBRF2" ], + [ + "B6D2", + "Glaucoma and Aged Retina, UTHSC" + ], [ "B6D2F2", "B6D2F2" @@ -3792,6 +3812,14 @@ ] ], "GTEx": [ + [ + "Adipose tissue, subcutaneous mRNA", + "Adipose tissue, subcutaneous mRNA" + ], + [ + "Adipose tissue, visceral mRNA", + "Adipose tissue, visceral mRNA" + ], [ "Adrenal Gland mRNA", "Adrenal Gland mRNA" @@ -3944,10 +3972,6 @@ "Stomach mRNA", "Stomach mRNA" ], - [ - "Subcutaneous mRNA", - "Subcutaneous mRNA" - ], [ "Substantia Nigra mRNA", "Substantia Nigra mRNA" @@ -3972,16 +3996,20 @@ "Vagina mRNA", "Vagina mRNA" ], - [ - "Visceral mRNA", - "Visceral mRNA" - ], [ "Whole Blood mRNA", "Whole Blood mRNA" ] ], "GTEx_v5": [ + [ + "Adipose tissue, subcutaneous mRNA", + "Adipose tissue, subcutaneous mRNA" + ], + [ + "Adipose tissue, visceral mRNA", + "Adipose tissue, visceral mRNA" + ], [ "Adrenal Gland mRNA", "Adrenal Gland mRNA" @@ -4158,10 +4186,6 @@ "Stomach mRNA", "Stomach mRNA" ], - [ - "Subcutaneous mRNA", - "Subcutaneous mRNA" - ], [ "Substantia Nigra mRNA", "Substantia Nigra mRNA" @@ -4186,10 +4210,6 @@ "Vagina mRNA", "Vagina mRNA" ], - [ - "Visceral mRNA", - "Visceral mRNA" - ], [ "Whole Blood mRNA", "Whole Blood mRNA" @@ -4363,6 +4383,16 @@ "Liver mRNA" ] ], + "B6D2": [ + [ + "Phenotypes", + "Phenotypes" + ], + [ + "Retina mRNA", + "Retina mRNA" + ] + ], "B6D2F2": [ [ "Genotypes", diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index da90ae26..e8ca6be0 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -12,7 +12,7 @@ window.onload=function() { selector: 'node', style: { 'background-color': '#666', - 'label': 'data(id)', + 'label': 'data(symbol)', 'font-size': 10 } }, @@ -154,6 +154,15 @@ window.onload=function() { }); + $('#reset_graph').click(function() { + eles.restore() + $('#slide').val(0) + cy.layout({ name: $('select[name=layout_select]').val(), + fit: true, // whether to fit the viewport to the graph + padding: 25 // the padding on fit + }); + }); + $('select[name=focus_select]').change(function() { focus_trait = $(this).val() diff --git a/wqflask/wqflask/templates/network_graph.html b/wqflask/wqflask/templates/network_graph.html index ec3a7971..57426af7 100644 --- a/wqflask/wqflask/templates/network_graph.html +++ b/wqflask/wqflask/templates/network_graph.html @@ -20,6 +20,11 @@
+ + | +|
Focus Trait @@ -29,7 +34,7 @@ | -- cgit v1.2.3 |