def draw_heatmap(r2c2count, s2color, lowpoint, uppoint, outbase, names=None): if names is None: names = r2c2count.keys() rows = [] for r in names: row = [r2c2count[r][c] for c in names] rows.append(row) dcommon.draw_heatmap(names, names, rows, outbase, minval=lowpoint, maxval=uppoint, name2color=s2color, symm=True, rcluster=False, ccluster=False)
def run(self): # Get the matrix rows = statcommon.pair_matrix(self.names, self.names, self.pair2stat, self.attr) # Write to table tabfile = "%s.txt" % self.outbase tabcommon.matrix_table(self.names, rows, tabfile) # Make heatmap if self.opts.makeplots: plotfile = "%s.pdf" % self.outbase drawcommon.draw_heatmap(self.names, self.names, rows, plotfile)