Search
Question: setdiff between GenomicRanges objects keeping metadata
0
gravatar for Benilton Carvalho
21 months ago by
Brazil/Campinas/UNICAMP
Benilton Carvalho4.2k wrote:

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

 

 

ADD COMMENTlink modified 21 months ago by Michael Lawrence10.0k • written 21 months ago by Benilton Carvalho4.2k
2
gravatar for Michael Lawrence
21 months ago by
Michael Lawrence10.0k
United States
Michael Lawrence10.0k wrote:

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 COMMENTlink written 21 months ago by Michael Lawrence10.0k
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.2.0
Traffic: 327 users visited in the last hour