0

I want to compare and get the overlapping regions in three different dataset. The comparison should also be based on the CNA.

 data1
      chr start         end       CNA
        1   170900001   171500001   loss
        1   11840001    19420001    loss
        1   60300001    62700001    gain
        1   25520001    25820001    gain

data2
    chr  start       end        CNA
    1   170940001   171500001   gain
    1   60300001    62700001    gain
    1   25520001    25840001    gain
    1   119860001   123040001   loss
    1   171500001   171580001   gain
    1   79240001    84420001    gain


data 3
chr  start       end        CNA
1   170950001   171500001   gain
1   60300001    62700001    loss
1   25530001    25840001    gain

expected output

   chr  start       end        CNA
    1   170950001   171500001   gain
    1   25530001    25840001    gain

I used GenomicRanges for the comparison. First i tried to sort the genomic regions based on the "gain" and "loss". Then i used findOverlaps between each group separately for eg. df1 <- findOverlaps(data1,data2) and then findOverlaps(df1,data3). I know there are options bed tools but would be great to know if there is any alternative methods in getting the desired output using GenomicRanges?

beginner
  • 411
  • 1
  • 5
  • 13
  • If you're looking for expert help with GenomicRanges, please consider asking your question instead on the [Bioconductor support site](https://support.bioconductor.org). I think the answer is just what I think you are doing -- `findOverlaps()` for data1 and data2, then the result of that and data3. – Martin Morgan Apr 15 '15 at 18:57
  • Does [this SO answer](http://stackoverflow.com/questions/23331475/r-overlap-multiple-granges-with-findoverlaps) solve your problem? – eipi10 Apr 15 '15 at 19:09

1 Answers1

0

I did ask a similar question several days ago. You don't mention whether GenomicRanges worked for you or not. I found that the library IRange did work much better for me. Maybe my approach can be useful for you

Community
  • 1
  • 1