## generate some simple artificial read data
set.seed(1)
## determine binding site locations
b <- sample(1:1e6, 5000)
## sample read locations
fwd <- unlist(lapply(b, function(x) sample((x-83):(x-73), 20, replace=TRUE)))
rev <- unlist(lapply(b, function(x) sample((x+73):(x+83), 20, replace=TRUE)))
## add some background noise
fwd <- c(fwd, sample(1:(1e6-25), 50000))
rev <- c(rev, sample(25:1e6, 50000))
## create data.frame with read positions as input to strandPileup
reads <- data.frame(chromosome="chr1", position=c(fwd, rev),
length=25, strand=factor(rep(c("+", "-"), times=c(150000, 150000))))
## create object of class ReadCounts
readPile <- strandPileup(reads, chrLen=1e6, extend=1, plot=FALSE)
## predict binding site locations
bindScore <- simpleNucCall(readPile, bind=147, support=20, plot=FALSE)
Run the code above in your browser using DataLab