# generate artificial reads coordinates on a chromosome
nbReads <- 1000000
chrLength <- 10000000
startPositions <- sample(1:chrLength, nbReads, replace=TRUE)
fragmentsLength <- trunc(rnorm(n=nbReads, mean=146, sd= 40))
strandAligned <- factor(sample(c('+','-'),
nbReads,
replace=TRUE),
levels=c('+', '-'))
readLength <- 36
weight <- 1
# compute the piled vector
res <- pileupDouble(start=startPositions,
fragLength=fragmentsLength,
dir=strandAligned,
readLength=readLength,
weight=weight)
# plot distribution of scores on the chromosome
hist(res)
Run the code above in your browser using DataLab