[BioC] GRanges, strange behavior when chromosomes don't match

Patrick Aboyoun paboyoun at fhcrc.org
Fri Jul 9 01:55:31 CEST 2010


Cei,
Thanks for the bug report. I am looking into the issue now and will have 
a patch out shortly.


Cheers,
Patrick


On 7/8/10 9:22 AM, Cei Abreu-Goodger wrote:
> Hello all,
>
> When you have two GRanges objects which don't have the same seqnames 
> factor, you can get very unexpected behavior.
>
> Would it be possible to get an error/warning when this is attempted? I 
> don't know how many functions are affected, perhaps the functions 
> mentioned below can be modified to produce a more obvious result...
>
> Many thanks,
>
> Cei
>
>
> Code example / sessionInfo:
>
> library(GenomicRanges)
> gr1 <- GRanges(seqnames = c("chr1", "chr2", "chr3", "chr4"),
>           ranges = IRanges(1:4, width = 10),
>           strand = c("-", "+", "+", "+"))
> gr2 <- GRanges(seqnames = c("chr1", "chr2", "chr5", "chr6"),
>           ranges = IRanges(1:4, width = 10),
>           strand = c("-", "+", "+", "+"))
>
> union(gr1,gr2)
> # gives expected result, all 6 ranges
>
> intersect(gr1,gr2)
> # includes ranges from the missing gr2 chromosomes
>
> setdiff(gr1,gr2)
> # includes 3 copies of the ranges from the missing gr2 chromosomes
>
>
> sessionInfo()
> R version 2.11.0 (2010-04-22)
> i386-apple-darwin9.8.0
>
> locale:
> [1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices datasets  utils     methods   base
>
> other attached packages:
> [1] GenomicRanges_1.0.5 IRanges_1.6.8       Biobase_2.8.0
>
> loaded via a namespace (and not attached):
> [1] tools_2.11.0
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: 
> http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list