[BioC] Minimal region of overlap between two GRanges objects

Martin Morgan mtmorgan at fhcrc.org
Tue Dec 13 17:49:49 CET 2011


On 12/13/2011 07:00 AM, Daniel Brewer wrote:
> Dear mailing list,
>
> I have two GRanges objects each containing segments of copy number
> change for a tumour.  I would like to find regions where there is
> copy number change in both the tumours.  I though findOverlaps was
> giving me what I wanted but soon found that findOverlaps(A,B) !=
> findOverlaps(B,A).  I am sure there must be a reasonable way to do
> this but I cannot find it.

Hi Dan --

 > a = GRanges("chrA", IRanges(11, 20), seqlengths=c(chrA=100))
 > b = GRanges("chrA", IRanges(16, 25), seqlengths=c(chrA=100))
 > intersect(a, b)
GRanges with 1 range and 0 elementMetadata values:
       seqnames    ranges strand
          <Rle> <IRanges>  <Rle>
   [1]     chrA  [16, 20]      *
   ---
   seqlengths:
    chrA
     100

but maybe a working example from your end would help clarify what you're 
after / where things go wrong for you with findOverlaps.

Martin

>
> Thanks
>
> Dan
>


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioconductor mailing list