Question: Split a GRanges into one GRanges per chromosome/strand pair and put in GRangesList?
0
gravatar for endrebak852
16 months ago by
endrebak852100
github.com/endrebak
endrebak852100 wrote:

I want to find the coverage for each chromosome/strand pair, but unfortunately, the coverage-function takes no ìgnore.strand=FALSE` argument. Therefore I want to split a GRanges into the constituent chromosome/strand pairs and run coverage on the GRangesList. How do I do that?

Example data:

library(GenomicRanges)
gr <- GRanges( seqnames=Rle(c("chr1", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)),
ranges=IRanges(1:10, end=10),
strand=Rle(strand(c("-", "+", "*", "+", "-")), c(1, 2, 2, 3, 2)),
seqlengths=c(chr1=11, chr2=12, chr3=13))
genomicranges • 488 views
ADD COMMENTlink modified 16 months ago by ATpoint31k • written 16 months ago by endrebak852100
1
gravatar for ATpoint
16 months ago by
ATpoint31k
Germany
ATpoint31k wrote:

There is no need to use GRangesList() as the coverage() collapses the list to a normal GRanges() anyway. Therefore, simply split by strand (not discussing now if the definition of coverage in a strand-specific manner makes sense or not):

coverage(gr[gr@strand == "+"])
coverage(gr[gr@strand == "-"])
ADD COMMENTlink modified 16 months ago • written 16 months ago by ATpoint31k

Then I cannot do RleList1 - RleList2, but thanks :)

ADD REPLYlink written 16 months ago by endrebak852100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1696 users visited in the last hour