Tuesday, November 27, 2012

HeatMaps with R (Chip-Seq)

In order to create a heatmap of tag counts from chip-seq data using R first generate the data matrix using Homer's annotatePeak.pl

annotatePeaks.pl TSS_hg19_8kb.bed hg19 -hist 100 -ghist -d TagDirectory > output

where 'tss_hg19_8kb.bed' is the location plus minus 8kb surround the tss of all refseq genes downloaded from UCSC table browser.

Next import data in R.

Set color: 

hmcols<-colorRampPalette(c("white","red"))(256)

Create heatmap:

 pheatmap(test,color=hmcols,cluster_rows=TRUE,cluster_cols=FALSE,legend=FALSE,show_rownames=FALSE,show_colnames=FALSE)
  
note: the original heatmap() function in R does a scaling on the values resulting in scaled representation of values.
note: labRow="" and labCol="" gets rid of the x-axis and y-axis labels.
note: scale="row"  scales data by row.



No comments:

Post a Comment