This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Find overlaps within a GRanges object

Hi,

I want to use a txdb annotation database to find out the genes that have no overlap with others. So I first get all genes locus:

library(GenomicFeatures)
txdb <- loadDb("gencode.v40.annotation.sqlite")
gene <- genes(txdb)
gene
## GRanges object with 2450 ranges and 1 metadata column:
##                      seqnames              ranges strand |            gene_id
##                         <Rle>           <IRanges>  <Rle> |        <character>
##   ENSG00000000003.15     chrX 100627108-100639991      - | ENSG00000000003.15
##    ENSG00000000005.6     chrX 100584936-100599885      + |  ENSG00000000005.6
##   ENSG00000001497.18     chrX   65438549-65534810      - | ENSG00000001497.18
##   ENSG00000002586.20     chrX     2691187-2741309      + | ENSG00000002586.20
##   ENSG00000003096.14     chrX 117897813-118117340      - | ENSG00000003096.14
##                  ...      ...                 ...    ... .                ...
##    ENSG00000289575.1     chrX   87723928-87728679      - |  ENSG00000289575.1
##    ENSG00000289591.1     chrX 146854539-146954956      + |  ENSG00000289591.1
##    ENSG00000289596.1     chrX   13085729-13086383      + |  ENSG00000289596.1
##    ENSG00000289620.1     chrX     1661815-1662306      + |  ENSG00000289620.1
##    ENSG00000289708.1     chrX   36984358-36984493      + |  ENSG00000289708.1
##   -------
##   seqinfo: 1 sequence from an unspecified genome; no seqlengths

Next, I want to find out which genes have no overlap with others. So the question becomes how to find ranges that overlap other ranges within gene GRanges object.

I can achieve this by using for looping, but it is too inefficient.

I would be thankful for any help to achieve this efficiently with a function or anything else!

peak overlap granges iranges r

Thanks for your reply!! And I have tried this package, but it does not solve my problem. So I adopt the inefficient ways to solve this problem.

0 answers

No answers yet.

Log in to answer this question.