normalizeCoverage {MADSEQ} | R Documentation |
function to normalize coverage by GC content and quantile normalization
normalizeCoverage(object, ..., control = NULL, writeToFile = TRUE, destination = NULL, plot = TRUE)
object |
A |
... |
additional |
control |
A |
writeToFile |
|
destination |
A |
plot |
|
If writeToFile
is set to TRUE, normalized coverage will be
written to the destination
. Otherwise, a GRangesList
object containing each of input sample will be returned.
The normalize function works better when you have multiple samples sequenced using the same protocol, namely have the same targeted regions. And if you have female sample and male sample, the best way is to normalize them separately.
Yu Kong
C. Alkan, J. Kidd, T. Marques-Bonet et al (2009). Personalized copy number and segmental duplication maps using next-generation sequencing. Nature Genetics, 41(10):1061-7.
##------------------------------------ ##if you deal with single sample ##------------------------------------ ## 1. prepare coverage and gc ## specify the path to the location of bed file target = system.file("extdata","target.bed",package="MADSEQ") ## specify the path to the bam file aneuploidy_bam = system.file("extdata","aneuploidy.bam",package="MADSEQ") ## prepare coverage data for the aneuploidy sample aneuploidy_cov_gc = prepareCoverageGC(target,aneuploidy_bam,"hg19") ## normalize the coverage ##---- if not write to file ---- aneuploidy_norm = normalizeCoverage(aneuploidy_cov_gc,writeToFile=FALSE) ## check the GRangesList and subset your sample aneuploidy_norm names(aneuploidy_norm) aneuploidy_norm["aneuploidy_cov_gc"] ##---- if write to file ---- normalizeCoverage(aneuploidy_cov_gc,writeToFile=TRUE,destination=".") ##----------------------------------------------------------- ##if you deal with multiple samples without normal control ##----------------------------------------------------------- ## specify the path to the location of bed file target = system.file("extdata","target.bed",package="MADSEQ") ## specify the path to the bam file aneuploidy_bam = system.file("extdata","aneuploidy.bam",package="MADSEQ") normal_bam = system.file("extdata","normal.bam",package="MADSEQ") ## prepare coverage data for the samples aneuploidy_cov_gc = prepareCoverageGC(target,aneuploidy_bam,"hg19") normal_cov_gc = prepareCoverageGC(target,normal_bam,"hg19") ## normalize the coverage normed=normalizeCoverage(aneuploidy_cov_gc,normal_cov_gc,writeToFile=FALSE) names(normed) normed["aneuploidy_cov_gc"] normed["normal_cov_gc"] ## or normalizeCoverage(aneuploidy_cov_gc,normal_cov_gc, writeToFile=TRUE,destination=".") ##----------------------------------------------------------- ##if you deal with multiple samples with a normal control ##----------------------------------------------------------- ## specify the path to the location of bed file target = system.file("extdata","target.bed",package="MADSEQ") ## specify the path to the bam file aneuploidy_bam = system.file("extdata","aneuploidy.bam",package="MADSEQ") normal_bam = system.file("extdata","normal.bam",package="MADSEQ") ## prepare coverage data for the samples aneuploidy_cov_gc = prepareCoverageGC(target,aneuploidy_bam,"hg19") normal_cov_gc = prepareCoverageGC(target,normal_bam,"hg19") ## normalize the coverage normed = normalizeCoverage(aneuploidy_cov_gc, control=normal_cov_gc,writeToFile=FALSE) ## or normalizeCoverage(aneuploidy_cov_gc,control=normal_cov_gc, writeToFile=TRUE,destination=".")