[Bioc-devel] Subsetting Lists by Lists

Tim Triche, Jr. tim.triche at gmail.com
Tue Apr 1 19:40:31 CEST 2014


Hi all,

The following is tangentially related, but hopefully the answer will be useful to others (both directly and via my package, which prompts this)...

Suppose I do this:

dat <- GRangesList( 
lapply( bigWigFileNames, import, 
            selection=someRanges ) )

Now I have a GRangesList of values, some of which have 0 ranges, some of which may have hundreds or thousands. I would like to aggregate and smooth over various subgroups of these for Gviz/trackViewer plots, so I was thinking of getting an RleList or similar out of the mcols() from each of the GRangesList atoms. 

However,

1) What is the "right" (fast, idiomatic, future-safe) way to extract and combine these ranges into columns of Rles might be.  I found something not-dissimilar in SpliceGraphs (or was it spliceGrapher?) but I imagine this is a common operation with some efficient "one true way" to do it. 

2) should I be sucking these into a genoset or SummarizedExperiment instead?  I'll take the hit if I have to, once, but I don't want it to eat up all available RAM since I eventually wish to make the plotting process at least somewhat interactive (even if that means calling IGV or interactiveDisplay to do it). 

Thanks for any guidance you may have to offer,

--t

> On Apr 1, 2014, at 7:21 AM, Michael Lawrence <lawrence.michael at gene.com> wrote:
> 
> Mostly to Herve:
> 
> Sometimes we want to pluck the first 1, or 10, or whatever elements from
> each element of a list. If I had a list 'x', I thought I could do this with:
> 
> x[IntegerList(1:5)]
> 
> But it only gives elements 1:5 from x[[1]], not each element of 'x'. In
> other words, I thought the index would be repped out. Instead, 'x' is
> subset to the length of 'i', and I'm not sure if that makes sense?
> 
> But maybe what we really want are pluckHead/Tail, which would be robust to
> the case that < n elements are in an element. And of course a more general
> pluck(x, i) to select 'i' from each element, but I wanted the line above to
> do that.
> 
> Michael
> 
>    [[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



More information about the Bioc-devel mailing list