[BioC] IRanges RangedData - possible bug?

Janet Young jayoung at fhcrc.org
Fri Mar 5 21:24:38 CET 2010


Hi,

I think I've found a bug in the RangedData function, although as  
always it's
possible I've misunderstood how the function is supposed to work.  
There's a
pretty simple workaround for this issue, but wanted to tell you in  
case it's
actually a bug.

The example below explains it pretty succintly, I think, and  
sessionInfo output
is at the bottom (on a mac, but I also have the same issue running it  
on linux
(with same version of IRanges).

thanks,

Janet Young


##### create simple RangedData object with a score for each object

 > rd1 <-
RangedData(IRanges(start=c(11,31,51),end=c(20,40,60)),
            space=c("chrA","chrB","chrB"),score=c(5,10,15))
 > rd1
RangedData with 3 rows and 1 value column across 2 spaces
         space    ranges |     score
   <character> <IRanges> | <numeric>
1        chrA  [11, 20] |         5
2        chrB  [31, 40] |        10
3        chrB  [51, 60] |        15

###### filter based on score

 > rd1filt <- rd1[rd1[["score"]]>= 10,]
 > rd1filt
RangedData with 2 rows and 1 value column across 2 spaces
         space    ranges |     score
   <character> <IRanges> | <numeric>
1        chrB  [31, 40] |        10
2        chrB  [51, 60] |        15

#### drop the score column - this works fine when more than one object  
passes
#### the filter
#### (I want to drop score column so I can use "reduce" without  
requiring things
#### to have matched scores)

 > rd1filt_simple <- RangedData(ranges(rd1filt))
RangedData with 2 rows and 0 value columns across 2 spaces
         space    ranges |
   <character> <IRanges> |
1        chrB  [31, 40] |
2        chrB  [51, 60] |

##### filter more stringently - now I only have one item left

 > rd1filt2 <- rd1[rd1[["score"]]>= 15,]
 > rd1filt2
RangedData with 1 row and 1 value column across 2 spaces
         space    ranges |     score
   <character> <IRanges> | <numeric>
1        chrB  [51, 60] |        15

#### now there's only one range left, the code I was using to drop the  
score
#### fails

 > RangedData(ranges(rd1filt2))
RangedData with 1 row and 0 value columns across 2 spaces
Error in seqselect(values, isplit) :
   'length(start)' must equal 'length(x)' when 'end' and 'width' are  
NULL
Error in args(sessionIno) :
   no function to return from, jumping to top level

#### the workaround

 > rd1filt2_simple <-
RangedData(IRanges(start=start(rd1filt2),end=end(rd1filt2)),
                    space=space(rd1filt2))
 > rd1filt2_simple
RangedData with 1 row and 0 value columns across 1 space
         space    ranges |
   <character> <IRanges> |
1        chrB  [51, 60] |


####### versions:

 > sessionInfo()
R version 2.10.1 (2009-12-14)
i386-apple-darwin8.11.1

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

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

other attached packages:
[1] IRanges_1.4.11

loaded via a namespace (and not attached):
[1] tools_2.10.1

##################################




-------------------------------------------------------------------

Dr. Janet Young (Trask lab)

Fred Hutchinson Cancer Research Center
1100 Fairview Avenue N., C3-168,
P.O. Box 19024, Seattle, WA 98109-1024, USA.

tel: (206) 667 1471 fax: (206) 667 6524
email: jayoung  ...at...  fhcrc.org

http://www.fhcrc.org/labs/trask/



More information about the Bioconductor mailing list