Martin, thanks for the input and suggestion about views, that's very helpful to know.
Andrew On Wed, Jun 23, 2010 at 6:55 PM, Martin Morgan <[email protected]> wrote: > Hi Andrew -- > > On 06/23/2010 02:02 PM, Andrew Yee wrote: > > Hi, I'm trying to figure out the coverage for a specific range. > > > > Take for example, > > > > r <- IRanges(start = c(30, 60, 70, 100), width = c(20, 18, 20, 18)) > > > > I'm interested in the coverage from positions 60 to 65, which in this > case > > is 1. I'm also interested in the coverage say from positions 68 to 73, > > which goes from 1 to 2. > > > > While I can use coverage(r) and then use runLength() and runValue() to > > ultimately extract this information, is there a way to use coverage so > that > > you can directly specify the positions of interest? > > One possibility is to create views onto your coverage vector > > r <- IRanges(start = c(30, 60, 70, 100), width = c(20, 18, 20, 18)) > roi = IRanges(c(60, 68), width=5) ## 'regions of interest' > v = Views(coverage(r), roi) > > and then do all sorts of fun things, like home movies > > for (i in seq_len(length(v))) plot(as.integer(v[[i]]), type="l") > > Martin > > > > > Thanks, > > Andrew > > > >> sessionInfo() > > R version 2.11.0 (2010-04-22) > > x86_64-unknown-linux-gnu > > > > locale: > > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > > [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 > > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > > [9] LC_ADDRESS=C LC_TELEPHONE=C > > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] IRanges_1.6.0 > > > > loaded via a namespace (and not attached): > > [1] tools_2.11.0 > > > > [[alternative HTML version deleted]] > > > > _______________________________________________ > > Bioc-sig-sequencing mailing list > > [email protected] > > https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing > > > -- > Martin Morgan > Computational Biology / Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. > PO Box 19024 Seattle, WA 98109 > > Location: Arnold Building M1 B861 > Phone: (206) 667-2793 > [[alternative HTML version deleted]] _______________________________________________ Bioc-sig-sequencing mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
