sampleReads: Sampling sequence read positions from a read density.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/nucSim.R

Description

Given a read density this function returns the starting positions of sequence reads.

Usage

1
sampleReads(readDens, nreads = 6e+06, strandProb = c(0.5, 0.5))

Arguments

readDens

A two column matrix of read densities (as produced by bindDens2readDens).

nreads

Number of read positions to generate.

strandProb

A numeric vector with two elements giving weights for forward and reverse strand.

Details

The expected number of reads for each strand is strandProb * nreads.

Value

A list with components fwd and rev giving the read positions on the forward and reverse strand respectively.

Author(s)

Peter Humburg

See Also

bindDens2readDens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

ChIPsim documentation built on Nov. 8, 2020, 8:09 p.m.