[Bioc-devel] validity method of eSet
Simon Anders
anders at embl.de
Mon Oct 25 11:46:42 CEST 2010
Hi,
I have a small complaint about eSet's validity method.
The whole point of an eSet is to ensure consistency between data and
meta data, and hence, eSet should give a useful error message, if the
user performs an operation that violates this.
The following works fine:
I subclass eSet and instantiate it with a 10x20 data matrix 'm':
> setClass( "Foo",
+ contains = "eSet" )
[1] "Foo"
>
> m <- matrix( 0, nrow=10, ncol=20 )
>
> a <- new( "Foo",
+ assayData = list( data = m ),
+ phenoData = annotatedDataFrameFrom( m, byrow=FALSE ),
+ featureData = annotatedDataFrameFrom( m, byrow=TRUE ) )
>
> validObject(a)
[1] TRUE
Now, I attempt to replace the dat matrix with one of wrong dimensions,
and get a proper error message:
> assayData(a) <- list( data = matrix( 0, nrow=1, ncol=1 ) )
> validObject(a)
Error in validObject(a) :
invalid class "Foo" object: 1: feature numbers differ between assayData
and featureData
invalid class "Foo" object: 2: featureNames differ between assayData
and featureData
invalid class "Foo" object: 3: sample numbers differ between assayData
and phenoData
invalid class "Foo" object: 4: sampleNames differ between assayData
and phenoData
However, I might be tempted to do this here:
> assayData(a) <- list( data = 0 )
Now, 'validObject' is confused:
1> validObject(a)
Error in rep("...", nrow(d) - 2) : invalid 'times' argument
However, this here gives a proper error message:
> assayDataValidMembers(assayData(a))
[1] "'AssayData' elements with invalid dimensions: 'data'"
The problem is hence that eSet's validity method first checks the
dimensions of the assayData and only then calls 'assayDataValidMembers'.
Can we simply turn this around? If so, see attached patch (vs r50433).
Best
Simon
1> 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] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicRanges_1.2.0 IRanges_1.8.0 GenomeGraphs_1.9.0
[4] biomaRt_2.6.0 Biobase_2.10.0
loaded via a namespace (and not attached):
[1] RCurl_1.4-3 XML_3.2-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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: <https://stat.ethz.ch/pipermail/bioc-devel/attachments/20101025/27e2837f/attachment.pl>
More information about the Bioc-devel
mailing list