diff js/load_clustergramIPG.js @ 0:fee56ee2f7ac draft

"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/clustergrammer_flow commit b11dfcf10d287c1da91ffb1d5d0148c7f8f61356"
author azomics
date Fri, 31 Jul 2020 19:06:45 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/load_clustergramIPG.js	Fri Jul 31 19:06:45 2020 -0400
@@ -0,0 +1,100 @@
+/*
+Example files
+*/
+
+//var hzome = ini_hzome();
+
+make_clust('mult_view.json');
+
+var about_string = 'Zoom, scroll, and click buttons to interact with the clustergram. <a href="http://amp.pharm.mssm.edu/clustergrammer/help"> <i class="fa fa-question-circle" aria-hidden="true"></i> </a>';
+
+function make_clust(inst_network){
+
+    d3.json(inst_network, function(network_data){
+
+      // define arguments object
+      var args = {
+        root: '#container-id-1',
+        'network_data': network_data,
+        'about':about_string,
+        'row_tip_callback':test_row_callback,
+        'col_tip_callback':test_col_callback,
+        'tile_tip_callback':test_tile_callback,
+        'dendro_callback':dendro_callback,
+        //'matrix_update_callback':matrix_update_callback,
+        'cat_update_callback': cat_update_callback,
+        'sidebar_width':150,
+        'tile_colors':['#FFFB00','#00A2BF'],
+        'bar_colors':['#FFFB00','#00A2BF'],
+        'row_label': "Population / Cluster",
+        'col_label': ""
+        // 'ini_view':{'N_row_var':20}
+        // 'ini_expand':true
+      };
+
+      resize_container(args);
+
+      d3.select(window).on('resize',function(){
+        resize_container(args);
+        cgm.resize_viz();
+      });
+
+      cgm = Clustergrammer(args);
+
+      //check_setup_enrichr(cgm);
+
+      d3.select(cgm.params.root + ' .wait_message').remove();
+
+  });
+
+}
+
+/*function matrix_update_callback(){
+
+  if (genes_were_found[this.root]){
+    enr_obj[this.root].clear_enrichr_results(false);
+  }
+}
+*/
+function cat_update_callback(){
+  console.log('callback to run after cats are updated');
+}
+
+function test_tile_callback(tile_data){
+  var row_name = tile_data.row_name;
+  var col_name = tile_data.col_name;
+
+}
+
+function test_col_callback(col_data){
+  var col_name = col_data.name;
+}
+function test_row_callback(col_data){
+  var col_name = col_data.name;
+}
+
+function dendro_callback(inst_selection){
+
+  var inst_rc;
+  var inst_data = inst_selection.__data__;
+
+  // toggle enrichr export section
+  if (inst_data.inst_rc === 'row'){
+    d3.select('.enrichr_export_section')
+      .style('display', 'block');
+  } else {
+    d3.select('.enrichr_export_section')
+      .style('display', 'none');
+  }
+
+}
+
+function resize_container(args){
+
+  var screen_width = window.innerWidth;
+  var screen_height = window.innerHeight - 20;
+
+  d3.select(args.root)
+    .style('width', screen_width+'px')
+    .style('height', screen_height+'px');
+}