ChIPseeker
ChIPseeker copied to clipboard
change the method of plotting heatmap
This pr change the way of plotting heatmap from base system to ggplot system. It adds the function of gradient color by giving palette
parameter, which is the palette of gradient color.
There are two ways to plot the heatmap. The first is giving a created matrix to tagHeatmap()
fucntion.
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
files <- getSampleFiles()
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
mt <- getTagMatrix(peak = files[[5]],TxDb = txdb,
upstream = 1000,downstream = 1000,
type = "start_site",by = "gene",
weightCol = "V5")
tagHeatmap(mt)
The second is to use
peakHeatmap()
to do all things in one steps.
peakHeatmap(files[[4]],TxDb = txdb)
If users wanna to speed up the process, a binning method can be used by specifing the nbin
.
peakHeatmap(files[[4]],TxDb = txdb, nbin = 800)
Since this method use ggplot system, users can use ggplot method to change
peakHeatmap(files[[4]],TxDb = txdb, nbin = 800) +
scale_fill_distiller(palette = "RdYlGn")
a list of peaks can also be plotted.
peakHeatmap(files,TxDb = txdb)
Update the function to plot the heatmap around the gene body regions
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
# plot body region
peakHeatmap(peak = files[[4]],
TxDb = txdb,
upstream = NULL,
downstream = NULL,
by = "gene",
type = "body",
nbin = 800)
# extend body region with rel object
peakHeatmap(peak = files[[4]],
TxDb = txdb,
upstream = rel(0.2),
downstream = rel(0.2),
by = "gene",
type = "body",
nbin = 800)
# extend body region with actual number
peakHeatmap(peak = files[[4]],
TxDb = txdb,
upstream = 1000,
downstream = 1000,
by = "gene",
type = "body",
nbin = 800)
Can we plot heatmaps with different gene sets? like the plots with genesX and gene19 in deeptools).
txdb1 <- transcripts(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb2 <- unlist(fiveUTRsByTranscript(TxDb.Hsapiens.UCSC.hg19.knownGene))
txdb <- list(gene19 = txdb1, geneX = txdb2)
peakHeatmap_multiple_Sets(peak = files[[4]],
upstream = 1000,downstream = 1000,
by = c("gene19","geneX"),
type = "start_site",
TxDb = txdb,nbin = 800)
sample <- list(files[[4]],files[[5]])
peakHeatmap_multiple_Sets(peak = files[4:5],
upstream = 1000,
downstream = 1000,
by = c("gene19","geneX"),type = "start_site",
TxDb = txdb,nbin = 800)
the proportion of picture can be adjusted automactically
txdb1 <- transcripts(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb2 <- unlist(fiveUTRsByTranscript(TxDb.Hsapiens.UCSC.hg19.knownGene))[1:10000,]
txdb <- list(gene19 = txdb1, geneX = txdb2)
peakHeatmap_multiple_Sets(peak = files[[4]],
upstream = 1000,downstream = 1000,
by = c("gene19","geneX"),
type = "start_site",
TxDb = txdb,nbin = 800)
Can we plot heatmaps with different gene sets? like the plots with genesX and gene19 in deeptools).
peak_Profile_Heatmap
function is also created to meet the need of ploting profiling plot and heatmap together, just like deeptools output.
peak_Profile_Heatmap(peak = files[[4]],
upstream = 1000,
downstream = 1000,
by = "gene",
type = "start_site",
TxDb = txdb3,
nbin = 800)
peak_Profile_Heatmap(peak = files[[4]],
upstream = 1000,
downstream = 1000,
by = c("gene19","geneX"),
type = "start_site",
TxDb = txdb,nbin = 800)
peak_Profile_Heatmap(peak = files[4:5],
upstream = 1000,
downstream = 1000,
by = c("gene19","geneX"),
type = "start_site",
TxDb = txdb,nbin = 800)