[Bioc-devel] bug when coercing from list to SimpleList

Hervé Pagès hpages at fhcrc.org
Fri Sep 5 09:38:37 CEST 2014


Hi Michael,

I found the following bug when coercing a list to a SimpleList
with IRanges devel (not with IRanges release):

   library(IRanges)
   x <- list(a=matrix(rep("a", 6), nrow=3),
             b=array(rep("b", 24), dim=c(3,4,2)))

Then:

   > sapply(as(x, "SimpleList"), class)
          a        b
   "matrix" "matrix"

   > lapply(as(x, "SimpleList"), dim)
   $a
   [1] 3 2

   $b
   [1] 24  1

The array was turned into a matrix!

Note that the SimpleList() constructor behaves as expected:

   > sapply(SimpleList(x), class)
          a        b
   "matrix"  "array"

   > lapply(SimpleList(x), dim)
   $a
   [1] 3 2

   $b
   [1] 3 4 2

Do you think you can have a look?

Thanks,
H.

 > sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)

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=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] IRanges_1.99.25     S4Vectors_0.1.5     BiocGenerics_0.11.4

loaded via a namespace (and not attached):
[1] stats4_3.1.0

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list