setdiff between GenomicRanges objects keeping metadata
1
0
Entering edit mode
@benilton-carvalho-1375
Last seen 4.1 years ago
Brazil/Campinas/UNICAMP

Hi guys,

Given I have two objects as below:

mydata <- GRanges('chr9', IRanges(37902608, 69267842), info1=1, info2=2)
centromere <- GRanges('chr9', IRanges(46200000, 60800000))
setdiff(mydata, centromere)

 

How do I get the result of setdiff, but keeping the info1 and info2 fields from mydata?

Many thanks, benilton

 

 

genomicranges • 1.5k views
ADD COMMENT
2
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States

As with any set operation, it's not obvious how the metadata should propagate. One option would be to use findOverlaps(setdiff_result, mydata) and aggregate/join based on that.  I guess we could make this easier with a revmap. That's supported for reduce(), although in the case of intersect, union and setdiff, we could have two revmaps (one for each argument). 

ADD COMMENT

Login before adding your answer.

Traffic: 754 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