The way to reach the goal of scaled genes is to devide gene in the same amounts of boxes. Because the amount of boxes is equal, the gene can be thought of scaling to equal length.
So three parameters( scaledlength , binsize, box) is set to reach this goal.
The first is scaledlength.the parameter represents the length of different genes are scaled to. For example, if we want to scale the TSS region(-3k,3k) and we set scaledlength=8000. Then the 6k bp region will be scaled to 8k bp.
The second parameters is binsize. The parameter represents the amount of the amount of nucleotide base in each box.
The third parameters is box. The parameter represents the amount of boxes.
Here is an example to illustrate the function.
scaledlength = 8000
binsize = 50
box = 8000/50 = 160
gene1:
genebodylength = 3200, box =160, so each box has 3200/160= 20 bp.
This means 20 bp is extended to 50 bp(binsize)
gene2:
genebodylength = 9600, box =160, so each box has 9600/160= 60 bp.
This means 60 bp is cut to 50 bp(binsize)
In this way, all the genes having different lengths are scaled to the same size.
plotGeneBody2(peak, type = "promoters",
conf = 0.95, TxDb = txdb)
![plotgenebody2](https://user-images.githubusercontent.com/78794151/128011410-14be6445-741d-4710-a6b3-84b646d00c75.png)
3. compare `plotAvgProf2()` and `plotGeneBody2` to draw a list of peaks
use plotGeneBody2 to draw a list of the TSS region
![plotgenebody_list](https://user-images.githubusercontent.com/78794151/128011621-5c5fb231-aeaf-4522-badd-f93b77d2936a.png)
4. the usage of ploting gene body
this is to draw the genebody
set the scaledlength = 8777 is to test this function
This pull request is to add the function of plot gene body. The basic idea is to scaled the genes having different lengths to the equal length, the idea was derived from the function of deeptools. (https://deeptools.readthedocs.io/en/develop/content/tools/computeMatrix.html)
The way to reach the goal of scaled genes is to devide gene in the same amounts of boxes. Because the amount of boxes is equal, the gene can be thought of scaling to equal length. So three parameters(
scaledlength
,binsize
,box
) is set to reach this goal.The first is
scaledlength
.the parameter represents the length of different genes are scaled to. For example, if we want to scale the TSS region(-3k,3k) and we setscaledlength=8000
. Then the 6k bp region will be scaled to 8k bp.The second parameters is
binsize
. The parameter represents the amount of the amount of nucleotide base in each box.The third parameters is
box
. The parameter represents the amount of boxes.Here is an example to illustrate the function.
The usage and testing of the function lay below.
plotAvgProf()
andplotGeneBody()
library(ChIPseeker) library(TxDb.Hsapiens.UCSC.hg19.knownGene) txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
files <- getSampleFiles() peak <- files[[4]]
promoter <- getPromoters(TxDb=txdb, upstream=3000, downstream=3000)
genebody <- getGeneBody(TxDb = txdb, type = "gene")
use plotAvgProf() to draw the TSS region
tagmatrix <- getTagMatrix(peak, weightCol = "V5", windows = promoter) plotAvgProf(tagmatrix, xlim = c(-3000,3000),conf = 0.95)
use plotGeneBody to draw the TSS region
bodymatrix <- getGenebodyMatrix(peak, weightCol = "V5", windows = promoter, scaledlength = 8000, binsize = 50, min_body_length = 1000) plotGeneBody(bodymatrix,conf = 0.95, scaledlength = 8000,binsize = 50)
use plotAvgProf2 to draw the TSS region
plotAvgProf2(peak, TxDb=txdb, upstream=3000, downstream=3000, conf = 0.95)
use plotGeneBody2 to draw the TSS region
plotGeneBody2(peak, type = "promoters", conf = 0.95, TxDb = txdb)
use plotGeneBody2 to draw a list of the TSS region
plotAvgProf2(files,TxDb = txdb, upstream = 3000, downstream = 3000, conf = 0.95,facet = "row")
use plotGeneBody2 to draw a list of the TSS region
plotGeneBody2(files, type = "promoters", conf = 0.95,facet = "row", TxDb = txdb)
this is to draw the genebody
set the scaledlength = 8777 is to test this function
genebodymatrix <- getGenebodyMatrix(peak,weightCol = "V5", windows = genebody, scaledlength = 8777, binsize = 55)
plotGeneBody(gebodymatrix, conf=0.95, scaledlength = 8777, binsize = 55)