Hello,
There seems to be some unexpected behaviour in intersect(). When I intersect a GRanges with itself, I'd expect that the result has the same length as the input GRanges. All of the ranges are unique.
Here is an example that illustrates it.
library(GenomicRanges)
load(url("http://129.94.136.7/file_dump/dario/a.obj")) # 90 KB
a # 13710 ranges
unique(a) # 13710 ranges
intersect(a, a) # 12689 ranges
My setup is :
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] GenomicRanges_1.4.8 IRanges_1.10.6
--------------------------------------
Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia
[Bioc-devel] GRanges Intersect
3 messages · Dario Strbenac, Martin Morgan
On 09/26/2011 09:00 PM, Dario Strbenac wrote:
Hello,
There seems to be some unexpected behaviour in intersect(). When I intersect a GRanges with itself, I'd expect that the result has the same length as the input GRanges. All of the ranges are unique.
Here is an example that illustrates it.
library(GenomicRanges)
load(url("http://129.94.136.7/file_dump/dario/a.obj")) # 90 KB
a # 13710 ranges
unique(a) # 13710 ranges
intersect(a, a) # 12689 ranges
Hi Dario -- some overlap
> length(reduce(a))
[1] 12689
so like
> (b = IRanges(5, c(10, 15)))
IRanges of length 2
start end width
[1] 5 10 6
[2] 5 15 11
> intersect(b, b)
IRanges of length 1
start end width
[1] 5 15 11
Compare with ?pintersect and the 'Normality' section of ?Ranges.
Martin
My setup is : R version 2.13.1 (2011-07-08) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 [3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C [5] LC_TIME=English_Australia.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] GenomicRanges_1.4.8 IRanges_1.10.6 -------------------------------------- Dario Strbenac Research Assistant Cancer Epigenetics Garvan Institute of Medical Research Darlinghurst NSW 2010 Australia
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793
Now I understand how it works.
What I needed was identical(gr1, gr2).
Thanks,
Dario.