3. genCov画每个突变位点附件的coverage,跟igv有点相似。
这个操作起来很复杂,但是图还是挺有用的。可以考虑。
由于我的reference genome build是hg38
BiocManager::install(c("TxDb.Hsapiens.UCSC.hg38.knownGene","BSgenome.Hsapiens.UCSC.hg38"))
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(BSgenome.Hsapiens.UCSC.hg38)
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
genome <- BSgenome.Hsapiens.UCSC.hg38
准备这样的数据:
如果有GATK depthOfCoverage的结果(如下图)可以根据interval 转化成上述的的结果。
代码:
gr <- GRanges(seqnames = c("chr10"), ranges=IRanges(start = c(89622195), end = c(89729532)),strand = strand(c("+")))
# Create Data for input
start <- c(89622194:89729524)
end <- c(89622195:89729525)
chr <- 10
cov <- c(rnorm(1e+05, mean = 40), rnorm(7331, mean = 10))
cov_input_A <- as.data.frame(cbind(chr, start, end, cov))
start <- c(89622194:89729524)
end <- c(89622195:89729525)
chr <- 10
cov <- c(rnorm(50000, mean = 40), rnorm(7331, mean = 10), rnorm(50000, mean = 40))
cov_input_B <- as.data.frame(cbind(chr, start, end, cov))
data <- list(`Sample A` = cov_input_A, `Sample B` = cov_input_B)
data
# Call genCov
genCov(data, txdb, gr, genome, gene_labelTranscriptSize = 2, transform = NULL, base = NULL)
genCov(data, txdb, gr, genome, transform = c("Intron", "CDS", "UTR"), base = c(10, 2, 2), reduce = TRUE)
图: