[BioC] unimplemented options select=last and select=arbitrary in findOverlaps for GRanges

Janet Young JAYOUNG at FHCRC.ORG
Fri Dec 9 03:23:10 CET 2011


Hi there,

I'm using findOverlaps on GRanges objects and am playing with the select options. It looks like only two of the four options described in the help page are implemented for GRanges objects, whereas for RangedData all four options are available.

The code below should say it all (I think).  Would it be possible to implement those at some point? It seems like they're useful options (and the less coercing back and forth between GRanges and RangedData I have to do, the happier I will be).

thanks,

Janet



> library(GenomicRanges)
Loading required package: IRanges

Attaching package: ‘IRanges’

The following object(s) are masked from ‘package:base’:

    cbind, eval, intersect, Map, mapply, order, paste, pmax, pmax.int,
    pmin, pmin.int, rbind, rep.int, setdiff, table, union

> 
> gr <- GRanges(seqnames=Rle(c('Chrom1', 'Chrom2', 'Chrom3'), c(3, 3, 4)),
+                  IRanges(1:10, width=5))
>  
> findOverlaps(gr, gr, select="first")
 [1] 1 1 1 4 4 4 7 7 7 7
> findOverlaps(gr, gr, select="all")
An object of class "RangesMatching"
Slot "matchMatrix":
      query subject
 [1,]     1       1
 [2,]     1       2
 [3,]     1       3
 [4,]     2       1
### etc

> findOverlaps(gr, gr, select="last")
Error in match.arg(select) : 'arg' should be one of “all”, “first”
> findOverlaps(gr, gr, select="arbitrary")
Error in match.arg(select) : 'arg' should be one of “all”, “first”
> 
> findOverlaps(as(gr,"RangedData"), as(gr,"RangedData"), select="arbitrary")
CompressedIntegerList of length 3
[["Chrom1"]] 1 1 1
[["Chrom2"]] 1 1 1
[["Chrom3"]] 1 1 1 1
> findOverlaps(as(gr,"RangedData"), as(gr,"RangedData"), select="last")
CompressedIntegerList of length 3
[["Chrom1"]] 3 3 3
[["Chrom2"]] 3 3 3
[["Chrom3"]] 4 4 4 4
> 
> 
> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] GenomicRanges_1.6.4 IRanges_1.12.4     
> 
> 

 


More information about the Bioconductor mailing list