Dario Strbenac | 18 Jan 00:00 2013
Picon

Re: Transformation of Grange object to density per bin

Assuming that you are working with hg19,

library(BSgenome.Hsapiens.UCSC.hg19)

chrLengths <- seqlengths(Hsapiens)
chrLengths <- chrLengths[paste("chr", c(1:22, 'X', 'Y'), sep = '')]
Gcoverage <- coverage(testset.gr)

coverageMeans <- unlist(mapply(function(x, y) 
                 {
		 	starts = seq(1, y, 200)
			ends = starts + 199
                        mean(Views(start = starts, end = ends, subject = Gcoverage[[x]]), na.rm = TRUE)
                 }, names(chrLengths), chrLengths), use.names = FALSE)

> coverageMeans[51]
[1] 0.285
> coverageMeans[52]
[1] 0.765

_______________________________________________
Bioconductor mailing list
Bioconductor@...
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


Gmane