In [1]:
from om import base, settings
from om.components import *
from om.data import *
from om.util import *

import pandas as pd
import numpy as np
import math,cobra

ome = base.Session()
#model = cobra.io.load_matlab_model('/Volumes/extra/Dropbox/om_data/models/iJO1366.mat')

ged = GeneExpressionData
dged = DifferentialGeneExpressionData
cpge = ChIPPeakGeneExpression


cobra/io/__init__.py:17 UserWarning: cobra.io.sbml requires libsbml

In [8]:
ome.query(chip_peak).all()


Out[8]:
[(330, 2, u'Nac', u'anti-myc', 11, u'Nac8myc'),
 (376, 3, u'Crp', u'anti-myc', 4, u'Crp8myc'),
 (350, 7, u'Fur', u'anti-myc', 10, u'Fur8myc'),
 (336, 1, u'RpoD', u'anti-rpod', 1, u'wt'),
 (369, 2, u'PurR', u'anti-myc', 16, u'PurR8myc'),
 (347, 3, u'Crp', u'anti-crp', 8, u'delta-crp'),
 (327, 8, u'RpoD', u'anti-rpod', 1, u'wt'),
 (368, 13, u'Cra', u'anti-myc', 14, u'Cra8myc'),
 (370, 4, u'Cra', u'anti-myc', 14, u'Cra8myc'),
 (355, 13, u'Crp', u'anti-myc', 4, u'Crp8myc'),
 (333, 2, u'Cra', u'anti-myc', 14, u'Cra8myc'),
 (358, 9, u'Nac', u'anti-myc', 11, u'Nac8myc'),
 (354, 10, u'NtrC', u'anti-myc', 12, u'NtrC8myc'),
 (329, 1, u'Crp', u'anti-crp', 1, u'wt'),
 (340, 3, u'Crp', u'anti-crp', 7, u'delAr2'),
 (338, 2, u'RpoD', u'anti-rpod', 1, u'wt'),
 (372, 9, u'RpoN', u'anti-rpon', 1, u'wt'),
 (326, 2, u'Crp', u'anti-crp', 1, u'wt'),
 (371, 2, u'Crp', u'anti-myc', 4, u'Crp8myc'),
 (357, 2, u'ArgR', u'anti-myc', 13, u'ArgR8myc'),
 (373, 3, u'Crp', u'anti-crp', 6, u'delAr1delAr2'),
 (361, 2, u'RpoS', u'anti-rpos', 1, u'wt'),
 (331, 3, u'Crp', u'anti-crp', 1, u'wt'),
 (344, 8, u'Nac', u'anti-myc', 11, u'Nac8myc'),
 (345, 2, u'RpoN', u'anti-rpon', 1, u'wt'),
 (351, 4, u'Fnr', u'anti-myc', 9, u'Fnr8myc'),
 (352, 12, u'Fnr', u'anti-myc', 9, u'Fnr8myc'),
 (342, 12, u'ArcA', u'anti-myc', 2, u'ArcA8myc'),
 (356, 2, u'RpoA', u'anti-rpoA', 1, u'wt'),
 (366, 8, u'NtrC', u'anti-myc', 12, u'NtrC8myc'),
 (349, 8, u'RpoN', u'anti-rpon', 1, u'wt'),
 (363, 9, u'RpoD', u'anti-rpod', 1, u'wt'),
 (346, 10, u'RpoN', u'anti-rpon', 1, u'wt'),
 (328, 10, u'Nac', u'anti-myc', 11, u'Nac8myc'),
 (334, 2, u'Lrp', u'anti-myc', 15, u'Lrp8myc'),
 (332, 9, u'NtrC', u'anti-myc', 12, u'NtrC8myc'),
 (337, 1, u'Crp', u'anti-myc', 4, u'Crp8myc'),
 (360, 2, u'NtrC', u'anti-myc', 12, u'NtrC8myc'),
 (335, 4, u'ArcA', u'anti-myc', 2, u'ArcA8myc'),
 (343, 10, u'RpoD', u'anti-rpod', 1, u'wt'),
 (341, 3, u'Crp', u'anti-crp', 3, u'Ar3'),
 (348, 3, u'Crp', u'anti-crp', 5, u'delAr1'),
 (374, 4, u'ArcA', u'anti-myc', 2, u'ArcA8myc'),
 (359, 6, u'Fur', u'anti-myc', 10, u'Fur8myc'),
 (339, 3, u'RpoD', u'anti-rpod', 1, u'wt'),
 (353, 4, u'Fnr', u'anti-myc', 9, u'Fnr8myc'),
 (362, 1, u'Crp', u'anti-crp', 4, u'Crp8myc'),
 (365, 3, u'Crp', u'anti-crp', 4, u'Crp8myc'),
 (364, 5, u'Crp', u'anti-crp', 1, u'wt'),
 (367, 11, u'RpoN', u'anti-rpon', 1, u'wt'),
 (375, 11, u'RpoD', u'anti-rpod', 1, u'wt')]

In [7]:
ome.query(diff_exp).all()


Out[7]:
[(382, u'delta-crp', u'wt', 1, u'fructose', u'NH4Cl', u'O2', u''),
 (398, u'delta-crp', u'wt', 2, u'glucose', u'NH4Cl', u'O2', u''),
 (390, u'delAr2', u'wt', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (392, u'delAr1', u'wt', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (393, u'delAr1delAr2', u'wt', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (394, u'Ar3', u'wt', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (396, u'delta-crp', u'wt', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (400, u'delta-fur', u'wt', 6, u'glucose', u'NH4Cl', u'O2', u'dpd'),
 (384, u'delta-fur', u'wt', 7, u'glucose', u'NH4Cl', u'O2', u'FeCl2'),
 (394, u'wt', u'Ar3', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (392, u'wt', u'delAr1', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (393, u'wt', u'delAr1delAr2', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (390, u'wt', u'delAr2', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (382, u'wt', u'delta-crp', 1, u'fructose', u'NH4Cl', u'O2', u''),
 (398, u'wt', u'delta-crp', 2, u'glucose', u'NH4Cl', u'O2', u''),
 (396, u'wt', u'delta-crp', 3, u'glycerol', u'NH4Cl', u'O2', u''),
 (400, u'wt', u'delta-fur', 6, u'glucose', u'NH4Cl', u'O2', u'dpd'),
 (384, u'wt', u'delta-fur', 7, u'glucose', u'NH4Cl', u'O2', u'FeCl2'),
 (411, u'delta-fnr', u'wt', 18, u'glucose', u'NH4Cl', u'anaerobic', u'asv2'),
 (411, u'wt', u'delta-fnr', 18, u'glucose', u'NH4Cl', u'anaerobic', u'asv2')]

In [5]:
ome.query(Arra


Out[5]:
[Differential Expression (#377): RNAseq_bw25113_acetate/fumarate_NH4Cl_O2_thiamine,
 Differential Expression (#378): RNAseq_wt_glucose_NH4Cl/cytidine_O2,
 Differential Expression (#379): RNAseq_wt_glucose_cytidine/glutamine_O2,
 Differential Expression (#380): RNAseq_wt_glucose_cytosine/glutamine_O2,
 Differential Expression (#381): RNAseq_wt_glucose_NH4Cl/glutamine_O2,
 Differential Expression (#382): RNAseq_delta-crp/wt_fructose_NH4Cl_O2,
 Differential Expression (#383): RNAseq_wt_glucose_NH4Cl_O2_supp/FeCl2,
 Differential Expression (#384): RNAseq_delta-fur/wt_glucose_NH4Cl_O2_FeCl2,
 Differential Expression (#385): RNAseq_delta-fur_glucose_NH4Cl_O2_FeCl2/dpd,
 Differential Expression (#386): RNAseq_wt_glucose_cytidine/cytosine_O2,
 Differential Expression (#387): RNAseq_wt_glucose_NH4Cl/cytosine_O2,
 Differential Expression (#388): RNAseq_bw25113_fumarate/glucose_NH4Cl_O2_thiamine,
 Differential Expression (#389): RNAseq_bw25113_acetate/glucose_NH4Cl_O2_thiamine,
 Differential Expression (#390): RNAseq_delAr2/wt_glycerol_NH4Cl_O2,
 Differential Expression (#391): RNAseq_wt_fructose/glycerol_NH4Cl_O2,
 Differential Expression (#392): RNAseq_delAr1/wt_glycerol_NH4Cl_O2,
 Differential Expression (#393): RNAseq_delAr1delAr2/wt_glycerol_NH4Cl_O2,
 Differential Expression (#394): RNAseq_Ar3/wt_glycerol_NH4Cl_O2,
 Differential Expression (#395): RNAseq_wt_glucose/glycerol_NH4Cl_O2,
 Differential Expression (#396): RNAseq_delta-crp/wt_glycerol_NH4Cl_O2,
 Differential Expression (#397): RNAseq_wt_fructose/glucose_NH4Cl_O2,
 Differential Expression (#398): RNAseq_delta-crp/wt_glucose_NH4Cl_O2,
 Differential Expression (#399): RNAseq_wt_glucose_NH4Cl_O2_FeCl2/dpd,
 Differential Expression (#400): RNAseq_delta-fur/wt_glucose_NH4Cl_O2_dpd,
 Differential Expression (#401): RNAseq_wt_glucose_NH4Cl_O2_supp/dpd,
 Differential Expression (#402): RNAseq_delta-crp_fructose/glycerol_NH4Cl_O2,
 Differential Expression (#403): RNAseq_delta-crp_glucose/glycerol_NH4Cl_O2,
 Differential Expression (#404): RNAseq_bw25113_fumarate/pyruvate_NH4Cl_O2_thiamine,
 Differential Expression (#405): RNAseq_bw25113_glucose/pyruvate_NH4Cl_O2_thiamine,
 Differential Expression (#406): RNAseq_bw25113_acetate/pyruvate_NH4Cl_O2_thiamine,
 Differential Expression (#407): RNAseq_delta-crp_fructose/glucose_NH4Cl_O2,
 Differential Expression (#408): affyexp_wt_acetate/fructose_NH4Cl_O2,
 Differential Expression (#409): affyexp_delta-purR_glucose_NH4Cl/adenine_O2,
 Differential Expression (#410): affyexp_delta-fnr_glucose_NH4Cl_O2/anaerobic,
 Differential Expression (#411): affyexp_delta-fnr/wt_glucose_NH4Cl_anaerobic,
 Differential Expression (#412): affyexp_delta-cra_glucose_NH4Cl_O2/anaerobic]

In [ ]:
from IPython.display import display
from IPython.html import widgets as W
from IPython.utils import traitlets as T

class HeatmapWidget(W.DOMWidget):
    _view_name = T.Unicode('HeatmapView', sync=True)
    heatmap_data = T.List(sync=True)
    row_labels = T.List(sync=True)
    col_labels = T.List(sync=True)
    hcrow = T.List(sync=True)
    hccol = T.List(sync=True)
    minval = T.Float(sync=True)
    maxval = T.Float(sync=True)
    html_style = T.Unicode(sync=True)

In [ ]:
%%javascript

require.config({paths: {d3: "https://mpld3.github.io/js/d3.v3.min"}});

require(["widgets/js/widget", "d3"], function(WidgetManager, d3){
    var HeatmapView = IPython.DOMWidgetView.extend({

        render: function(){
            
            this.$el.append(this.model.get("html_style"));

            this.update();
        },
        update: function(){
            var margin = { top: 75, right: 10, bottom: 150, left: 400 },
                cellSize=18,
                 // - margin.top - margin.bottom,
                  //gridSize = Math.floor(width / 24),
                legendElementWidth = cellSize*2.5,
                colorBuckets = 21,
                colors = ['#005824','#1A693B','#347B53','#4F8D6B','#699F83','#83B09B','#9EC2B3','#B8D4CB','#D2E6E3','#EDF8FB','#FFFFFF','#F1EEF6','#E6D3E1','#DBB9CD','#D19EB9','#C684A4','#BB6990','#B14F7C','#A63467','#9B1A53','#91003F'];
           
            var rowLabel = this.model.get("row_labels");
            var colLabel = this.model.get("col_labels");
            var data = this.model.get("heatmap_data");
            var hcrow = this.model.get("hcrow");
            var hccol = this.model.get("hccol");
            
            var col_number = colLabel.length,
                row_number = rowLabel.length;
            
            var width = cellSize*col_number, // - margin.left - margin.right,
                height = cellSize*row_number;
            
            var maxval = JSON.parse(this.model.get("maxval"));
            var minval = JSON.parse(this.model.get("minval"));
            
            var colorScale = d3.scale.quantile()
                               .domain([ minval , 0, maxval])
                               .range(colors);
  
            this.svg = d3.select(this.el).append("svg")
                .attr("width", width + margin.left + margin.right)
                .attr("height", height + margin.top + margin.bottom)
                .append("g")
                .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
            
            var svg = this.svg;

            var rowSortOrder=false;
            var colSortOrder=false;
            var rowLabels = svg.append("g")
                  .selectAll(".rowLabelg")
                  .data(rowLabel)
                  .enter()
                  .append("text")
                  .text(function (d) { return d; })
                  .attr("x", 0)
                  .attr("y", function (d, i) { return hcrow.indexOf(i+1) * cellSize; })
                  .style("text-anchor", "end")
                  .attr("transform", "translate(-25," + cellSize / 1.5 + ")")
                  .attr("class", function (d,i) { return "rowLabel mono r"+i;} )
                  .on("mouseover", function(d) {d3.select(this).classed("text-hover",true);})
                  .on("mouseout" , function(d) {d3.select(this).classed("text-hover",false);})
                  .on("click", function(d,i) {rowSortOrder=!rowSortOrder; sortbylabel("r",i,rowSortOrder); this.$('#order').property("selectedIndex", 4).node().focus();;});

            var colLabels = svg.append("g")
                  .selectAll(".colLabelg")
                  .data(colLabel)
                  .enter()
                  .append("text")
                  .text(function (d) { return d; })
                  .attr("x", 0)
                  .attr("y", function (d, i) { return hccol.indexOf(i+1) * cellSize; })
                  .style("text-anchor", "left")
                  .attr("transform", "translate("+cellSize/2 + ",-25) rotate (-90)")
                  .attr("class",  function (d,i) { return "colLabel mono c"+i;} )
                  .on("mouseover", function(d) {d3.select(this).classed("text-hover",true);})
                  .on("mouseout" , function(d) {d3.select(this).classed("text-hover",false);})
                  .on("click", function(d,i) {colSortOrder=!colSortOrder;  sortbylabel("c",i,colSortOrder); this.$('#order').property("selectedIndex", 4).node().focus();;});

            var heatMap = svg.append("g").attr("class","g3")
                  .selectAll(".cellg")
                  .data(data,function(d){return d.row+":"+d.col;})
                  .enter()
                  .append("rect")
                  .attr("x", function(d) { return hccol.indexOf(d.col) * cellSize; })
        .attr("y", function(d) { return hcrow.indexOf(d.row) * cellSize; })
        .attr("class", function(d){return "cell cell-border cr"+(d.row-1)+" cc"+(d.col-1);})
        .attr("width", cellSize)
        .attr("height", cellSize)
        .style("fill", function(d) { return colorScale(d.value); })
        /* .on("click", function(d) {
               var rowtext=d3.select(".r"+(d.row-1));
               if(rowtext.classed("text-selected")==false){
                   rowtext.classed("text-selected",true);
               }else{
                   rowtext.classed("text-selected",false);
               }
        })*/
        .on("mouseover", function(d){
               //highlight text
               d3.select(this).classed("cell-hover",true);
               d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row-1);});
               d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col-1);});
        
               //Update the tooltip position and value
               d3.select("#tooltip")
                 .style("left", (d3.event.pageX+10) + "px")
                 .style("top", (d3.event.pageY-10) + "px")
                 .select("#value")
                 .text(rowLabel[d.row-1]+","+colLabel[d.col-1]+"\ndata:"+d.value);  
               //Show the tooltip
               d3.select("#tooltip").classed("hidden", false);
        })
        .on("mouseout", function(){
               d3.select(this).classed("cell-hover",false);
               d3.selectAll(".rowLabel").classed("text-highlight",false);
               d3.selectAll(".colLabel").classed("text-highlight",false);
               d3.select("#tooltip").classed("hidden", true);
        })
        ;

  var legend = svg.selectAll(".legend")
      .data([-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10])
      .enter().append("g")
      .attr("class", "legend");
 
  console.log(height+(cellSize*2));
  legend.append("rect")
    .attr("x", function(d, i) { return legendElementWidth * i; })
    .attr("y", height+(cellSize*2))
    .attr("width", legendElementWidth)
    .attr("height", cellSize)
    .style("fill", function(d, i) { return colors[i]; });
 
  legend.append("text")
    .attr("class", "mono")
    .text(function(d) { return d; })
    .attr("width", legendElementWidth)
    .attr("x", function(d, i) { return legendElementWidth * i; })
    .attr("y", height + (cellSize*4));

// Change ordering of cells

  function sortbylabel(rORc,i,sortOrder){
       var t = svg.transition().duration(3000);
       var log2r=[];
       var sorted; // sorted is zero-based index
       d3.selectAll(".c"+rORc+i) 
         .filter(function(ce){
            log2r.push(ce.value);
          })
       ;
       if(rORc=="r"){ // sort log2ratio of a gene
         sorted=d3.range(col_number).sort(function(a,b){ if(sortOrder){ return log2r[b]-log2r[a];}else{ return log2r[a]-log2r[b];}});
         t.selectAll(".cell")
           .attr("x", function(d) { return sorted.indexOf(d.col-1) * cellSize; })
           ;
         t.selectAll(".colLabel")
          .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; })
         ;
       }else{ // sort log2ratio of a contrast
         sorted=d3.range(row_number).sort(function(a,b){if(sortOrder){ return log2r[b]-log2r[a];}else{ return log2r[a]-log2r[b];}});
         t.selectAll(".cell")
           .attr("y", function(d) { return sorted.indexOf(d.row-1) * cellSize; })
           ;
         t.selectAll(".rowLabel")
          .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; })
         ;
       }
  }

  //d3.select("#order").on("change",function(){
    this.$('#order').on("change",function(){
    order(this.value);
  });
  
  function order(value){
   if(value=="hclust"){
    var t = svg.transition().duration(3000);
    t.selectAll(".cell")
      .attr("x", function(d) { return hccol.indexOf(d.col) * cellSize; })
      .attr("y", function(d) { return hcrow.indexOf(d.row) * cellSize; })
      ;

    t.selectAll(".rowLabel")
      .attr("y", function (d, i) { return hcrow.indexOf(i+1) * cellSize; })
      ;

    t.selectAll(".colLabel")
      .attr("y", function (d, i) { return hccol.indexOf(i+1) * cellSize; })
      ;

   }else if (value=="probecontrast"){
    var t = svg.transition().duration(3000);
    t.selectAll(".cell")
      .attr("x", function(d) { return (d.col - 1) * cellSize; })
      .attr("y", function(d) { return (d.row - 1) * cellSize; })
      ;

    t.selectAll(".rowLabel")
      .attr("y", function (d, i) { return i * cellSize; })
      ;

    t.selectAll(".colLabel")
      .attr("y", function (d, i) { return i * cellSize; })
      ;

   }else if (value=="probe"){
    var t = svg.transition().duration(3000);
    t.selectAll(".cell")
      .attr("y", function(d) { return (d.row - 1) * cellSize; })
      ;

    t.selectAll(".rowLabel")
      .attr("y", function (d, i) { return i * cellSize; })
      ;
   }else if (value=="contrast"){
    var t = svg.transition().duration(3000);
    t.selectAll(".cell")
      .attr("x", function(d) { return (d.col - 1) * cellSize; })
      ;
    t.selectAll(".colLabel")
      .attr("y", function (d, i) { return i * cellSize; })
      ;
   }
  }
  // 
  var sa=d3.select(".g3")
      .on("mousedown", function() {
          if( !d3.event.altKey) {
             d3.selectAll(".cell-selected").classed("cell-selected",false);
             d3.selectAll(".rowLabel").classed("text-selected",false);
             d3.selectAll(".colLabel").classed("text-selected",false);
          }
         var p = d3.mouse(this);
         sa.append("rect")
         .attr({
             rx      : 0,
             ry      : 0,
             class   : "selection",
             x       : p[0],
             y       : p[1],
             width   : 1,
             height  : 1
         })
      })
      .on("mousemove", function() {
         var s = sa.select("rect.selection");
      
         if(!s.empty()) {
             var p = d3.mouse(this),
                 d = {
                     x       : parseInt(s.attr("x"), 10),
                     y       : parseInt(s.attr("y"), 10),
                     width   : parseInt(s.attr("width"), 10),
                     height  : parseInt(s.attr("height"), 10)
                 },
                 move = {
                     x : p[0] - d.x,
                     y : p[1] - d.y
                 }
             ;
      
             if(move.x < 1 || (move.x*2<d.width)) {
                 d.x = p[0];
                 d.width -= move.x;
             } else {
                 d.width = move.x;       
             }
      
             if(move.y < 1 || (move.y*2<d.height)) {
                 d.y = p[1];
                 d.height -= move.y;
             } else {
                 d.height = move.y;       
             }
             s.attr(d);
      
                 // deselect all temporary selected state objects
             d3.selectAll('.cell-selection.cell-selected').classed("cell-selected", false);
             d3.selectAll(".text-selection.text-selected").classed("text-selected",false);

             d3.selectAll('.cell').filter(function(cell_d, i) {
                 if(
                     !d3.select(this).classed("cell-selected") && 
                         // inner circle inside selection frame
                     (this.x.baseVal.value)+cellSize >= d.x && (this.x.baseVal.value)<=d.x+d.width && 
                     (this.y.baseVal.value)+cellSize >= d.y && (this.y.baseVal.value)<=d.y+d.height
                 ) {
      
                     d3.select(this)
                     .classed("cell-selection", true)
                     .classed("cell-selected", true);

                     d3.select(".r"+(cell_d.row-1))
                     .classed("text-selection",true)
                     .classed("text-selected",true);

                     d3.select(".c"+(cell_d.col-1))
                     .classed("text-selection",true)
                     .classed("text-selected",true);
                 }
             });
         }
      })
      .on("mouseup", function() {
            // remove selection frame
         sa.selectAll("rect.selection").remove();
      
             // remove temporary selection marker class
         d3.selectAll('.cell-selection').classed("cell-selection", false);
         d3.selectAll(".text-selection").classed("text-selection",false);
      })
      .on("mouseout", function() {
         if(d3.event.relatedTarget.tagName=='html') {
                 // remove selection frame
             sa.selectAll("rect.selection").remove();
                 // remove temporary selection marker class
             d3.selectAll('.cell-selection').classed("cell-selection", false);
             d3.selectAll(".rowLabel").classed("text-selected",false);
             d3.selectAll(".colLabel").classed("text-selected",false);
         }
      });

            
        }
    });
    WidgetManager.register_widget_view("HeatmapView", HeatmapView);
});

In [ ]:
html_style = """
     <style>
      /* disable text selection */
      svg *::selection {
         background : transparent;
      }
     
      svg *::-moz-selection {
         background:transparent;
      } 
     
      svg *::-webkit-selection {
         background:transparent;
      }
      rect.selection {
        stroke          : #333;
        stroke-dasharray: 4px;
        stroke-opacity  : 0.5;
        fill            : transparent;
      }

      rect.cell-border {
        stroke: #eee;
        stroke-width:0.3px;   
      }

      rect.cell-selected {
        stroke: rgb(51,102,153);
        stroke-width:0.5px;   
      }

      rect.cell-hover {
        stroke: #F00;
        stroke-width:0.3px;   
      }

      text.mono {
        font-size: 10pt;
        font-family: Consolas, courier;
        fill: #aaa;
      }

      text.text-selected {
        fill: #000;
      }

      text.text-highlight {
        fill: #c00;
      }
      text.text-hover {
        fill: #00C;
      }
      #tooltip {
        position: fixed;
        width: 200px;
        height: auto;
        padding: 10px;
        background-color: white;
        -webkit-border-radius: 10px;
        -moz-border-radius: 10px;
        border-radius: 10px;
        -webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
        -moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
        box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
        pointer-events: none;
      }

      #tooltip.hidden {
        display: none;
      }

      #tooltip p {
        margin: 0;
        font-family: sans-serif;
        font-size: 12px;
        line-height: 20px;
      }
    </style>


<div id="tooltip" class="hidden">
        <p><span id="value"></p>
</div>

 
  <select id="order">
  <option value="hclust">by cluster</option>
  <option value="probecontrast">by probe name and contrast name</option>
  <option value="probe">by probe name</option>
  <option value="contrast">by contrast name</option>
  <option value="custom">by log2 ratio</option>
  </select>
  </select>
<div id="chart" style='overflow:auto; width:960px; height:auto;'></div>
"""

In [ ]:
ome.query(GeneGroup).all()

In [ ]:
def gene_heatmap(gene_list, analysis_type=GeneExpressionData, dataset_type='%', 
                                                              strain1=ome.query(Strain).all(), strain2=None,
                                                              environments1=ome.query(InVivoEnvironment).all(), environments2=None):

    
    if analysis_type == GeneExpressionData:
        genes_data = {gene: ome.query(analysis_type).\
                              filter(and_(analysis_type.gene_id == gene.id,
                                          analysis_type.dataset_type.ilike(dataset_type))).all() for gene in gene_list}
        
        row_labels = ['_'.join([x.dataset_type,x.strain,x.carbon_source,x.nitrogen_source,x.electron_acceptor]) for x in genes_data.itervalues().next()]

    elif analysis_type == DifferentialGeneExpressionData:
        genes_data = {gene: ome.query(analysis_type).\
                              filter(and_(analysis_type.gene_id == gene.id,
                                          analysis_type.strain1.in_([x.name for x in strain1]),
                                          analysis_type.strain2.in_([x.name for x in strain2]),
                                          analysis_type.environment_id_1.in_([x.id for x in environments1]),
                                          analysis_type.environment_id_2.in_([x.id for x in environments2]))).all() for gene in gene_list}
        
        row_labels = ['_'.join([x.dataset_type,x.strain1,x.carbon_source1,x.nitrogen_source1,x.electron_acceptor1]) for x in genes_data.itervalues().next()]
    
    elif analysis_type == ChIPPeakGeneExpression:
        genes_data = {gene: ome.query(analysis_type).\
                              filter(and_(analysis_type.gene_id == gene.id,
                                          analysis_type.strain1.in_([x.name for x in strain1]),
                                          analysis_type.strain2.in_([x.name for x in strain2]),
                                          analysis_type.environment_id.in_([x.id for x in environments1]))).all() for gene in gene_list}
        
        genes_data = dict((k, v) for k, v in genes_data.iteritems() if v)
        row_labels = ['_'.join([x.dataset_type,x.strain1,x.carbon_source,x.nitrogen_source,x.electron_acceptor]) for x in genes_data.itervalues().next()]

        
    col_labels = [x.name for x in genes_data.keys()]

    heatmap_data = []
    for i,gene in enumerate(genes_data):
        for j,data in enumerate(genes_data[gene]):
            if data.value <= 0: value = 1.
            elif data.value > 1e6: value = 1e6
            else: value = data.value
            heatmap_data.append({"row": j+1, "col": i+1, "value": np.log(value)})

    hcrow = range(len(row_labels))
    hccol = range(len(col_labels))
    np.random.shuffle(hcrow)
    np.random.shuffle(hccol)
    
    return hcrow,hccol,row_labels,col_labels,heatmap_data
    #return {'hcrow': hcrow, 'hccol': hccol, 'row_labels':row_labels, 
    #                                        'col_labels':col_labels, 
    #                                        'heatmap_data':heatmap_data,
    #                                        'maxval' : max([x['value'] for x in heatmap_data]),
    #                                        'minval' : min([x['value'] for x in heatmap_data])}

In [ ]:
gene_list =  ome.query(GeneGroup).filter(GeneGroup.name.ilike('Peptid%')).first().genes
    
analysis_type = GeneExpressionData
dataset_type = '%'
all_data = ome.query(analysis_type).filter(and_(analysis_type.gene_name.in_(genes_data.index),
                                              analysis_type.dataset_type.ilike(dataset_type))).all()
    
datasets = set(['_'.join([x.dataset_type,x.strain,x.carbon_source,x.nitrogen_source,x.electron_acceptor]) for x in all_data])

genes_data = pd.DataFrame(index=[g.name for g in gene_list], columns=datasets)
for x in all_data:
    genes_data.ix[x.gene_name]['_'.join([x.dataset_type,x.strain,x.carbon_source,x.nitrogen_source,x.electron_acceptor])] = x.value

heatmap_data = []
for i,g in enumerate(genes_data.index):
    for j,c in enumerate(genes_data.columns):
        heatmap_data.append({"row": j+1, "col": i+1, "value": np.log(genes_data.ix[g][c])})

In [11]:
catabolic_genes = ome.query(GeneGroup).filter(GeneGroup.name.ilike('crp_cata%')).first().genes
hcrow,hccol,row_labels,col_labels,heatmap_data = gene_heatmap(catabolic_genes, 
                                                              analysis_type=ChIPPeakGeneExpression,
                                                              strain2=ome.query(Strain).all(),
                                                              environments2=ome.query(InVivoEnvironment).all())

##x = gene_heatmap(catabolic_genes, analysis_type=ChIPPeakGeneExpression,
#                                  strain2=ome.query(Strain).all(),
#                                  environments2=ome.query(InVivoEnvironment).all())

In [12]:
heatmap_data


Out[12]:
[{'col': 1, 'row': 1, 'value': 0.49122069692578785},
 {'col': 1, 'row': 2, 'value': 0.034816799375362424},
 {'col': 1, 'row': 3, 'value': 0.60294344067060102},
 {'col': 1, 'row': 4, 'value': 0.94954367324764488},
 {'col': 1, 'row': 5, 'value': -0.39507576472420974},
 {'col': 1, 'row': 6, 'value': 0.52890912715626048},
 {'col': 2, 'row': 1, 'value': 0.0},
 {'col': 2, 'row': 2, 'value': 0.0},
 {'col': 2, 'row': 3, 'value': -1.4186935935665683},
 {'col': 2, 'row': 4, 'value': -1.4186935935665683},
 {'col': 2, 'row': 5, 'value': -0.10545274213277916},
 {'col': 2, 'row': 6, 'value': -0.10545274213277916},
 {'col': 2, 'row': 7, 'value': 0.0},
 {'col': 2, 'row': 8, 'value': 0.0},
 {'col': 2, 'row': 9, 'value': 0.0},
 {'col': 2, 'row': 10, 'value': 0.0},
 {'col': 2, 'row': 11, 'value': -1.4181318375686813},
 {'col': 3, 'row': 1, 'value': 1.851693656671092},
 {'col': 3, 'row': 2, 'value': 1.7005045557052119},
 {'col': 3, 'row': 3, 'value': 1.660153840177603},
 {'col': 3, 'row': 4, 'value': 1.2332742919115054},
 {'col': 3, 'row': 5, 'value': 1.4056949468238653},
 {'col': 3, 'row': 6, 'value': 1.3215798244925019},
 {'col': 4, 'row': 1, 'value': 0.0},
 {'col': 4, 'row': 2, 'value': 0.0},
 {'col': 4, 'row': 3, 'value': 0.0},
 {'col': 4, 'row': 4, 'value': 0.0},
 {'col': 4, 'row': 5, 'value': 0.0},
 {'col': 4, 'row': 6, 'value': 0.0},
 {'col': 4, 'row': 7, 'value': 0.0},
 {'col': 4, 'row': 8, 'value': 0.0},
 {'col': 4, 'row': 9, 'value': 0.0},
 {'col': 4, 'row': 10, 'value': 0.0},
 {'col': 4, 'row': 11, 'value': 0.0},
 {'col': 4, 'row': 12, 'value': 0.0},
 {'col': 4, 'row': 13, 'value': 0.0},
 {'col': 4, 'row': 14, 'value': 0.0},
 {'col': 4, 'row': 15, 'value': -0.84741553397713565},
 {'col': 4, 'row': 16, 'value': -0.84741553397713565},
 {'col': 4, 'row': 17, 'value': -0.84741553397713565},
 {'col': 4, 'row': 18, 'value': -0.84741553397713565},
 {'col': 4, 'row': 19, 'value': -0.84741553397713565},
 {'col': 4, 'row': 20, 'value': -0.84741553397713565},
 {'col': 4, 'row': 21, 'value': -0.84741553397713565},
 {'col': 4, 'row': 22, 'value': 0.0},
 {'col': 4, 'row': 23, 'value': 0.0},
 {'col': 4, 'row': 24, 'value': 0.0},
 {'col': 4, 'row': 25, 'value': 0.0},
 {'col': 4, 'row': 26, 'value': 0.0},
 {'col': 4, 'row': 27, 'value': 0.0},
 {'col': 4, 'row': 28, 'value': 0.0},
 {'col': 4, 'row': 29, 'value': 0.0},
 {'col': 4, 'row': 30, 'value': 0.0},
 {'col': 4, 'row': 31, 'value': 0.0},
 {'col': 4, 'row': 32, 'value': 0.0},
 {'col': 4, 'row': 33, 'value': 0.0},
 {'col': 4, 'row': 34, 'value': 0.0},
 {'col': 4, 'row': 35, 'value': 0.0},
 {'col': 4, 'row': 36, 'value': -1.1068309696926413},
 {'col': 4, 'row': 37, 'value': -1.1068309696926413},
 {'col': 5, 'row': 1, 'value': 1.7373736787014633},
 {'col': 5, 'row': 2, 'value': 1.6489220524259467},
 {'col': 5, 'row': 3, 'value': 1.5767783477938107},
 {'col': 5, 'row': 4, 'value': 1.1267947396419009},
 {'col': 5, 'row': 5, 'value': 1.3756403077120789},
 {'col': 5, 'row': 6, 'value': 1.3995288970232906},
 {'col': 6, 'row': 1, 'value': 0.0},
 {'col': 6, 'row': 2, 'value': 0.0},
 {'col': 6, 'row': 3, 'value': 0.0},
 {'col': 6, 'row': 4, 'value': 0.0},
 {'col': 6, 'row': 5, 'value': -0.52689403194505524},
 {'col': 6, 'row': 6, 'value': -0.52689403194505524},
 {'col': 6, 'row': 7, 'value': -0.52689403194505524},
 {'col': 6, 'row': 8, 'value': -0.52689403194505524},
 {'col': 6, 'row': 9, 'value': -1.2322145409459753},
 {'col': 6, 'row': 10, 'value': -1.2322145409459753},
 {'col': 6, 'row': 11, 'value': -1.2322145409459753},
 {'col': 6, 'row': 12, 'value': -1.2322145409459753},
 {'col': 6, 'row': 13, 'value': -0.95302992654284968},
 {'col': 6, 'row': 14, 'value': -0.95302992654284968},
 {'col': 6, 'row': 15, 'value': -0.95302992654284968},
 {'col': 6, 'row': 16, 'value': -0.95302992654284968},
 {'col': 7, 'row': 1, 'value': 1.9632756352648482},
 {'col': 7, 'row': 2, 'value': 1.9632756352648482},
 {'col': 7, 'row': 3, 'value': 1.9632756352648482},
 {'col': 7, 'row': 4, 'value': 1.9632756352648482},
 {'col': 7, 'row': 5, 'value': 1.9632756352648482},
 {'col': 7, 'row': 6, 'value': 1.9632756352648482},
 {'col': 7, 'row': 7, 'value': 1.5083482636269201},
 {'col': 7, 'row': 8, 'value': 1.5083482636269201},
 {'col': 7, 'row': 9, 'value': 1.5083482636269201},
 {'col': 7, 'row': 10, 'value': 1.5083482636269201},
 {'col': 7, 'row': 11, 'value': 1.5083482636269201},
 {'col': 7, 'row': 12, 'value': 1.5083482636269201},
 {'col': 7, 'row': 13, 'value': 1.834981780681324},
 {'col': 7, 'row': 14, 'value': 1.834981780681324},
 {'col': 7, 'row': 15, 'value': 1.834981780681324},
 {'col': 7, 'row': 16, 'value': 1.834981780681324},
 {'col': 7, 'row': 17, 'value': 1.834981780681324},
 {'col': 7, 'row': 18, 'value': 1.834981780681324},
 {'col': 7, 'row': 19, 'value': 2.0949469589842744},
 {'col': 7, 'row': 20, 'value': 2.0949469589842744},
 {'col': 7, 'row': 21, 'value': 2.0949469589842744},
 {'col': 7, 'row': 22, 'value': 2.0949469589842744},
 {'col': 7, 'row': 23, 'value': 2.0949469589842744},
 {'col': 7, 'row': 24, 'value': 2.0949469589842744},
 {'col': 7, 'row': 25, 'value': 1.4320083702005713},
 {'col': 7, 'row': 26, 'value': 1.4320083702005713},
 {'col': 7, 'row': 27, 'value': 1.4320083702005713},
 {'col': 7, 'row': 28, 'value': 1.4320083702005713},
 {'col': 7, 'row': 29, 'value': 1.4320083702005713},
 {'col': 7, 'row': 30, 'value': 1.4320083702005713},
 {'col': 7, 'row': 31, 'value': 1.6868229377503061},
 {'col': 7, 'row': 32, 'value': 1.6868229377503061},
 {'col': 7, 'row': 33, 'value': 1.6868229377503061},
 {'col': 8, 'row': 1, 'value': 0.0},
 {'col': 8, 'row': 2, 'value': -1.2577041560807669},
 {'col': 8, 'row': 3, 'value': 0.0},
 {'col': 9, 'row': 1, 'value': 0.0},
 {'col': 10, 'row': 1, 'value': 0.0},
 {'col': 10, 'row': 2, 'value': 0.0},
 {'col': 10, 'row': 3, 'value': 0.0},
 {'col': 10, 'row': 4, 'value': 0.0},
 {'col': 10, 'row': 5, 'value': 0.0},
 {'col': 10, 'row': 6, 'value': 0.0},
 {'col': 10, 'row': 7, 'value': 0.0},
 {'col': 10, 'row': 8, 'value': 0.0},
 {'col': 11, 'row': 1, 'value': 0.0},
 {'col': 11, 'row': 2, 'value': 0.0},
 {'col': 11, 'row': 3, 'value': 0.0},
 {'col': 11, 'row': 4, 'value': 0.0},
 {'col': 11, 'row': 5, 'value': 0.0},
 {'col': 11, 'row': 6, 'value': 0.0},
 {'col': 11, 'row': 7, 'value': 0.0},
 {'col': 11, 'row': 8, 'value': 0.0},
 {'col': 11, 'row': 9, 'value': 0.0},
 {'col': 11, 'row': 10, 'value': 0.0},
 {'col': 11, 'row': 11, 'value': 0.0},
 {'col': 11, 'row': 12, 'value': 0.0},
 {'col': 11, 'row': 13, 'value': 0.0},
 {'col': 11, 'row': 14, 'value': 0.0},
 {'col': 11, 'row': 15, 'value': 0.0},
 {'col': 11, 'row': 16, 'value': 0.0},
 {'col': 11, 'row': 17, 'value': 0.0},
 {'col': 11, 'row': 18, 'value': 0.0},
 {'col': 11, 'row': 19, 'value': 0.0},
 {'col': 11, 'row': 20, 'value': 0.0},
 {'col': 11, 'row': 21, 'value': 0.0},
 {'col': 11, 'row': 22, 'value': 0.0},
 {'col': 11, 'row': 23, 'value': 0.0},
 {'col': 11, 'row': 24, 'value': 0.0},
 {'col': 11, 'row': 25, 'value': 0.0},
 {'col': 11, 'row': 26, 'value': 0.0},
 {'col': 11, 'row': 27, 'value': 0.0},
 {'col': 11, 'row': 28, 'value': 0.0},
 {'col': 11, 'row': 29, 'value': 0.0},
 {'col': 11, 'row': 30, 'value': 0.0},
 {'col': 11, 'row': 31, 'value': 0.0},
 {'col': 11, 'row': 32, 'value': 0.0},
 {'col': 11, 'row': 33, 'value': 0.0},
 {'col': 11, 'row': 34, 'value': 0.0},
 {'col': 11, 'row': 35, 'value': 0.0},
 {'col': 11, 'row': 36, 'value': 0.0},
 {'col': 11, 'row': 37, 'value': 0.0},
 {'col': 11, 'row': 38, 'value': 0.0},
 {'col': 11, 'row': 39, 'value': 0.0},
 {'col': 11, 'row': 40, 'value': 0.0},
 {'col': 11, 'row': 41, 'value': 0.0},
 {'col': 11, 'row': 42, 'value': 0.0},
 {'col': 11, 'row': 43, 'value': 0.0},
 {'col': 12, 'row': 1, 'value': -0.011732558077035616},
 {'col': 12, 'row': 2, 'value': 0.50888173563909966},
 {'col': 12, 'row': 3, 'value': 0.17709123581436523},
 {'col': 12, 'row': 4, 'value': 0.1680958495299725},
 {'col': 12, 'row': 5, 'value': 0.48827935612844381},
 {'col': 13, 'row': 1, 'value': 0.0},
 {'col': 13, 'row': 2, 'value': 0.0},
 {'col': 13, 'row': 3, 'value': 0.0},
 {'col': 13, 'row': 4, 'value': 0.0},
 {'col': 13, 'row': 5, 'value': 0.0},
 {'col': 13, 'row': 6, 'value': 0.0},
 {'col': 13, 'row': 7, 'value': 0.0},
 {'col': 13, 'row': 8, 'value': 0.0},
 {'col': 13, 'row': 9, 'value': 0.0},
 {'col': 13, 'row': 10, 'value': 0.0},
 {'col': 13, 'row': 11, 'value': 0.0},
 {'col': 13, 'row': 12, 'value': 0.0},
 {'col': 13, 'row': 13, 'value': 0.0},
 {'col': 13, 'row': 14, 'value': 0.0},
 {'col': 13, 'row': 15, 'value': 0.0},
 {'col': 14, 'row': 1, 'value': 2.1769345646203928},
 {'col': 14, 'row': 2, 'value': 2.1769345646203928},
 {'col': 14, 'row': 3, 'value': 2.1769345646203928},
 {'col': 14, 'row': 4, 'value': 2.1769345646203928},
 {'col': 14, 'row': 5, 'value': 2.1769345646203928},
 {'col': 14, 'row': 6, 'value': 2.1769345646203928},
 {'col': 14, 'row': 7, 'value': 1.9063165663948365},
 {'col': 14, 'row': 8, 'value': 1.9063165663948365},
 {'col': 14, 'row': 9, 'value': 1.9063165663948365},
 {'col': 14, 'row': 10, 'value': 1.9063165663948365},
 {'col': 14, 'row': 11, 'value': 1.9063165663948365},
 {'col': 14, 'row': 12, 'value': 1.9063165663948365},
 {'col': 14, 'row': 13, 'value': 2.0945641169499449},
 {'col': 14, 'row': 14, 'value': 2.0945641169499449},
 {'col': 14, 'row': 15, 'value': 2.0945641169499449},
 {'col': 14, 'row': 16, 'value': 2.0945641169499449},
 {'col': 14, 'row': 17, 'value': 2.0945641169499449},
 {'col': 14, 'row': 18, 'value': 2.0945641169499449},
 {'col': 14, 'row': 19, 'value': 2.2566709889957122},
 {'col': 14, 'row': 20, 'value': 2.2566709889957122},
 {'col': 14, 'row': 21, 'value': 2.2566709889957122},
 {'col': 14, 'row': 22, 'value': 2.2566709889957122},
 {'col': 14, 'row': 23, 'value': 2.2566709889957122},
 {'col': 14, 'row': 24, 'value': 2.2566709889957122},
 {'col': 14, 'row': 25, 'value': 1.7755233742874674},
 {'col': 14, 'row': 26, 'value': 1.7755233742874674},
 {'col': 14, 'row': 27, 'value': 1.7755233742874674},
 {'col': 14, 'row': 28, 'value': 1.7755233742874674},
 {'col': 14, 'row': 29, 'value': 1.7755233742874674},
 {'col': 14, 'row': 30, 'value': 1.7755233742874674},
 {'col': 14, 'row': 31, 'value': 1.9545073725093323},
 {'col': 14, 'row': 32, 'value': 1.9545073725093323},
 {'col': 14, 'row': 33, 'value': 1.9545073725093323},
 {'col': 15, 'row': 1, 'value': 0.38229200714171241},
 {'col': 15, 'row': 2, 'value': 0.58591268788128137},
 {'col': 15, 'row': 3, 'value': -0.35363813115449155},
 {'col': 15, 'row': 4, 'value': 0.015666634878980172},
 {'col': 16, 'row': 1, 'value': -0.28832094315288109},
 {'col': 16, 'row': 2, 'value': -0.15099616055905943},
 {'col': 16, 'row': 3, 'value': -0.071648537505625512},
 {'col': 16, 'row': 4, 'value': -0.58190280878314804},
 {'col': 16, 'row': 5, 'value': -0.15967591587009639},
 {'col': 16, 'row': 6, 'value': 0.3599934316625587},
 {'col': 17, 'row': 1, 'value': 0.063143798964624243},
 {'col': 17, 'row': 2, 'value': -0.21257212625127564},
 {'col': 17, 'row': 3, 'value': 0.95279236706783188},
 {'col': 17, 'row': 4, 'value': 1.1535328299677952},
 {'col': 18, 'row': 1, 'value': 0.0},
 {'col': 18, 'row': 2, 'value': 0.161463873121483},
 {'col': 18, 'row': 3, 'value': 0.65497791444244224},
 {'col': 18, 'row': 4, 'value': 0.3539402079547006},
 {'col': 18, 'row': 5, 'value': 0.2652600675795167},
 {'col': 18, 'row': 6, 'value': 0.61920996305758746},
 {'col': 19, 'row': 1, 'value': 1.8449257584651275},
 {'col': 19, 'row': 2, 'value': 1.8449257584651275},
 {'col': 19, 'row': 3, 'value': 1.8449257584651275},
 {'col': 19, 'row': 4, 'value': 1.8449257584651275},
 {'col': 19, 'row': 5, 'value': 1.8449257584651275},
 {'col': 19, 'row': 6, 'value': 1.8449257584651275},
 {'col': 19, 'row': 7, 'value': 1.1770999417168508},
 {'col': 19, 'row': 8, 'value': 1.1770999417168508},
 {'col': 19, 'row': 9, 'value': 1.1770999417168508},
 {'col': 19, 'row': 10, 'value': 1.1770999417168508},
 {'col': 19, 'row': 11, 'value': 1.1770999417168508},
 {'col': 19, 'row': 12, 'value': 1.1770999417168508},
 {'col': 19, 'row': 13, 'value': 1.6701171209959458},
 {'col': 19, 'row': 14, 'value': 1.6701171209959458},
 {'col': 19, 'row': 15, 'value': 1.6701171209959458},
 {'col': 19, 'row': 16, 'value': 1.6701171209959458},
 {'col': 19, 'row': 17, 'value': 1.6701171209959458},
 {'col': 19, 'row': 18, 'value': 1.6701171209959458},
 {'col': 19, 'row': 19, 'value': 2.0151176641713393},
 {'col': 19, 'row': 20, 'value': 2.0151176641713393},
 {'col': 19, 'row': 21, 'value': 2.0151176641713393},
 {'col': 19, 'row': 22, 'value': 2.0151176641713393},
 {'col': 19, 'row': 23, 'value': 2.0151176641713393},
 {'col': 19, 'row': 24, 'value': 2.0151176641713393},
 {'col': 19, 'row': 25, 'value': 1.1882945401393357},
 {'col': 19, 'row': 26, 'value': 1.1882945401393357},
 {'col': 19, 'row': 27, 'value': 1.1882945401393357},
 {'col': 19, 'row': 28, 'value': 1.1882945401393357},
 {'col': 19, 'row': 29, 'value': 1.1882945401393357},
 {'col': 19, 'row': 30, 'value': 1.1882945401393357},
 {'col': 19, 'row': 31, 'value': 1.5363401990278869},
 {'col': 19, 'row': 32, 'value': 1.5363401990278869},
 {'col': 19, 'row': 33, 'value': 1.5363401990278869},
 {'col': 20, 'row': 1, 'value': 0.0},
 {'col': 20, 'row': 2, 'value': 0.20676210509846782},
 {'col': 20, 'row': 3, 'value': 1.3124540454506681},
 {'col': 20, 'row': 4, 'value': 0.69691009192047326},
 {'col': 20, 'row': 5, 'value': 0.68331399284525185},
 {'col': 20, 'row': 6, 'value': 1.2558809596477545},
 {'col': 21, 'row': 1, 'value': 1.7865777338626099},
 {'col': 21, 'row': 2, 'value': 1.7865777338626099},
 {'col': 21, 'row': 3, 'value': 1.7865777338626099},
 {'col': 21, 'row': 4, 'value': 1.7865777338626099},
 {'col': 21, 'row': 5, 'value': 1.7865777338626099},
 {'col': 21, 'row': 6, 'value': 1.4837930534735668},
 {'col': 21, 'row': 7, 'value': 1.4837930534735668},
 {'col': 21, 'row': 8, 'value': 1.4837930534735668},
 {'col': 21, 'row': 9, 'value': 1.4837930534735668},
 {'col': 21, 'row': 10, 'value': 1.4837930534735668},
 {'col': 21, 'row': 11, 'value': 2.0075654999921348},
 {'col': 21, 'row': 12, 'value': 2.0075654999921348},
 {'col': 21, 'row': 13, 'value': 2.0075654999921348},
 {'col': 21, 'row': 14, 'value': 2.0075654999921348},
 {'col': 21, 'row': 15, 'value': 2.0075654999921348},
 {'col': 21, 'row': 16, 'value': 2.0095125178532744},
 {'col': 21, 'row': 17, 'value': 2.0095125178532744},
 {'col': 21, 'row': 18, 'value': 2.0095125178532744},
 {'col': 21, 'row': 19, 'value': 2.0095125178532744},
 {'col': 21, 'row': 20, 'value': 2.0095125178532744},
 {'col': 21, 'row': 21, 'value': 1.5504243671366666},
 {'col': 21, 'row': 22, 'value': 1.5504243671366666},
 {'col': 21, 'row': 23, 'value': 1.5504243671366666},
 {'col': 21, 'row': 24, 'value': 1.5504243671366666},
 {'col': 21, 'row': 25, 'value': 1.5504243671366666},
 {'col': 22, 'row': 1, 'value': -1.3618476324150208},
 {'col': 22, 'row': 2, 'value': 0.63371559679051881},
 {'col': 22, 'row': 3, 'value': 1.2187510659036622},
 {'col': 22, 'row': 4, 'value': 0.70702543059265432},
 {'col': 22, 'row': 5, 'value': 1.0136497205264541},
 {'col': 22, 'row': 6, 'value': 1.2434915499861943},
 {'col': 23, 'row': 1, 'value': 0.64764759648857917},
 {'col': 23, 'row': 2, 'value': 1.4640652594183479},
 {'col': 23, 'row': 3, 'value': 0.67636209589912633},
 {'col': 23, 'row': 4, 'value': 1.0925841559297678},
 {'col': 23, 'row': 5, 'value': 1.3264965848724235},
 {'col': 24, 'row': 1, 'value': 2.1433337602588955},
 {'col': 24, 'row': 2, 'value': 2.1433337602588955},
 {'col': 24, 'row': 3, 'value': 2.1433337602588955},
 {'col': 24, 'row': 4, 'value': 2.1433337602588955},
 {'col': 24, 'row': 5, 'value': 2.1433337602588955},
 {'col': 24, 'row': 6, 'value': 2.1433337602588955},
 {'col': 24, 'row': 7, 'value': 1.8306788549354991},
 {'col': 24, 'row': 8, 'value': 1.8306788549354991},
 {'col': 24, 'row': 9, 'value': 1.8306788549354991},
 {'col': 24, 'row': 10, 'value': 1.8306788549354991},
 {'col': 24, 'row': 11, 'value': 1.8306788549354991},
 {'col': 24, 'row': 12, 'value': 1.8306788549354991},
 {'col': 24, 'row': 13, 'value': 2.1988565782313438},
 {'col': 24, 'row': 14, 'value': 2.1988565782313438},
 {'col': 24, 'row': 15, 'value': 2.1988565782313438},
 {'col': 24, 'row': 16, 'value': 2.1988565782313438},
 {'col': 24, 'row': 17, 'value': 2.1988565782313438},
 {'col': 24, 'row': 18, 'value': 2.1988565782313438},
 {'col': 24, 'row': 19, 'value': 2.3261160555204108},
 {'col': 24, 'row': 20, 'value': 2.3261160555204108},
 {'col': 24, 'row': 21, 'value': 2.3261160555204108},
 {'col': 24, 'row': 22, 'value': 2.3261160555204108},
 {'col': 24, 'row': 23, 'value': 2.3261160555204108},
 {'col': 24, 'row': 24, 'value': 2.3261160555204108},
 {'col': 24, 'row': 25, 'value': 1.7798656844244058},
 {'col': 24, 'row': 26, 'value': 1.7798656844244058},
 {'col': 24, 'row': 27, 'value': 1.7798656844244058},
 {'col': 24, 'row': 28, 'value': 1.7798656844244058},
 {'col': 24, 'row': 29, 'value': 1.7798656844244058},
 {'col': 24, 'row': 30, 'value': 1.7798656844244058},
 {'col': 24, 'row': 31, 'value': 2.0462802331979244},
 {'col': 24, 'row': 32, 'value': 2.0462802331979244},
 {'col': 24, 'row': 33, 'value': 2.0462802331979244},
 {'col': 25, 'row': 1, 'value': 1.2174436635137804},
 {'col': 25, 'row': 2, 'value': -0.60806917132186944},
 {'col': 25, 'row': 3, 'value': -1.1896919298336934},
 {'col': 26, 'row': 1, 'value': 0.0},
 {'col': 26, 'row': 2, 'value': 0.0},
 {'col': 26, 'row': 3, 'value': 0.0},
 {'col': 26, 'row': 4, 'value': 0.0},
 {'col': 27, 'row': 1, 'value': 0.51913897192944713},
 {'col': 27, 'row': 2, 'value': 1.3944460456752088},
 {'col': 27, 'row': 3, 'value': 1.5214107469787361},
 {'col': 27, 'row': 4, 'value': 1.3715283786067765},
 {'col': 27, 'row': 5, 'value': 1.4875866126017629},
 {'col': 27, 'row': 6, 'value': 1.4224213513359252},
 {'col': 28, 'row': 1, 'value': 0.0},
 {'col': 28, 'row': 2, 'value': 0.0},
 {'col': 28, 'row': 3, 'value': 0.0},
 {'col': 28, 'row': 4, 'value': 0.0},
 {'col': 28, 'row': 5, 'value': 0.0},
 {'col': 28, 'row': 6, 'value': 0.0},
 {'col': 28, 'row': 7, 'value': 0.0},
 {'col': 28, 'row': 8, 'value': 0.0},
 {'col': 28, 'row': 9, 'value': 0.0},
 {'col': 29, 'row': 1, 'value': 0.0},
 {'col': 29, 'row': 2, 'value': 0.0},
 {'col': 29, 'row': 3, 'value': 0.0},
 {'col': 29, 'row': 4, 'value': 0.0},
 {'col': 29, 'row': 5, 'value': 0.0},
 {'col': 29, 'row': 6, 'value': 0.0},
 {'col': 29, 'row': 7, 'value': 0.0},
 {'col': 29, 'row': 8, 'value': 0.0},
 {'col': 29, 'row': 9, 'value': 0.0},
 {'col': 29, 'row': 10, 'value': 0.0},
 {'col': 29, 'row': 11, 'value': 0.0},
 {'col': 29, 'row': 12, 'value': 0.0},
 {'col': 29, 'row': 13, 'value': 0.0},
 {'col': 29, 'row': 14, 'value': 0.0},
 {'col': 29, 'row': 15, 'value': 0.0},
 {'col': 29, 'row': 16, 'value': 0.0},
 {'col': 29, 'row': 17, 'value': 0.0},
 {'col': 29, 'row': 18, 'value': 0.0},
 {'col': 29, 'row': 19, 'value': 0.0},
 {'col': 29, 'row': 20, 'value': 0.0},
 {'col': 29, 'row': 21, 'value': 0.0},
 {'col': 29, 'row': 22, 'value': 0.0},
 {'col': 29, 'row': 23, 'value': 0.0},
 {'col': 29, 'row': 24, 'value': 0.0},
 {'col': 29, 'row': 25, 'value': 0.0},
 {'col': 30, 'row': 1, 'value': 0.0},
 {'col': 30, 'row': 2, 'value': 0.0},
 {'col': 30, 'row': 3, 'value': 0.0},
 {'col': 30, 'row': 4, 'value': 0.0},
 {'col': 30, 'row': 5, 'value': 0.0},
 {'col': 30, 'row': 6, 'value': 0.0},
 {'col': 30, 'row': 7, 'value': 0.0},
 {'col': 30, 'row': 8, 'value': 0.0},
 {'col': 30, 'row': 9, 'value': -0.8334235552327115},
 {'col': 30, 'row': 10, 'value': -0.8334235552327115},
 {'col': 30, 'row': 11, 'value': -0.8334235552327115},
 {'col': 30, 'row': 12, 'value': -0.8334235552327115},
 {'col': 30, 'row': 13, 'value': -0.65991358525078947},
 {'col': 31, 'row': 1, 'value': 2.1869576074693207},
 {'col': 31, 'row': 2, 'value': 2.1869576074693207},
 {'col': 31, 'row': 3, 'value': 2.1869576074693207},
 {'col': 31, 'row': 4, 'value': 2.1869576074693207},
 {'col': 31, 'row': 5, 'value': 2.1869576074693207},
 {'col': 31, 'row': 6, 'value': 2.1869576074693207},
 {'col': 31, 'row': 7, 'value': 1.9508195069841541},
 {'col': 31, 'row': 8, 'value': 1.9508195069841541},
 {'col': 31, 'row': 9, 'value': 1.9508195069841541},
 {'col': 31, 'row': 10, 'value': 1.9508195069841541},
 {'col': 31, 'row': 11, 'value': 1.9508195069841541},
 {'col': 31, 'row': 12, 'value': 1.9508195069841541},
 {'col': 31, 'row': 13, 'value': 2.1018315052075316},
 {'col': 31, 'row': 14, 'value': 2.1018315052075316},
 {'col': 31, 'row': 15, 'value': 2.1018315052075316},
 {'col': 31, 'row': 16, 'value': 2.1018315052075316},
 {'col': 31, 'row': 17, 'value': 2.1018315052075316},
 {'col': 31, 'row': 18, 'value': 2.1018315052075316},
 {'col': 31, 'row': 19, 'value': 2.1997347575294866},
 {'col': 31, 'row': 20, 'value': 2.1997347575294866},
 {'col': 31, 'row': 21, 'value': 2.1997347575294866},
 {'col': 31, 'row': 22, 'value': 2.1997347575294866},
 {'col': 31, 'row': 23, 'value': 2.1997347575294866},
 {'col': 31, 'row': 24, 'value': 2.1997347575294866},
 {'col': 31, 'row': 25, 'value': 1.8852498123153938},
 {'col': 31, 'row': 26, 'value': 1.8852498123153938},
 {'col': 31, 'row': 27, 'value': 1.8852498123153938},
 {'col': 31, 'row': 28, 'value': 1.8852498123153938},
 {'col': 31, 'row': 29, 'value': 1.8852498123153938},
 {'col': 31, 'row': 30, 'value': 1.8852498123153938},
 {'col': 31, 'row': 31, 'value': 2.0181989164386174},
 {'col': 31, 'row': 32, 'value': 2.0181989164386174},
 {'col': 31, 'row': 33, 'value': 2.0181989164386174},
 {'col': 32, 'row': 1, 'value': 0.0},
 {'col': 32, 'row': 2, 'value': 0.47596706257861598},
 {'col': 32, 'row': 3, 'value': -0.13630896078371851},
 {'col': 32, 'row': 4, 'value': -0.21753804158089063},
 {'col': 32, 'row': 5, 'value': 0.10466627472834991},
 {'col': 33, 'row': 1, 'value': 0.0},
 {'col': 33, 'row': 2, 'value': 0.0},
 {'col': 33, 'row': 3, 'value': 0.0},
 {'col': 33, 'row': 4, 'value': 0.0},
 {'col': 33, 'row': 5, 'value': 0.0},
 {'col': 33, 'row': 6, 'value': 0.0},
 {'col': 33, 'row': 7, 'value': 0.0},
 {'col': 33, 'row': 8, 'value': -0.039093281273068256},
 {'col': 33, 'row': 9, 'value': -0.039093281273068256},
 {'col': 33, 'row': 10, 'value': -0.039093281273068256},
 {'col': 33, 'row': 11, 'value': -0.039093281273068256},
 {'col': 33, 'row': 12, 'value': -0.039093281273068256},
 {'col': 33, 'row': 13, 'value': -0.039093281273068256},
 {'col': 33, 'row': 14, 'value': -0.039093281273068256},
 {'col': 33, 'row': 15, 'value': 1.0049424294687177},
 {'col': 33, 'row': 16, 'value': 1.0049424294687177},
 {'col': 33, 'row': 17, 'value': 1.0049424294687177},
 {'col': 33, 'row': 18, 'value': 1.0049424294687177},
 {'col': 33, 'row': 19, 'value': 1.0049424294687177},
 {'col': 33, 'row': 20, 'value': 1.0049424294687177},
 {'col': 33, 'row': 21, 'value': 1.0049424294687177},
 {'col': 33, 'row': 22, 'value': -0.080777394156236276},
 {'col': 33, 'row': 23, 'value': -0.080777394156236276},
 {'col': 34, 'row': 1, 'value': 0.6315164277634443},
 {'col': 34, 'row': 2, 'value': -1.0336985254426578},
 {'col': 34, 'row': 3, 'value': -0.049714541274335861},
 {'col': 35, 'row': 1, 'value': 0.0},
 {'col': 35, 'row': 2, 'value': 1.2876528887167573},
 {'col': 35, 'row': 3, 'value': 1.457605210685361},
 {'col': 35, 'row': 4, 'value': 1.3032578013401832},
 {'col': 35, 'row': 5, 'value': 1.2406556845190002},
 {'col': 35, 'row': 6, 'value': 1.1001311346373794},
 {'col': 36, 'row': 1, 'value': 0.0},
 {'col': 36, 'row': 2, 'value': 1.6193189339547391},
 {'col': 36, 'row': 3, 'value': 1.9620323423879305},
 {'col': 36, 'row': 4, 'value': 1.6963272819811248},
 {'col': 36, 'row': 5, 'value': 1.8058448035152117},
 {'col': 36, 'row': 6, 'value': 1.7597509522172838},
 {'col': 37, 'row': 1, 'value': 1.8517281897137234},
 {'col': 37, 'row': 2, 'value': 1.8517281897137234},
 {'col': 37, 'row': 3, 'value': 1.0904725843076954},
 {'col': 37, 'row': 4, 'value': 1.0904725843076954},
 {'col': 37, 'row': 5, 'value': 1.9458530045654552},
 {'col': 37, 'row': 6, 'value': 1.9458530045654552},
 {'col': 37, 'row': 7, 'value': 1.8403845404053096},
 {'col': 37, 'row': 8, 'value': 1.8403845404053096},
 {'col': 37, 'row': 9, 'value': 1.050891552456698},
 {'col': 37, 'row': 10, 'value': 1.050891552456698},
 {'col': 37, 'row': 11, 'value': 1.8596626360914159},
 {'col': 37, 'row': 12, 'value': 1.8596626360914159},
 {'col': 38, 'row': 1, 'value': 0.0},
 {'col': 38, 'row': 2, 'value': 0.0},
 {'col': 38, 'row': 3, 'value': 0.0},
 {'col': 39, 'row': 1, 'value': -0.16354651610762722},
 {'col': 39, 'row': 2, 'value': -0.027522287346425027},
 {'col': 40, 'row': 1, 'value': 0.0},
 {'col': 41, 'row': 1, 'value': -0.097128932733191398},
 {'col': 42, 'row': 1, 'value': -0.059642791469634464},
 {'col': 42, 'row': 2, 'value': 0.0},
 {'col': 42, 'row': 3, 'value': 0.0},
 {'col': 42, 'row': 4, 'value': 0.54134124965915087},
 {'col': 42, 'row': 5, 'value': 0.0},
 {'col': 42, 'row': 6, 'value': 0.0},
 {'col': 42, 'row': 7, 'value': 0.0},
 {'col': 43, 'row': 1, 'value': 0.0},
 {'col': 43, 'row': 2, 'value': 0.67804369498262707},
 {'col': 43, 'row': 3, 'value': 1.7932616736870741},
 {'col': 43, 'row': 4, 'value': 0.97442378171320831},
 {'col': 43, 'row': 5, 'value': 1.1452954728084797},
 {'col': 43, 'row': 6, 'value': 1.5548000839540461},
 {'col': 44, 'row': 1, 'value': -0.95011901037231228},
 {'col': 44, 'row': 2, 'value': -0.16798915807170864},
 {'col': 44, 'row': 3, 'value': 0.2212297211089361},
 {'col': 44, 'row': 4, 'value': 0.37798427871815249},
 {'col': 44, 'row': 5, 'value': -0.077635108268340747},
 {'col': 44, 'row': 6, 'value': -0.22496270497131976},
 {'col': 45, 'row': 1, 'value': 13.815510557964274},
 {'col': 45, 'row': 2, 'value': 13.815510557964274},
 {'col': 45, 'row': 3, 'value': 13.815510557964274},
 {'col': 45, 'row': 4, 'value': 13.815510557964274},
 {'col': 45, 'row': 5, 'value': 13.815510557964274},
 {'col': 45, 'row': 6, 'value': 13.815510557964274},
 {'col': 46, 'row': 1, 'value': 2.1592376804962314},
 {'col': 46, 'row': 2, 'value': 2.1592376804962314},
 {'col': 46, 'row': 3, 'value': 2.1592376804962314},
 {'col': 46, 'row': 4, 'value': 2.1592376804962314},
 {'col': 46, 'row': 5, 'value': 2.1592376804962314},
 {'col': 46, 'row': 6, 'value': 2.1592376804962314},
 {'col': 46, 'row': 7, 'value': 1.9390754168231943},
 {'col': 46, 'row': 8, 'value': 1.9390754168231943},
 {'col': 46, 'row': 9, 'value': 1.9390754168231943},
 {'col': 46, 'row': 10, 'value': 1.9390754168231943},
 {'col': 46, 'row': 11, 'value': 1.9390754168231943},
 {'col': 46, 'row': 12, 'value': 1.9390754168231943},
 {'col': 46, 'row': 13, 'value': 2.1927412087086702},
 {'col': 46, 'row': 14, 'value': 2.1927412087086702},
 {'col': 46, 'row': 15, 'value': 2.1927412087086702},
 {'col': 46, 'row': 16, 'value': 2.1927412087086702},
 {'col': 46, 'row': 17, 'value': 2.1927412087086702},
 {'col': 46, 'row': 18, 'value': 2.1927412087086702},
 {'col': 46, 'row': 19, 'value': 13.815510557964274},
 {'col': 46, 'row': 20, 'value': 13.815510557964274},
 {'col': 46, 'row': 21, 'value': 13.815510557964274},
 {'col': 46, 'row': 22, 'value': 13.815510557964274},
 {'col': 46, 'row': 23, 'value': 13.815510557964274},
 {'col': 46, 'row': 24, 'value': 13.815510557964274},
 {'col': 46, 'row': 25, 'value': 1.7691780847597065},
 {'col': 46, 'row': 26, 'value': 1.7691780847597065},
 {'col': 46, 'row': 27, 'value': 1.7691780847597065},
 {'col': 46, 'row': 28, 'value': 1.7691780847597065},
 {'col': 46, 'row': 29, 'value': 1.7691780847597065},
 {'col': 46, 'row': 30, 'value': 1.7691780847597065},
 {'col': 46, 'row': 31, 'value': 2.0256240114563782},
 {'col': 46, 'row': 32, 'value': 2.0256240114563782},
 {'col': 46, 'row': 33, 'value': 2.0256240114563782},
 {'col': 47, 'row': 1, 'value': 0.0},
 {'col': 47, 'row': 2, 'value': -0.041702590464412395},
 {'col': 47, 'row': 3, 'value': 0.86387259456162435},
 {'col': 47, 'row': 4, 'value': 0.86576345980605118},
 {'col': 47, 'row': 5, 'value': 0.066227718639808364},
 {'col': 47, 'row': 6, 'value': 0.60219349742859696},
 {'col': 48, 'row': 1, 'value': 1.8797596627330126},
 {'col': 48, 'row': 2, 'value': 1.8797596627330126},
 {'col': 48, 'row': 3, 'value': 1.2070570431677281},
 {'col': 48, 'row': 4, 'value': 1.2070570431677281},
 {'col': 48, 'row': 5, 'value': 1.88421406056628},
 {'col': 48, 'row': 6, 'value': 1.88421406056628},
 {'col': 48, 'row': 7, 'value': 1.8173996002606896},
 {'col': 48, 'row': 8, 'value': 1.8173996002606896},
 {'col': 48, 'row': 9, 'value': 1.0039242486280346},
 {'col': 48, 'row': 10, 'value': 1.0039242486280346},
 {'col': 48, 'row': 11, 'value': 1.6398875798733028},
 {'col': 48, 'row': 12, 'value': 1.6398875798733028},
 {'col': 49, 'row': 1, 'value': 1.6740676794086435},
 {'col': 49, 'row': 2, 'value': 0.91941783737919758},
 {'col': 49, 'row': 3, 'value': 0.63214373699961335},
 {'col': 49, 'row': 4, 'value': 0.090306774531093426},
 {'col': 49, 'row': 5, 'value': 0.80653389989722735},
 {'col': 50, 'row': 1, 'value': 0.0},
 {'col': 50, 'row': 2, 'value': 0.0},
 {'col': 50, 'row': 3, 'value': 0.0},
 {'col': 50, 'row': 4, 'value': 0.0},
 {'col': 50, 'row': 5, 'value': 0.0},
 {'col': 50, 'row': 6, 'value': 0.0},
 {'col': 50, 'row': 7, 'value': 0.0},
 {'col': 50, 'row': 8, 'value': 0.0},
 {'col': 50, 'row': 9, 'value': 0.0},
 {'col': 50, 'row': 10, 'value': 0.0},
 {'col': 50, 'row': 11, 'value': 0.0},
 {'col': 50, 'row': 12, 'value': 0.0},
 {'col': 50, 'row': 13, 'value': 0.0},
 {'col': 51, 'row': 1, 'value': 0.0},
 {'col': 51, 'row': 2, 'value': 0.0},
 {'col': 51, 'row': 3, 'value': 0.0},
 {'col': 51, 'row': 4, 'value': 0.0},
 {'col': 51, 'row': 5, 'value': 0.0},
 {'col': 52, 'row': 1, 'value': 0.86009279780227188},
 {'col': 52, 'row': 2, 'value': 0.86009279780227188},
 {'col': 52, 'row': 3, 'value': 0.77610870127429266},
 {'col': 52, 'row': 4, 'value': 0.77610870127429266},
 {'col': 52, 'row': 5, 'value': 0.73899970074203458},
 {'col': 52, 'row': 6, 'value': 0.73899970074203458},
 {'col': 52, 'row': 7, 'value': 1.0832008061683258},
 {'col': 52, 'row': 8, 'value': 1.0832008061683258},
 {'col': 52, 'row': 9, 'value': 0.0},
 {'col': 52, 'row': 10, 'value': 0.0},
 {'col': 53, 'row': 1, 'value': 0.65980237042665024},
 {'col': 53, 'row': 2, 'value': 0.65980237042665024},
 {'col': 53, 'row': 3, 'value': 0.40690407230241865},
 {'col': 53, 'row': 4, 'value': 0.40690407230241865},
 {'col': 53, 'row': 5, 'value': 0.35109339604082618},
 {'col': 53, 'row': 6, 'value': 0.35109339604082618},
 {'col': 53, 'row': 7, 'value': 0.77761240217865324},
 {'col': 53, 'row': 8, 'value': 0.77761240217865324},
 {'col': 53, 'row': 9, 'value': 0.0},
 {'col': 53, 'row': 10, 'value': 0.0},
 {'col': 54, 'row': 1, 'value': 0.0},
 {'col': 54, 'row': 2, 'value': 1.1701512494504254},
 {'col': 54, 'row': 3, 'value': 1.2993384371381689},
 {'col': 54, 'row': 4, 'value': 1.1273357906872274},
 {'col': 54, 'row': 5, 'value': 1.2116492647654515},
 {'col': 54, 'row': 6, 'value': 1.3021026415210952},
 {'col': 55, 'row': 1, 'value': 0.0},
 {'col': 55, 'row': 2, 'value': 0.0},
 {'col': 55, 'row': 3, 'value': 0.0},
 {'col': 55, 'row': 4, 'value': 0.0},
 {'col': 55, 'row': 5, 'value': 0.0},
 {'col': 55, 'row': 6, 'value': 0.0},
 {'col': 56, 'row': 1, 'value': 0.53696694257214439},
 {'col': 56, 'row': 2, 'value': 0.068209898376823341},
 {'col': 56, 'row': 3, 'value': 0.65461423084316162},
 {'col': 56, 'row': 4, 'value': 0.97535177900335879},
 {'col': 56, 'row': 5, 'value': -0.5016908068721071},
 {'col': 56, 'row': 6, 'value': 0.67020091721369435},
 {'col': 57, 'row': 1, 'value': 0.0},
 {'col': 57, 'row': 2, 'value': 0.0},
 {'col': 57, 'row': 3, 'value': 1.3886939797308677},
 {'col': 57, 'row': 4, 'value': 0.26245656789970584},
 {'col': 57, 'row': 5, 'value': 0.0},
 {'col': 58, 'row': 1, 'value': -0.36761600826341306},
 {'col': 58, 'row': 2, 'value': -0.36761600826341306},
 {'col': 58, 'row': 3, 'value': 0.84203259460006186},
 {'col': 58, 'row': 4, 'value': 0.84203259460006186},
 {'col': 58, 'row': 5, 'value': -0.75767930171799647},
 {'col': 58, 'row': 6, 'value': -0.75767930171799647},
 {'col': 58, 'row': 7, 'value': 0.14669437915080344},
 {'col': 58, 'row': 8, 'value': 0.14669437915080344},
 {'col': 58, 'row': 9, 'value': 0.41863796381841184},
 {'col': 58, 'row': 10, 'value': 0.41863796381841184},
 {'col': 58, 'row': 11, 'value': -0.27635974592153451},
 {'col': 59, 'row': 1, 'value': 0.0},
 {'col': 59, 'row': 2, 'value': 0.0},
 {'col': 59, 'row': 3, 'value': 0.0},
 {'col': 59, 'row': 4, 'value': 0.0},
 {'col': 59, 'row': 5, 'value': 0.0},
 {'col': 59, 'row': 6, 'value': 0.0},
 {'col': 59, 'row': 7, 'value': 0.0},
 {'col': 59, 'row': 8, 'value': 0.0},
 {'col': 59, 'row': 9, 'value': 0.0},
 {'col': 59, 'row': 10, 'value': 0.0},
 {'col': 59, 'row': 11, 'value': 0.0},
 {'col': 59, 'row': 12, 'value': 0.0},
 {'col': 59, 'row': 13, 'value': 0.0},
 {'col': 60, 'row': 1, 'value': -0.47061821806676069},
 {'col': 60, 'row': 2, 'value': 0.17098251212396082},
 {'col': 60, 'row': 3, 'value': 0.0},
 {'col': 60, 'row': 4, 'value': -0.72523245163781636},
 {'col': 60, 'row': 5, 'value': 0.0},
 {'col': 61, 'row': 1, 'value': 0.0},
 {'col': 61, 'row': 2, 'value': 1.6834798824097266},
 {'col': 61, 'row': 3, 'value': 1.7868457499920847},
 {'col': 61, 'row': 4, 'value': 1.7456963333347006},
 {'col': 61, 'row': 5, 'value': 1.7516923980148138},
 {'col': 61, 'row': 6, 'value': 1.7348310289421613},
 {'col': 62, 'row': 1, 'value': 0.58655813278770375},
 {'col': 62, 'row': 2, 'value': 0.10247535758914202},
 {'col': 62, 'row': 3, 'value': 0.66912084595709087},
 {'col': 62, 'row': 4, 'value': 0.96433395048252879},
 {'col': 62, 'row': 5, 'value': -0.66276153578090613},
 {'col': 62, 'row': 6, 'value': 0.49279199087616671},
 {'col': 63, 'row': 1, 'value': 0.0},
 {'col': 63, 'row': 2, 'value': 1.6873466525098433},
 {'col': 63, 'row': 3, 'value': 1.7882750724287457},
 {'col': 63, 'row': 4, 'value': 1.7036547675039702},
 {'col': 63, 'row': 5, 'value': 1.8091637980676152},
 {'col': 63, 'row': 6, 'value': 1.7865442267951286},
 {'col': 64, 'row': 1, 'value': 1.921317352911686},
 {'col': 64, 'row': 2, 'value': 1.921317352911686},
 {'col': 64, 'row': 3, 'value': 1.2961891121311611},
 {'col': 64, 'row': 4, 'value': 1.2961891121311611},
 {'col': 64, 'row': 5, 'value': 1.9127329655035559},
 {'col': 64, 'row': 6, 'value': 1.9127329655035559},
 {'col': 64, 'row': 7, 'value': 1.7941183515429449},
 {'col': 64, 'row': 8, 'value': 1.7941183515429449},
 {'col': 64, 'row': 9, 'value': 1.0449899684146979},
 {'col': 64, 'row': 10, 'value': 1.0449899684146979},
 {'col': 64, 'row': 11, 'value': 1.7566779112738997},
 {'col': 64, 'row': 12, 'value': 1.7566779112738997},
 {'col': 65, 'row': 1, 'value': 0.0},
 {'col': 65, 'row': 2, 'value': 0.0},
 {'col': 65, 'row': 3, 'value': 0.0},
 {'col': 65, 'row': 4, 'value': 0.0},
 {'col': 65, 'row': 5, 'value': 0.0},
 {'col': 65, 'row': 6, 'value': 0.0},
 {'col': 65, 'row': 7, 'value': 0.0},
 {'col': 65, 'row': 8, 'value': 0.0},
 {'col': 65, 'row': 9, 'value': 0.0},
 {'col': 65, 'row': 10, 'value': 0.0},
 {'col': 65, 'row': 11, 'value': 0.0},
 {'col': 65, 'row': 12, 'value': 0.0},
 {'col': 65, 'row': 13, 'value': 0.0},
 {'col': 66, 'row': 1, 'value': 0.0},
 {'col': 66, 'row': 2, 'value': 0.0},
 {'col': 66, 'row': 3, 'value': 0.0},
 {'col': 66, 'row': 4, 'value': 0.0},
 {'col': 66, 'row': 5, 'value': 0.0},
 {'col': 66, 'row': 6, 'value': 0.0},
 {'col': 66, 'row': 7, 'value': 0.0},
 {'col': 66, 'row': 8, 'value': 0.0},
 {'col': 66, 'row': 9, 'value': 0.0},
 {'col': 66, 'row': 10, 'value': 0.0},
 {'col': 66, 'row': 11, 'value': 0.0},
 {'col': 66, 'row': 12, 'value': 0.0},
 {'col': 66, 'row': 13, 'value': 0.0},
 {'col': 67, 'row': 1, 'value': 0.0},
 {'col': 67, 'row': 2, 'value': 0.0},
 {'col': 67, 'row': 3, 'value': 0.0},
 {'col': 67, 'row': 4, 'value': 0.0},
 {'col': 67, 'row': 5, 'value': 0.0},
 {'col': 68, 'row': 1, 'value': 0.0},
 {'col': 68, 'row': 2, 'value': -1.1217662855349577},
 {'col': 68, 'row': 3, 'value': 0.0},
 {'col': 68, 'row': 4, 'value': 0.0},
 {'col': 69, 'row': 1, 'value': 0.0},
 {'col': 69, 'row': 2, 'value': 1.7311084928976763},
 {'col': 69, 'row': 3, 'value': 1.7998218804680997},
 {'col': 69, 'row': 4, 'value': 1.7874635884645638},
 {'col': 69, 'row': 5, 'value': 1.778817751969924},
 {'col': 69, 'row': 6, 'value': 1.7942929239863801},
 {'col': 70, 'row': 1, 'value': 0.0},
 {'col': 70, 'row': 2, 'value': 1.2948887983670594},
 {'col': 70, 'row': 3, 'value': 1.2327614071274036},
 {'col': 70, 'row': 4, 'value': 1.321526480348076},
 {'col': 70, 'row': 5, 'value': 1.2039868042279369},
 {'col': 70, 'row': 6, 'value': 1.0525788213160687},
 {'col': 71, 'row': 1, 'value': 0.0},
 {'col': 71, 'row': 2, 'value': -0.79925464177882988},
 {'col': 71, 'row': 3, 'value': -0.86721965478350016},
 {'col': 71, 'row': 4, 'value': -0.75168772557388075},
 {'col': 71, 'row': 5, 'value': -0.35243679473691381},
 {'col': 72, 'row': 1, 'value': 0.48585852350732572},
 {'col': 72, 'row': 2, 'value': 0.17196814471446303},
 {'col': 72, 'row': 3, 'value': 1.072863618645332},
 {'col': 72, 'row': 4, 'value': 0.53444448936462463},
 {'col': 72, 'row': 5, 'value': 0.43389058229186822},
 {'col': 72, 'row': 6, 'value': 0.79223204545009995},
 {'col': 73, 'row': 1, 'value': 0.0},
 {'col': 73, 'row': 2, 'value': 0.0},
 {'col': 73, 'row': 3, 'value': 0.0},
 {'col': 74, 'row': 1, 'value': 0.0},
 {'col': 74, 'row': 2, 'value': 0.92065320244716242},
 {'col': 74, 'row': 3, 'value': 1.1108965275013289},
 {'col': 74, 'row': 4, 'value': 0.9931295433183166},
 {'col': 74, 'row': 5, 'value': 1.0915104636340403},
 {'col': 74, 'row': 6, 'value': 1.0889187914970144},
 {'col': 75, 'row': 1, 'value': -1.2853961869148021},
 {'col': 75, 'row': 2, 'value': -0.69660113861146222},
 {'col': 75, 'row': 3, 'value': -1.1297593615439603},
 {'col': 75, 'row': 4, 'value': 0.0},
 {'col': 76, 'row': 1, 'value': 0.60353424061995298},
 {'col': 76, 'row': 2, 'value': 0.60353424061995298},
 {'col': 76, 'row': 3, 'value': 0.43763538421300568},
 {'col': 76, 'row': 4, 'value': 0.43763538421300568},
 {'col': 76, 'row': 5, 'value': 0.0},
 {'col': 76, 'row': 6, 'value': 0.0},
 {'col': 76, 'row': 7, 'value': -0.96402195691758308},
 {'col': 76, 'row': 8, 'value': -0.96402195691758308},
 {'col': 76, 'row': 9, 'value': -0.7896977293038675},
 {'col': 76, 'row': 10, 'value': -0.7896977293038675},
 {'col': 76, 'row': 11, 'value': 0.0},
 {'col': 77, 'row': 1, 'value': 0.0},
 {'col': 77, 'row': 2, 'value': 0.0},
 {'col': 77, 'row': 3, 'value': 0.0},
 {'col': 77, 'row': 4, 'value': 0.0},
 {'col': 77, 'row': 5, 'value': 0.0},
 {'col': 77, 'row': 6, 'value': 0.0},
 {'col': 77, 'row': 7, 'value': 0.0},
 {'col': 77, 'row': 8, 'value': 0.0},
 {'col': 77, 'row': 9, 'value': 0.0},
 {'col': 77, 'row': 10, 'value': 0.0},
 {'col': 77, 'row': 11, 'value': 0.0},
 {'col': 77, 'row': 12, 'value': 0.0},
 {'col': 77, 'row': 13, 'value': 0.0},
 {'col': 77, 'row': 14, 'value': 0.0},
 {'col': 77, 'row': 15, 'value': 0.0},
 {'col': 77, 'row': 16, 'value': 0.0},
 {'col': 77, 'row': 17, 'value': 0.0},
 {'col': 77, 'row': 18, 'value': 0.0},
 {'col': 77, 'row': 19, 'value': 0.0},
 {'col': 77, 'row': 20, 'value': 0.0},
 {'col': 77, 'row': 21, 'value': 0.0},
 {'col': 77, 'row': 22, 'value': 0.0},
 {'col': 77, 'row': 23, 'value': 0.0},
 {'col': 77, 'row': 24, 'value': 0.0},
 {'col': 77, 'row': 25, 'value': 0.0},
 {'col': 77, 'row': 26, 'value': 0.0},
 {'col': 77, 'row': 27, 'value': 0.0},
 {'col': 77, 'row': 28, 'value': 0.0},
 {'col': 78, 'row': 1, 'value': 1.5036128444441021},
 {'col': 78, 'row': 2, 'value': 1.7825538943086592},
 {'col': 78, 'row': 3, 'value': 2.0068251488760418},
 {'col': 78, 'row': 4, 'value': 1.7067642402635979},
 {'col': 78, 'row': 5, 'value': 1.8773222975774999},
 {'col': 78, 'row': 6, 'value': 1.8028576558940883},
 {'col': 79, 'row': 1, 'value': 0.0},
 {'col': 79, 'row': 2, 'value': 0.043270195229775751},
 {'col': 79, 'row': 3, 'value': 0.096464059283816669},
 {'col': 79, 'row': 4, 'value': 0.56755561251167996},
 {'col': 79, 'row': 5, 'value': -0.27988190633239618},
 {'col': 79, 'row': 6, 'value': 0.30087466623776404},
 {'col': 79, 'row': 7, 'value': 0.0},
 {'col': 80, 'row': 1, 'value': 0.71621896812770147},
 {'col': 80, 'row': 2, 'value': 0.29672109710245076},
 {'col': 80, 'row': 3, 'value': 0.83261777614992472},
 {'col': 80, 'row': 4, 'value': 0.41355893123827331},
 {'col': 80, 'row': 5, 'value': 0.2529275709108682},
 {'col': 80, 'row': 6, 'value': 0.57260534290645493},
 {'col': 81, 'row': 1, 'value': 0.0},
 {'col': 82, 'row': 1, 'value': 1.1141312443257803},
 {'col': 82, 'row': 2, 'value': 0.45275573583618217},
 {'col': 82, 'row': 3, 'value': 0.8366845955561415},
 {'col': 82, 'row': 4, 'value': 0.41297020759393799},
 {'col': 82, 'row': 5, 'value': 0.26560516093069186},
 {'col': 82, 'row': 6, 'value': 0.62087214293953052},
 {'col': 83, 'row': 1, 'value': 1.6734675541144808},
 {'col': 83, 'row': 2, 'value': 0.50990920398162287},
 {'col': 83, 'row': 3, 'value': 1.1618155437345905},
 {'col': 83, 'row': 4, 'value': 0.54084063260908866},
 {'col': 83, 'row': 5, 'value': -0.72747158024393588},
 {'col': 84, 'row': 1, 'value': 1.5021644571623038},
 {'col': 84, 'row': 2, 'value': 1.5021644571623038},
 {'col': 84, 'row': 3, 'value': 1.5021644571623038},
 {'col': 84, 'row': 4, 'value': 1.5021644571623038},
 {'col': 84, 'row': 5, 'value': 1.5021644571623038},
 {'col': 84, 'row': 6, 'value': 1.2183726274308753},
 {'col': 84, 'row': 7, 'value': 1.2183726274308753},
 {'col': 84, 'row': 8, 'value': 1.2183726274308753},
 {'col': 84, 'row': 9, 'value': 1.2183726274308753},
 {'col': 84, 'row': 10, 'value': 1.2183726274308753},
 {'col': 84, 'row': 11, 'value': 1.6556017737444797},
 {'col': 84, 'row': 12, 'value': 1.6556017737444797},
 {'col': 84, 'row': 13, 'value': 1.6556017737444797},
 {'col': 84, 'row': 14, 'value': 1.6556017737444797},
 {'col': 84, 'row': 15, 'value': 1.6556017737444797},
 {'col': 84, 'row': 16, 'value': 1.6275057024365636},
 {'col': 84, 'row': 17, 'value': 1.6275057024365636},
 {'col': 84, 'row': 18, 'value': 1.6275057024365636},
 {'col': 84, 'row': 19, 'value': 1.6275057024365636},
 {'col': 84, 'row': 20, 'value': 1.6275057024365636},
 {'col': 84, 'row': 21, 'value': 1.3900597630877156},
 {'col': 84, 'row': 22, 'value': 1.3900597630877156},
 {'col': 84, 'row': 23, 'value': 1.3900597630877156},
 {'col': 84, 'row': 24, 'value': 1.3900597630877156},
 {'col': 84, 'row': 25, 'value': 1.3900597630877156},
 {'col': 85, 'row': 1, 'value': 0.0},
 {'col': 85, 'row': 2, 'value': 0.0},
 {'col': 85, 'row': 3, 'value': 0.0},
 {'col': 85, 'row': 4, 'value': 0.0},
 {'col': 85, 'row': 5, 'value': 0.0},
 {'col': 85, 'row': 6, 'value': 0.0},
 {'col': 85, 'row': 7, 'value': 0.0},
 {'col': 85, 'row': 8, 'value': 0.0},
 {'col': 85, 'row': 9, 'value': 0.0},
 {'col': 85, 'row': 10, 'value': 0.0},
 {'col': 85, 'row': 11, 'value': 0.0},
 {'col': 85, 'row': 12, 'value': 0.0},
 {'col': 85, 'row': 13, 'value': 0.0},
 {'col': 85, 'row': 14, 'value': 0.0},
 {'col': 85, 'row': 15, 'value': 0.58322070118134106},
 {'col': 85, 'row': 16, 'value': 0.58322070118134106},
 {'col': 85, 'row': 17, 'value': 0.58322070118134106},
 {'col': 85, 'row': 18, 'value': 0.58322070118134106},
 {'col': 85, 'row': 19, 'value': 0.58322070118134106},
 {'col': 85, 'row': 20, 'value': 0.58322070118134106},
 {'col': 85, 'row': 21, 'value': 0.58322070118134106},
 {'col': 85, 'row': 22, 'value': 0.0},
 {'col': 85, 'row': 23, 'value': 0.0},
 {'col': 85, 'row': 24, 'value': 0.0},
 {'col': 85, 'row': 25, 'value': 0.0},
 {'col': 85, 'row': 26, 'value': 0.0},
 {'col': 85, 'row': 27, 'value': 0.0},
 {'col': 85, 'row': 28, 'value': 0.0},
 {'col': 85, 'row': 29, 'value': 0.0},
 {'col': 85, 'row': 30, 'value': 0.0},
 {'col': 85, 'row': 31, 'value': 0.0},
 {'col': 85, 'row': 32, 'value': 0.0},
 {'col': 85, 'row': 33, 'value': 0.0},
 {'col': 85, 'row': 34, 'value': 0.0},
 {'col': 85, 'row': 35, 'value': 0.0},
 {'col': 86, 'row': 1, 'value': 0.76160457537151494},
 {'col': 86, 'row': 2, 'value': 0.34848550181060606},
 {'col': 86, 'row': 3, 'value': 1.0715253954073061},
 {'col': 86, 'row': 4, 'value': 0.56078653091976094},
 {'col': 86, 'row': 5, 'value': 0.50323891735046222},
 {'col': 86, 'row': 6, 'value': 0.78691526285195812},
 {'col': 87, 'row': 1, 'value': 0.0},
 {'col': 87, 'row': 2, 'value': 0.078238003250631752},
 {'col': 87, 'row': 3, 'value': -0.14253062163276389},
 {'col': 87, 'row': 4, 'value': 0.21233333086192616},
 {'col': 87, 'row': 5, 'value': -0.35314404205889638},
 {'col': 87, 'row': 6, 'value': -0.32671400342553925},
 {'col': 88, 'row': 1, 'value': -0.46603391898205887},
 {'col': 88, 'row': 2, 'value': -0.46603391898205887},
 {'col': 88, 'row': 3, 'value': 0.43402017052543795},
 {'col': 88, 'row': 4, 'value': 0.43402017052543795},
 {'col': 88, 'row': 5, 'value': -0.21336650280029171},
 {'col': 88, 'row': 6, 'value': -0.21336650280029171},
 {'col': 88, 'row': 7, 'value': 0.60003358649378047},
 {'col': 88, 'row': 8, 'value': 0.60003358649378047},
 {'col': 88, 'row': 9, 'value': 0.58503287670549797},
 {'col': 88, 'row': 10, 'value': 0.58503287670549797},
 {'col': 88, 'row': 11, 'value': -0.62188009705464709},
 {'col': 89, 'row': 1, 'value': 1.5023804021394727},
 {'col': 89, 'row': 2, 'value': 1.0911948473402475},
 {'col': 89, 'row': 3, 'value': 1.5831226841145638},
 {'col': 89, 'row': 4, 'value': 0.93520276663207225},
 {'col': 89, 'row': 5, 'value': 1.0450532715735465},
 {'col': 89, 'row': 6, 'value': 1.3097102489371182},
 {'col': 90, 'row': 1, 'value': 1.6696935249985243},
 {'col': 90, 'row': 2, 'value': 1.2220739849823581},
 {'col': 90, 'row': 3, 'value': 1.5188784301750986},
 {'col': 90, 'row': 4, 'value': 0.88613663247841457},
 {'col': 90, 'row': 5, 'value': 1.086829813796963},
 {'col': 90, 'row': 6, 'value': 1.2062432249692816},
 {'col': 91, 'row': 1, 'value': 0.57803931344723902},
 {'col': 91, 'row': 2, 'value': 0.18673679526736442},
 {'col': 91, 'row': 3, 'value': 1.4896358398938263},
 {'col': 91, 'row': 4, 'value': 0.44975627807455126},
 {'col': 91, 'row': 5, 'value': 0.48706967237152832},
 {'col': 92, 'row': 1, 'value': 0.0},
 {'col': 92, 'row': 2, 'value': 0.0}]

In [8]:
catabolic_heatmap_diagram = HeatmapWidget(html_style=html_style,
                                row_labels=row_labels, 
                                col_labels=col_labels,
                                hcrow=hcrow,
                                hccol=hccol,
                                minval= min([x['value'] for x in heatmap_data]),
                                maxval= max([x['value'] for x in heatmap_data]),
                                heatmap_data=heatmap_data)
display(catabolic_heatmap_diagram)

In [ ]:
catabolic_genes = ome.query(GeneGroup).filter(GeneGroup.name.ilike('Glycero%')).first().genes
hcrow,hccol,row_labels,col_labels,heatmap_data = gene_heatmap(catabolic_genes, 
                                                              analysis_type=DifferentialGeneExpressionData,
                                                              strain2=ome.query(Strain).all(),
                                                              environments2=ome.query(InVivoEnvironment).all())

In [9]:
catabolic_heatmap_diagram = HeatmapWidget(html_style=html_style,
                                row_labels=row_labels, 
                                col_labels=col_labels,
                                hcrow=hcrow,
                                hccol=hccol,
                                minval= min([x['value'] for x in heatmap_data]),
                                maxval= max([x['value'] for x in heatmap_data]),
                                heatmap_data=heatmap_data)
display(catabolic_heatmap_diagram)

In [10]:
anabolic_genes = ome.query(GeneGroup).filter(GeneGroup.name.ilike('crp_anab%')).first().genes
hcrow,hccol,row_labels,col_labels,heatmap_data = gene_heatmap(anabolic_genes,dataset_type='rna_seq_experiment')

In [11]:
anabolic_heatmap_diagram = HeatmapWidget(html_style=html_style,
                                row_labels=row_labels, 
                                col_labels=col_labels,
                                hcrow=hcrow,
                                hccol=hccol,
                                minval= min([x['value'] for x in heatmap_data]),
                                maxval= max([x['value'] for x in heatmap_data]),
                                heatmap_data=heatmap_data)
display(anabolic_heatmap_diagram)

In [6]:
chemiosmotic_genes = ome.query(GeneGroup).filter(GeneGroup.name.ilike('crp_chemi%')).first().genes
chem_hcrow,chem_hccol,chem_row_labels,chem_col_labels,chem_heatmap_data = gene_heatmap(chemiosmotic_genes,dataset_type='rna_seq_experiment')

In [7]:
chem_heatmap_diagram = HeatmapWidget(html_style=html_style,
                                row_labels=chem_row_labels, 
                                col_labels=chem_col_labels,
                                hcrow=chem_hcrow,
                                hccol=chem_hccol,
                                minval= min([x['value'] for x in chem_heatmap_data]),
                                maxval= max([x['value'] for x in chem_heatmap_data]),
                                heatmap_data=chem_heatmap_data)
display(chem_heatmap_diagram)

In [ ]: