[BioC] Genomic Ranges. Ignore strandedness in findOverlap function.
Steve Lianoglou
mailinglist.honeypot at gmail.com
Fri Jan 6 22:41:45 CET 2012
Hi Fahim,
On Fri, Jan 6, 2012 at 4:08 PM, Fahim Mohammad <fahim.md at gmail.com> wrote:
> Hi
> findOverlap function depends on the 'strand'edness of the subject and
> query. In the example below, I am using findOverlap function to find
> overlapping ranges. Is there a way to completely ignore this feature and
> report all overlaps.
[snip]
Do this in your R workspace:
R> library(GenomicRanges)
R> getMethod('findOverlaps', c("GenomicRanges", "GenomicRanges"))
And notice that the findOverlaps method when called on GenomicRanges
objects has an `ignore.strand` argument that you can set to TRUE to
get what you are want, so, do:
R> o <- findOverlaps(grQuery, grSubject, ignore.strand=TRUE)
HTH,
-steve
> grSubject <-
> GRanges(
> seqnames =Rle(rep("chr1", 7)),
> ranges = IRanges(c(1,5,15,22,5,15,22),c(11,8,20,30,8,17,25)),
> strand = Rle(strand(c("-", rep("+",6)))),
> name = c('a', 'b','b','b','c','c','c')
> )
>> grSubject
> GRanges with 7 ranges and 1 elementMetadata value:
> seqnames ranges strand | name
> <Rle> <IRanges> <Rle> | <character>
> [1] chr1 [ 1, 11] - | a
> [2] chr1 [ 5, 8] + | b
> [3] chr1 [15, 20] + | b
> [4] chr1 [22, 30] + | b
> [5] chr1 [ 5, 8] + | c
> [6] chr1 [15, 17] + | c
> [7] chr1 [22, 25] + | c
> ---
> seqlengths:
> chr1
> NA
>
>
> grQuery <-
> GRanges(
> seqnames =Rle(rep("chr1", 3)),
> ranges = IRanges(c(6,14,22),c(10,16,27)),
> strand = Rle(strand(rep("-",3))),
> name = c('x', 'y','z')
> )
>> grQuery
> GRanges with 3 ranges and 1 elementMetadata value:
> seqnames ranges strand | name
> <Rle> <IRanges> <Rle> | <character>
> [1] chr1 [ 6, 10] - | x
> [2] chr1 [14, 16] - | y
> [3] chr1 [22, 27] - | z
> ---
> seqlengths:
> chr1
> NA
>
> as.matrix(findOverlaps(grQuery, grSubject))
> query subject
> [1,] 1 1
>
>
> When I change the strand of the query like this:
> grQuery <-
> GRanges(
> seqnames =Rle(rep("chr1", 3)),
> ranges = IRanges(c(6,14,22),c(10,16,27)),
> strand = Rle(strand(c("-", rep("+",2)))),
> name = c('x', 'y','z')
> )
>
> I get
>> as.matrix(findOverlaps(grQuery, grSubject))
> query subject
> [1,] 1 1
> [2,] 2 3
> [3,] 2 6
> [4,] 3 4
> [5,] 3 7
>>
>
>
> Thanks
>
> Fahim
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the Bioconductor
mailing list