Hello,
I'm trying to combine two GRangesList objects element-wise, to produce a single GRangesList.
gr1 <- GRanges(seqnames = "chr2", ranges = IRanges(3, 6)) gr2 <- GRanges(c("chr1", "chr1"), ranges = IRanges(c(7,13), width = 3)) grl <- GRangesList("gr1" = gr1, "gr2" = gr2) gr3 <- GRanges(seqnames = "chr2", ranges = IRanges(9, 12)) gr4 <- GRanges(c("chr1", "chr1"), ranges = IRanges(c(25,38), width = 3)) grl2 <- GRangesList("gr1" = gr1, "gr2" = gr2) grl3 <- GRangesList(c(gr1, gr3), c(gr2, gr4))
Based on the example above I want to combine grl and grl2 to produce grl3. My real use-case has lists of 20k elements each and I would like to be able to do this as efficiently as possible. I wrote a for loop to do this via repeated calls to c() on each GRanges element and dumping them into a new list, but this takes a long time to run on real data, and seems like there should be a better way to do this.
Thanks in advance.
Sergei.
What does 'pc()' stand for? it's completely cryptic to me!
That's bad. It stands for parallel combine, like
pmax()
andpmin()
.