7.0 years ago by
I recently created a similar figure (not quite the same but the code should be adaptable I think) after using clover for TFBS enrichment analysis for a group of regulated genes. My code uses ggplot2 in R and plots each interaction (TF (y axis) - gene (x axis)) as a square with the number of hits for that TF in the promoter of the gene shown by the colour of the square.
You should be able to adapt the code to show distance from TSS for each gene pretty easily (just put different numbers in the relevant column which was Hits in my data)
p3 <- ggplot() + geom_point(data = tfHits, aes(symbol, TF, colour = Hits), shape=15, size = 4)
p3 <- p3 + scale_colour_gradient(low = "cornflowerblue", high = "firebrick") + opts(panel.background = theme_blank(), legend.position = "right", axis.title.x = theme_blank(), axis.title.y = theme_blank(), axis.text.x = theme_text(angle = 90, hjust=1, size=6), axis.text.y = theme_text(colour = "black"), axis.ticks = theme_blank())
The data - a dataframe with 3 columns: TF in first, gene (symbol) in second and distance to TSS in third. I would show an excerpt of my data but I can't work out how to get a 'table' into the text here - hey ho.
You can do a similar plot in ggplot2 with the 'tiles' geom:
p2 <- ggplot(tfHits, aes(TF, symbol)) + geom_tile(aes(fill=Hits))
p2 <- p2 + scale_fill_gradient2(name='Hits', low="#0571B0", mid="#F7F7F7", high="#CA0020", midpoint=20, trans="identity")
p2 <- p2 + labs(x = "TF", y = "Gene") + opts(axis.ticks = theme_blank(), axis.text.x = theme_text(size = 10, angle = 90, hjust = 1, colour = "grey25"), axis.text.y = theme_text(size=5, colour = 'gray25'))
Personally I prefer the squares. Of course this won't do any kind of clustering - I don't know if that's important to you but you could reorder the dataframe passed in by some dendrogram order etc etc.
modified 7.0 years ago
7.0 years ago by
Duff • 660