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