Overlapping Ranges within Granges object
2
0
Entering edit mode
6 months ago
ntsopoul ▴ 60

Hi,

I have designed a Crispr library with dual guide RNAs flanking specific genomic regions. I used crisprDesign to do this.

I have now too many gRNA pairs targeting the same region. I have the data as GRanges objects.

Is there a way to filter the IRanges in a Granges object for non-overlapping regions or at least allow 10% overlap? I tried findOverlaps but with no avail.

Genomicranges IRanges GRanges • 1.1k views
ADD COMMENT
0
Entering edit mode
6 months ago

If you're not tied to Granges, you could use bedmap --fraction-both 0.1 to require at least 10% overlap between reference and map regions. Then use the bedops --not-element-of operation to get all elements not in this overlap set (i.e., regions not overlapping or having up to 9.99999% overlap).

ADD COMMENT
0
Entering edit mode

does this work with a single .bed file?

ADD REPLY
0
Entering edit mode

Yes, bedmap will perform operations on one or two BED files.

ADD REPLY
0
Entering edit mode
6 months ago
ATpoint 85k

There is no one-hit function in GenomicRanges, but you can stick something together using a combination of findOverlaps to first find overlaps and then pintersect + width to count the bases that overlap. THen you just need to do a calculation to put the overlap with in relation to some reference width to get a percentage:

a <- GRanges(seqnames = "chr1", ranges = IRanges(start=c(1, 20), end=c(10, 200)))
b <- GRanges(seqnames = "chr1", ranges = IRanges(start=c(5, 500), end=c(10, 1000)))

fo <- findOverlaps(a, b)
> fo
Hits object with 1 hit and 0 metadata columns:
      queryHits subjectHits
      <integer>   <integer>
  [1]         1           1
  -------
  queryLength: 2 / subjectLength: 2

wi <- width(pintersect(a[from(fo)], b[to(fo)]))
6
ADD COMMENT
0
Entering edit mode

I have one Granges object and not two. Every IRanges entry is the critical region of the gRNA. Can this still work?

ADD REPLY
1
Entering edit mode

I would probably collapse overlapping regions with reduce to create the second GRanges. Can you add some representative data? Using dput?

ADD REPLY
0
Entering edit mode

enter image description hereHere is some representative data and an image in igv of one gene. I have loaded the .bed file in igv. As you can see I have many regions that are overlapping, however, I just need one gRNA pair to cover a stratech of the genomic region. I would like to filter the bed file for one of this blocks and remove the rest that overlap. Ideally, I would like to have some minor overlap but this is not so important at the moment.

GRanges object with 1467 ranges and 0 metadata columns:
         seqnames            ranges strand
            <Rle>         <IRanges>  <Rle>
     [1]     chr2 90735572-90736199      -
     [2]     chr2 90735560-90736199      +
     [3]     chr2 90735621-90736199      -
     [4]     chr2 90735659-90736260      +
     [5]     chr2 90735572-90736243      -
     ...      ...               ...    ...
  [1463]     chr2 90738687-90739243      -
  [1464]     chr2 90738669-90739243      +
  [1465]     chr2 90738692-90739243      +
  [1466]     chr2 90738693-90739243      +
  [1467]     chr2 90738728-90739243      -
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
ADD REPLY
0
Entering edit mode

you are on to something… if I use reduce to find the “overlaping regions” in a secon GRanges object, what do I do next?

ADD REPLY

Login before adding your answer.

Traffic: 1516 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6