Search
Question: setdiff between GenomicRanges objects keeping metadata
0
gravatar for Benilton Carvalho
2.0 years 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 2.0 years ago by Michael Lawrence10k • written 2.0 years ago by Benilton Carvalho4.2k
2
gravatar for Michael Lawrence
2.0 years ago by
United States
Michael Lawrence10k 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 2.0 years ago by Michael Lawrence10k
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: 340 users visited in the last hour