I am trying to combine several grange objects in R using the reduce() function. I already have the grange objects stored in a list, but I can't figure out how to pass the list onto the reduce function.

I have tried

reduce(x = granges))
reduce(x = unlist(granges))
reduce(x = c(unlist(granges)))

but all of these output:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'reduce' for signature '"list"'

So it seems the object still remains a list. So far only

reduce(x = c(granges[[1]],granges[[2]],granges[[3]])))

works. I suspect that there should be a simpler way that I'm just unfamiliar with. Thanks for any help.

0

There are 0 best solutions below