#NEWLINE# def heatmap( self , plotfile ) : #NEWLINE# #INDENT# ' plots a heatmap ' #NEWLINE# plotHeatmap = R ( ( '\n        function(df){\n\n        library("Biobase")\n        library("RColorBrewer")\n        library("gplots")\n\n        hmcol <- colorRampPalette(brewer.pal(9, "GnBu"))(100)\n        png("%(plotfile)s", width=1000, height=1000, units="px")\n        write.table(df, file="%(plotfile)s.tsv", sep="\t")\n        heatmap.2(as.matrix(df),\n                  col = hmcol, scale="none", trace="none", margin=c(18, 10),\n                  dendrogram="column", cexCol=2,\n                  labRow = "",\n                  hclustfun = function(x) hclust(x, method = \'average\'),\n                  distfun = function(x) as.dist(1 - cor(t(x), method="spearman")))\n        dev.off()\n        }' % locals ( ) ) ) #NEWLINE# r_counts = pandas2ri . py2ri ( self . table ) #NEWLINE# plotHeatmap ( r_counts )