For now, just coerce to a RangesList.

z [ as(myRange, "RangesList") ]

Herve might consider adding a [,List,GenomicRanges method... kind of a
logical leap though from seqnames to list element names.

extractCoverageForPositions is different; it extracts an integer vector
given a vector of width-one positions.






On Tue, Dec 3, 2013 at 4:53 PM, Janet Young <jayoung@fhcrc.org> wrote:

> Hi there,
>
> I'm playing around with coverage data generated outside of R, planning to
> plot RNA-seq coverage for some genes we're interested in.
>
> I have a request - it'd be nice from my point of view if it were possible
> to look at a small region an RleList (or CompressedRleList) using a GRanges
> object to focus on that smaller region.  Looks like I can subset a single
> Rle object with an IRanges object, but I wonder if this nice feature could
> be extended to GRanges objects?
>
> Some code is below to show what I'm trying to do.
>
> thanks veruy much,
>
> Janet
>
>
>
> library(GenomicRanges)
>
> ## an example RleList
> x <- Rle(10:1, 1:10)
> y <- Rle(10:1, 1:10)
> z <- RleList( chr1=x, chr2=y)
>
> ## an example GRanges object
> myRange <- GRanges( seqnames="chr1", ranges=IRanges(start=10,end=15) )
>
> ## subsetting an Rle using an IRanges object works, as expected:
> z[["chr1"]] [ ranges(myRange) ]
>
> ## but subsetting an RleList by GRanges object doesn't work
> z [ myRange ]
> # Error in normalizeSingleBracketSubscript(i, x) : invalid subscript type
>
> sessionInfo()
>
> R Under development (unstable) (2013-11-06 r64163)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> 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=en_US.UTF-8    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] parallel  stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
> [1] GenomicRanges_1.15.10 XVector_0.3.2         IRanges_1.21.13
> [4] BiocGenerics_0.9.1
>
> loaded via a namespace (and not attached):
> [1] stats4_3.1.0
>
>
>
>
> -------------------------------------------------------------------
>
> Dr. Janet Young
>
> Malik lab
> http://research.fhcrc.org/malik/en.html
>
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Avenue N., A2-025,
> P.O. Box 19024, Seattle, WA 98109-1024, USA.
>
> tel: (206) 667 4512
> email: jayoung  ...at...  fhcrc.org
>
> -------------------------------------------------------------------
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

