[Bioc-sig-seq] Views on RleList, RangesList doesn't match elements up by name
Aaron Statham
a.statham at garvan.org.au
Mon Sep 6 09:41:27 CEST 2010
Hi all,
Just a gotcha I ran into today - when running Views() on
RleList,RangesList arguments, the ranges are applied to the RleList by
order of the list, not by matching up names.
Consequently I had views running off the edge of a RleList with no
warning or error being thrown.
Example:
> rle1 <- RleList(chr1=Rle(1:50), chr2=Rle(1:10))
> ranges1 <- RangesList(chr2=IRanges(c(1,3), width=5), chr1=IRanges(c(5,15), width=5))
> rle1
SimpleRleList of length 2
$chr1
'integer' Rle of length 50 with 50 runs
Lengths: 1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1
Values : 1 2 3 4 5 6 7 8 9 10 11 ... 41 42 43 44 45 46 47 48 49 50
$chr2
'integer' Rle of length 10 with 10 runs
Lengths: 1 1 1 1 1 1 1 1 1 1
Values : 1 2 3 4 5 6 7 8 9 10
> ranges1
SimpleRangesList of length 2
$chr2
IRanges of length 2
start end width
[1] 1 5 5
[2] 3 7 5
$chr1
IRanges of length 2
start end width
[1] 5 9 5
[2] 15 19 5
> Views(rle1, ranges1)
SimpleRleViewsList of length 2
$chr1
Views on a 50-length Rle subject
views:
start end width
[1] 1 5 5 [1 2 3 4 5]
[2] 3 7 5 [3 4 5 6 7]
$chr2
Views on a 10-length Rle subject
views:
start end width
[1] 5 9 5 [5 6 7 8 9]
[2] 15 19 5 [ ]
> sessionInfo()
R version 2.12.0 Under development (unstable) (2010-07-06 r52460)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IRanges_1.7.32
A quick fix would be to in RleViewsList() to check for names in
rleList & rangesList (as is done in findOverlaps methods) and reorder
one before the call to Map(Views, ...)
Cheers,
Aaron
--
Aaron Statham
Postgraduate Scholar, Cancer Epigenetics
Garvan Institute of Medical Research Tel: (02) 9295 8393
384 Victoria St Darlinghurst 2010 Fax: (02) 9295 8316
NSW Australia email: a.statham at garvan.org.au
More information about the Bioc-sig-sequencing
mailing list