[Bioc-devel] Error handling in AnnotatedDataFrames
Martin Morgan
mtmorgan at fhcrc.org
Thu Dec 16 20:21:31 CET 2010
On 12/16/2010 09:47 AM, Simon Anders wrote:
> Hi,
>
> These AnnotatedDataFrames are driving me nuts. Somehow, I always stumble
I checked in code to devel (Biobase 2.11.7) that says
> adf <- new("AnnotatedDataFrame", data.frame(a=1:5))
> varMetadata(adf)["a", "labelDescription"] <- "foo"
> varMetadata(adf)["b", "labelDescription"] <- "foo"
Error in `varMetadata<-`(`*tmp*`, value = list(labelDescription =
c("foo", :
'b' not in 'varLabels(<AnnotatedDataFrame>)'
Martin
> 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?
>
> Cheers
> Simon
>
>
>
>> sessionInfo()
> R version 2.12.0 (2010-10-15)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [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
> [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=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
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
Location: M1-B861
Telephone: 206 667-2793
More information about the Bioc-devel
mailing list