sampleReads {ChIPsim} | R Documentation |
Given a read density this function returns the starting positions of sequence reads.
sampleReads(readDens, nreads = 6e+06, strandProb = c(0.5, 0.5))
readDens |
A two column matrix of read densities (as produced by |
nreads |
Number of read positions to generate. |
strandProb |
A numeric vector with two elements giving weights for forward and reverse strand. |
The expected number of reads for each strand is strandProb * nreads
.
A list with components fwd
and rev
giving the read positions on the
forward and reverse strand respectively.
Peter Humburg
set.seed(1) ## generate a (relatively short) sequence of nucleosome features features <- placeFeatures(start=200, length=1e5) ## calculate feature density featureDens <- feat2dens(features, length=1e5) ## convert to read density readDens <- bindDens2readDens(featureDens, fragDens, meanLength=160) ## sample reads ## of course you would usually want a much larger number readPos <- sampleReads(readDens, nreads=1000)