Entering edit mode
8.8 years ago
Jurat Shahidin
▴
100
Hi everyone: Is there any way to coerce simple list-like object to S4 "List" objects? I need to do some vectorization on my data. Apparently, I used nested-lapply on my functions, and I checked its return type as "list". I want "List" like objects. How can I do that? Thanks.
Here is the reproducible example to clarify the issue:
data
foo <- GRanges(
seqnames=Rle(c("chr1", "chr2", "chr3", "chr4"), c(3, 2, 1, 2)),
ranges=IRanges(seq(1, by=9, len=8), seq(7, by=9, len=8)),
rangeName=letters[seq(1:8)], score=sample(1:20, 8, replace = FALSE))
bar <- GRanges(
seqnames=Rle(c("chr1", "chr2", "chr3","chr4"), c(4, 3, 1, 1)),
ranges=IRanges(seq(2, by=5, len=9), seq(4, by=5, len=9)),
rangeName=letters[seq(1:9)], score=sample(1:20, 9, replace = FALSE))
moo <- GRanges(
seqnames=Rle(c("chr1", "chr2", "chr3","chr4"), c(3, 4, 2,1)),
ranges=IRanges(seq(5, by=7, len=10), seq(8, by=7, len=10)),
rangeName=letters[seq(1:10)], score=sample(1:20, 10, replace = FALSE))
I need let res_rm_multi_overlap as S4 "List" objects? Is that possible to do such coercion in R ? Any possible approach, solution, or idea are appreciated. Thanks
Best regards: Jurat