[BioC] IRanges glitch: error restoring saved RangedData object

Michael Dondrup Michael.Dondrup at uni.no
Fri Aug 13 11:44:46 CEST 2010


Hi,
I guess I found a little bug in IRanges. When loading a saved RangedData object before loading library(IRanges)
before, then IRanges is loaded automatically but the RangeData object is rendered unusable. Only restarting R lets me access
the object.
 The following code reproduces this:
$ R --vanilla
version 2.11.1 (2010-05-31)...
> library(IRanges)
> rd = RangedData(IRanges(start=c(1:10), width=2, names=letters[1:10]), space="chr1", score=rnorm(10))
> rd
RangedData with 10 rows and 1 value column across 1 space
        space    ranges |       score
  <character> <IRanges> |   <numeric>
a        chr1  [ 1,  2] | -0.79949926
b        chr1  [ 2,  3] |  1.09152227
c        chr1  [ 3,  4] |  0.19032854
d        chr1  [ 4,  5] |  0.37248408
e        chr1  [ 5,  6] |  0.68396618
f        chr1  [ 6,  7] | -1.19804918
g        chr1  [ 7,  8] |  0.01221636
h        chr1  [ 8,  9] |  0.66203090
i        chr1  [ 9, 10] |  0.39848133
j        chr1  [10, 11] |  0.15233945
> save(rd, file="rd.r")
> q()
# restart R
$ R --vanilla
> load("rd.r")
> rd
Loading required package: IRanges

Attaching package: 'IRanges'

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

    cbind, Map, mapply, order, paste, pmax, pmax.int, pmin, pmin.int,
    rbind, rep.int, table

RangedData with 10 rows and 1 column
Error in dimnames(x) <- dn : 
  length of 'dimnames' [1] not equal to array extent
> 

Note that this depends on presence of rownames. If you make an object
rd = RangedData(IRanges(start=c(1:10), width=2), space="chr1", score=rnorm(10))
without named IRanges, the result after loading is
> rd
Loading required package: IRanges

Attaching package: 'IRanges'

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

    cbind, Map, mapply, order, paste, pmax, pmax.int, pmin, pmin.int,
    rbind, rep.int, table

RangedData with 10 rows and 1 column
          chr1
  <RangedData>
1     ########

> sessionInfo()
R version 2.11.1 (2010-05-31) 
x86_64-unknown-linux-gnu 

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=no_NO.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=no_NO.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] IRanges_1.6.11
> 

 



More information about the Bioconductor mailing list