[Bioc-devel] Error handling in AnnotatedDataFrames

Simon Anders anders at embl.de
Thu Dec 16 18:47:49 CET 2010


These AnnotatedDataFrames are driving me nuts. Somehow, I always stumble 
over unexpected behaviour.

Here is a test case, resulting in an error mesage, that just managed to 
severely confuse me:

Let's make an AnnotatedDataFrame with two columns, called 'a' and 'b'.

 > adf <- new("AnnotatedDataFrame",
+   data=data.frame( a = 1:10, b = 11:20 ) )

Document the first column:

 > varMetadata( adf )[ "a", "labelDescription" ] <- "a column named 'a'"

Now, I try to document the second column, but misspell its name as 'c' 
instead of 'b'. Let's see how this error is reported:

 > varMetadata( adf )[ "c", "labelDescription" ] <-
+    "a column that does not exist"
Error in `row.names<-.data.frame`(`*tmp*`, value = c("a", "b")) :
   invalid 'row.names' length

 From this error message, it is quite hard to guess the cause of the 
error. Could somebody who is more familiar with the internals of Biobase 
maybe have a look whether this error condition could be caught earlier 
to give a more helpful error?


 > sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-unknown-linux-gnu (64-bit)

  [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
  [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
  [5] LC_MONETARY=C             LC_MESSAGES=en_US.utf8
  [7] LC_PAPER=en_US.utf8       LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C

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

other attached packages:
[1] ExonSeq_0.1.0  MASS_7.3-8     Biobase_2.10.0

loaded via a namespace (and not attached):
[1] hwriter_1.3  tools_2.12.0

| Dr. Simon Anders, Dipl.-Phys.
| European Molecular Biology Laboratory (EMBL), Heidelberg
| office phone +49-6221-387-8632
| preferred (permanent) e-mail: sanders at fs.tum.de

More information about the Bioc-devel mailing list