Off topic:Any way coercing simple "list" to S4 "List" objects in R (with reproducible example)?
0
0
Entering edit mode
7.8 years ago

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

S4 coercion data manipulation List • 2.6k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2949 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6