# Generate artificial wig fixed step files with random counts
exampleFolder <- tempdir()
nbFiles <- 3
nbChromosomes <- 4
for(fileIndex in 1:nbFiles)
{
wigScoresContent <- lapply(as.list(1:nbChromosomes),
function(x) {sample(x=1:20, size=1000, replace=TRUE, prob=NULL)})
names(wigScoresContent) <- paste("chr", 1:nbChromosomes, sep="")
writeWIG(wigScoresContent,
paste("wigFileExample", fileIndex, sep=""),
folder=exampleFolder,
fixedStep=200)
}
# Build a file list containing wig files to merge together, and a reference
# to the file to be used as input for score subtraction
wigFileList <- file.path(exampleFolder,
paste("wigFileExample",
1:(nbFiles-1),
".wig",
sep=""))
inputFile <- file.path(exampleFolder,
paste("wigFileExample",
nbFiles,
".wig",
sep=""))
# Run the merge function on 'wigFileList' which will rescales the scores and
# then subtract the wig scores used as input experiment (rescaled too).
normAndSubtractWIG(wigFileList,
inputFile,
rescaleInput=TRUE,
meanBGLevelRescale=c(0,10),
subtractInput=TRUE,
binSize=200)
Run the code above in your browser using DataLab