Search
Question: how to extract Granges not overlapping with other ganges?
1
gravatar for vinod.acear
3.0 years ago by
vinod.acear30
India
vinod.acear30 wrote:

Hi

  i Have two granges (gr1 and gr2) and i want to extract granges from gr2 that are not overlapping with  gr1. Please tell me the possible way to do it

ADD COMMENTlink modified 3.0 years ago by James W. MacDonald48k • written 3.0 years ago by vinod.acear30
1

Note that you already asked this 5 weeks ago here Non overlapping granges (or opposite of subsetByOverlaps) and got the same answer.

H.

ADD REPLYlink written 3.0 years ago by Hervé Pagès ♦♦ 13k
4
gravatar for James W. MacDonald
3.0 years ago by
United States
James W. MacDonald48k wrote:
> gr1 <- GRanges("chr1", IRanges(c(1,3,5), c(8,9,15)))
> gr2 <- GRanges("chr1", IRanges(c(1,3,5,17), c(8,9,17,35)))
> gr2[!gr2 %over% gr1,]
GRanges object with 1 range and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]     chr1  [17, 35]      *
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
ADD COMMENTlink written 3.0 years ago by James W. MacDonald48k
1

Also can use %outside% here instead of negating %over%.

ADD REPLYlink written 3.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: 320 users visited in the last hour