[Bioc-devel] GenomicRanges List subclass and apply
jfu14 @ending from jhu@edu
Mon May 14 16:56:19 CEST 2018
Mostly for sending each element of the GRanges object to a custom
function that runs an identical analysis on each element.
I have some functions that take as input a single range -> calculate
number of reads that overlap the range -> subset the range into K number
of segments based on coverage patterns across the range.
Michael Lawrence wrote:
> Just out of curiosity, why are you looping over a GRanges in the first place?
> On Mon, May 14, 2018 at 7:28 AM, Jack Fu<jfu14 at jhu.edu> wrote:
>> Hey all,
>> I think some of the recent changes to GRanges has affected using the
>> apply class functions with GRanges objects:
>> o GenomicRanges now is a List subclass. This means that GRanges objects
>> and their derivatives are now considered list-like objects (even though
>> [[ don't work on them yet, this will be implemented in Bioconductor 3.8).
>> The following code will throw:
>> gr<- GRanges(1, IRanges(1:2, 3:4))
>> sapply(gr, print)
>> Error in (function (classes, fdef, mtable) :
>> unable to find an inherited method for function 'getListElement' for
>> signature '"GRanges"'
>> Access using gr, gr[1:2] still works normally.
>> Are there any recommendations on a workaround for this issue without
>> resorting back to for loops?
>> Thanks all,
>> [[alternative HTML version deleted]]
>> Bioc-devel at r-project.org mailing list
[[alternative HTML version deleted]]
More information about the Bioc-devel