[med-svn] [r-bioc-biobase] 01/09: Imported Upstream version 2.24.0

Andreas Tille tille at debian.org
Tue Jun 10 11:08:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-bioc-biobase.

commit d919067f08dc515bffeab9a131d41345df47b736
Author: Andreas Tille <tille at debian.org>
Date:   Tue Jun 10 11:01:20 2014 +0200

    Imported Upstream version 2.24.0
---
 DESCRIPTION                                        |  14 +-
 NAMESPACE                                          |  39 +-
 NEWS                                               |  18 +
 R/AllGenerics.R                                    |  20 +-
 R/DataClasses.R                                    |  72 ++-
 R/VersionedClasses.R                               |  17 +-
 R/VersionsClass.R                                  |   2 +-
 R/methods-AnnotatedDataFrame.R                     |  49 +-
 R/methods-AssayData.R                              | 173 +++---
 R/methods-ExpressionSet.R                          | 109 ++--
 R/methods-MIAME.R                                  |  32 +-
 R/methods-NChannelSet.R                            | 227 ++++---
 R/methods-ScalarObject.R                           |   8 +-
 R/methods-SnpSet.R                                 |   2 +-
 R/methods-VersionedClass.R                         |   2 +-
 R/methods-VersionsNull.R                           |   2 +-
 R/methods-container.R                              |   2 +-
 R/methods-eSet.R                                   | 135 ++--
 R/rowOp-methods.R                                  |  18 +-
 build/vignette.rds                                 | Bin 0 -> 481 bytes
 inst/UnitTests/Makefile                            |  19 -
 inst/UnitTests/runall.sh                           |   3 -
 inst/UnitTests/runalltests.R                       |  18 -
 inst/UnitTests/runfile.sh                          |  10 -
 inst/doc/BiobaseDevelopment.pdf                    | Bin 246476 -> 246481 bytes
 inst/doc/Bioconductor.pdf                          | Bin 71296 -> 71100 bytes
 inst/doc/ExpressionSetIntroduction.pdf             | Bin 174950 -> 174953 bytes
 inst/doc/HowTo.pdf                                 | Bin 54522 -> 54524 bytes
 inst/doc/Qviews.pdf                                | Bin 77432 -> 77433 bytes
 inst/doc/esApply.pdf                               | Bin 93275 -> 93274 bytes
 .../VersionedClass_data/1.8/AnnotatedDataFrame.Rda | Bin
 .../VersionedClass_data/1.8/ExpressionSet.Rda      | Bin
 .../VersionedClass_data/1.8/MIAME.Rda              | Bin
 .../VersionedClass_data/1.8/exprSet.Rda            | Bin
 .../VersionedClass_data/1.8/phenoData.Rda          | Bin
 .../VersionedClass_data/2.0/AnnotatedDataFrame.Rda | Bin
 .../VersionedClass_data/2.0/ExpressionSet.Rda      | Bin
 .../VersionedClass_data/2.0/MIAME.Rda              | Bin
 .../VersionedClass_data/2.0/MultiSet.Rda           | Bin
 .../VersionedClass_data/2.0/ScalarCharacter.Rda    | Bin
 .../VersionedClass_data/2.0/SnpSet.Rda             | Bin
 .../VersionedClass_data/2.0/Versioned.Rda          | Bin
 .../VersionedClass_data/2.0/VersionedBiobase.Rda   | Bin
 .../VersionedClass_data/2.0/Versions.Rda           | Bin
 .../VersionedClass_data/2.0/VersionsNull.Rda       | Bin
 .../VersionedClass_data/2.0/aggregator.Rda         | Bin
 .../VersionedClass_data/2.0/container.Rda          | Bin
 .../VersionedClass_data/2.0/exprSet.Rda            | Bin
 .../VersionedClass_data/2.0/phenoData.Rda          | Bin
 .../devel/AnnotatedDataFrame.Rda                   | Bin
 .../VersionedClass_data/devel/ExpressionSet.Rda    | Bin
 .../VersionedClass_data/devel/MIAME.Rda            | Bin
 .../VersionedClass_data/devel/MultiSet.Rda         | Bin
 .../VersionedClass_data/devel/NChannelSet.Rda      | Bin
 .../VersionedClass_data/devel/SWPD.rda             | Bin
 .../VersionedClass_data/devel/ScalarCharacter.Rda  | Bin
 .../VersionedClass_data/devel/ScalarInteger.Rda    | Bin
 .../VersionedClass_data/devel/ScalarLogical.Rda    | Bin
 .../VersionedClass_data/devel/ScalarNumeric.Rda    | Bin
 .../VersionedClass_data/devel/SnpSet.Rda           | Bin
 .../VersionedClass_data/devel/Versioned.Rda        | Bin
 .../VersionedClass_data/devel/VersionedBiobase.Rda | Bin
 .../VersionedClass_data/devel/Versions.Rda         | Bin
 .../VersionedClass_data/devel/VersionsNull.Rda     | Bin
 .../VersionedClass_data/devel/aggregator.Rda       | Bin
 .../VersionedClass_data/devel/bbsym.rda            | Bin
 .../VersionedClass_data/devel/container.Rda        | Bin
 .../VersionedClass_data/devel/eset.rda             | Bin
 .../VersionedClass_data/devel/exprSet.Rda          | Bin
 .../VersionedClass_data/devel/golubMergeSub.rda    | Bin
 .../VersionedClass_data/devel/sample.eSet.rda      | Bin
 .../VersionedClass_data/devel/sample.exprSet.1.rda | Bin
 .../VersionedClass_data/devel/sample.exprSet.rda   | Bin
 .../VersionedClass_data/devel/swrep.rda            | Bin
 .../VersionedClass_data/raw/exprs.tab              |   0
 .../VersionedClass_data/raw/pData.tab              |   0
 .../VersionedClass_data/raw/varMetadata.tab        |   0
 .../test_AnnotatedDataFrame.R}                     |  44 +-
 .../test_AssayData.R}                              |   0
 .../test_DataClasses.R}                            |   0
 .../test_EsetSubclasses.R}                         |   4 +-
 .../test_ExpressionSet.R}                          |   0
 .../test_NChannelSet.R}                            |  41 +-
 .../SnpSet_test.R => unitTests/test_SnpSet.R}      |   0
 .../test_UpdateObject.R}                           |  10 +-
 .../test_VersionedClass.R}                         |   2 +-
 .../cache_test.R => unitTests/test_cache.R}        |   0
 .../test_checkClass.R}                             |   0
 .../combine_test.R => unitTests/test_combine.R}    |   0
 .../copyEnv_test.R => unitTests/test_copyEnv.R}    |   0
 .../esApply_test.R => unitTests/test_esApply.R}    |   0
 .../test_subListExtract.R}                         |   0
 .../test_unsaveSetSlot.R}                          |   0
 inst/{UnitTests => unitTests}/utilities.R          |   2 +-
 man/channel.Rd                                     |   4 +-
 man/channelNames.Rd                                |  35 +-
 man/class.AnnotatedDataFrame.Rd                    |   5 +
 man/class.ExpressionSet.Rd                         |  24 +-
 man/class.MIAxE.Rd                                 |   4 +-
 man/class.NChannelSet.Rd                           |  25 +-
 man/class.Versioned.Rd                             |  14 +-
 man/class.VersionedBiobase.Rd                      |   9 +-
 man/class.eSet.Rd                                  |  36 +-
 man/copySubstitute.Rd                              |   3 +-
 man/dge.Rd                                         |  49 --
 man/isCurrent.Rd                                   |   4 +-
 man/isVersioned.Rd                                 |   4 +-
 man/rowMedians.Rd                                  |  25 +-
 man/selectChannels.Rd                              |   4 +-
 src/Rinit.c                                        |   4 +-
 src/envir.c                                        |   3 +-
 src/rowMedians.c                                   | 302 ++-------
 src/rowMedians_TYPE-template.h                     | 206 +++++++
 src/templates-types.h                              |  46 ++
 src/templates-types_undef.h                        |  18 +
 tests/test-all.R                                   |   3 +-
 vignettes/BiobaseDevelopment.Rnw                   | 684 +++++++++++++++++++++
 vignettes/Bioconductor.Rnw                         |  96 +++
 vignettes/ExpressionSetIntroduction.Rnw            | 493 +++++++++++++++
 vignettes/HowTo.Rnw                                |  91 +++
 vignettes/Qviews.Rnw                               | 176 ++++++
 vignettes/esApply.Rnw                              | 132 ++++
 {inst/doc => vignettes}/legacy/Biobase.Rnw         |   0
 123 files changed, 2707 insertions(+), 886 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index ac0f95a..408a9b1 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,14 +1,14 @@
 Package: Biobase
 Title: Biobase: Base functions for Bioconductor
-Version: 2.20.0
+Version: 2.24.0
 Author: R. Gentleman, V. Carey, M. Morgan, S. Falcon
 Description: Functions that are needed by many other packages or which
-  replace R functions.
-Suggests: tools, tkWidgets, ALL
+        replace R functions.
+Suggests: tools, tkWidgets, ALL, RUnit, golubEsets
 Depends: R (>= 2.10), BiocGenerics (>= 0.3.2), utils
-Imports: methods, BiocGenerics
+Imports: methods
 Maintainer: Bioconductor Package Maintainer
-        <maintainer at bioconductor.org>
+ <maintainer at bioconductor.org>
 License: Artistic-2.0
 Collate: tools.R strings.R environment.R vignettes.R packages.R
         AllGenerics.R VersionsClass.R VersionedClasses.R
@@ -20,5 +20,5 @@ Collate: tools.R strings.R environment.R vignettes.R packages.R
         methods-NChannelSet.R anyMissing.R rowOp-methods.R
         updateObjectTo.R methods-ScalarObject.R zzz.R
 LazyLoad: yes
-biocViews: Infrastructure, Bioinformatics
-Packaged: 2013-04-04 06:39:20 UTC; biocbuild
+biocViews: Infrastructure
+Packaged: 2014-04-12 05:10:37 UTC; biocbuild
diff --git a/NAMESPACE b/NAMESPACE
index c931375..9b54676 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -29,7 +29,7 @@ exportMethods("[", "[[", "$", abstract, aggenv, aggfun,
               phenoData, preproc, protocolData, sampleNames, samples, se.exprs,
               selectChannels, snpCall, snpCallProbability, storageMode,
               varLabels, varMetadata,
-              "annotation<-", "description<-", "dimLabels<-",
+              "annotation<-", "channelNames<-", "description<-", "dimLabels<-",
               "experimentData<-", "exprs<-",
               "featureNames<-", "featureData<-", "fData<-", "fvarLabels<-",
               "fvarMetadata<-",
@@ -43,29 +43,18 @@ exportMethods("[", "[[", "$", abstract, aggenv, aggfun,
               updateObject, updateObjectTo,
               initialize, show, Compare,
 
-              "counts", "counts<-",
-              "design", "design<-",
-              "dispTable", "dispTable<-",
-              "sizeFactors", "sizeFactors<-",
-              "conditions", "conditions<-",
-              "estimateSizeFactors", 
-              "estimateDispersions",
-              "AnnotatedDataFrame",
-              "ExpressionSet")
+              AnnotatedDataFrame,
+              ExpressionSet)
 
-export("Aggregate",
-       "addVigs2WinMenu",
-       "anyMissing",
-       "as.data.frame.ExpressionSet",
-       "assayDataNew", "assayDataValidMembers",
-       assayDataElementNames,
-       assayDataElement, assayDataElementReplace, "assayDataElement<-",
-       "cache", "copyEnv", "copySubstitute",
-       "createPackage", "dumpPackTxt", "esApply",
-       "getPkgVigs", "isUnique", "listLen", "matchpt", "mkScalar",
-       "multiassign", "note", "openPDF","openVignette", "package.version",
-       "reverseSplit", "rowMax", "rowMedians", "rowMin", "rowQ",
+export(Aggregate, addVigs2WinMenu, anyMissing,
+       as.data.frame.ExpressionSet, assayDataNew,
+       assayDataValidMembers, assayDataElementNames, assayDataElement,
+       assayDataElementReplace, "assayDataElement<-", cache, copyEnv,
+       copySubstitute, createPackage, dumpPackTxt, esApply,
+       getPkgVigs, isUnique, listLen, matchpt, mkScalar, multiassign,
+       NChannelSet, note, openPDF,openVignette, package.version,
+       reverseSplit, rowMax, rowMedians, rowMin, rowQ,
        readExpressionSet, read.AnnotatedDataFrame, read.MIAME, MIAME,
-       "selectSome", "strbreak", "subListExtract", "testBioCConnection",
-       "lcSuffix", "lcPrefix", "lcPrefixC",
-       "updateOldESet", "userQuery", "validMsg")
+       selectSome, strbreak, subListExtract, testBioCConnection,
+       lcSuffix, lcPrefix, lcPrefixC, updateOldESet, userQuery,
+       validMsg)
diff --git a/NEWS b/NEWS
index 71ee17b..19c1801 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+CHANGES IN VERSION 2.21
+-----------------------
+
+BUG FIXES
+
+    o Updating an AnnotatedDataFrame no longer duplicates metadata
+      from partially matching column names.
+
+CHANGES IN VERSION 2.21
+-----------------------
+
+USER VISIBLE CHANGES
+
+    o channelNames<-,NChannelSet,*-methods allow re-naming channels
+
+    o NChannelSet validity requires all assayDataElementNames() to be
+      levels in varMetadata()$channel.
+
 CHANGES IN VERSION 2.19
 -----------------------
 
diff --git a/R/AllGenerics.R b/R/AllGenerics.R
index 8d5d087..89d9f81 100644
--- a/R/AllGenerics.R
+++ b/R/AllGenerics.R
@@ -92,24 +92,6 @@ setGeneric("updateObjectTo",
 
 
 
-
-# Currently, these are for DESeq and DEXSeq. Could be extended to a more general
-#  infrastructure for count datasets.
-setGeneric("counts",        function(object, ...)        standardGeneric("counts"))
-setGeneric("counts<-",      function(object, ..., value) standardGeneric("counts<-"))
-setGeneric("dispTable",     function(object, ...)        standardGeneric("dispTable"))
-setGeneric("dispTable<-",   function(object, ..., value) standardGeneric("dispTable<-"))
-setGeneric("sizeFactors",   function(object, ...)        standardGeneric("sizeFactors"))
-setGeneric("sizeFactors<-", function(object, ..., value) standardGeneric("sizeFactors<-"))
-
-setGeneric("conditions",    function(object, ...)        standardGeneric("conditions"))
-setGeneric("conditions<-",  function(object, ..., value) standardGeneric("conditions<-"))
-setGeneric("design",        function(object, ...)        standardGeneric("design"))
-setGeneric("design<-",      function(object, ..., value) standardGeneric("design<-"))
-
-setGeneric("estimateSizeFactors", function(object, ...) standardGeneric("estimateSizeFactors"))
-setGeneric("estimateDispersions", function(object, ...) standardGeneric("estimateDispersions"))
-
 ## Generics for Constructors: AnnotatedDataFrame and ExpresssionSet
 
 setGeneric("AnnotatedDataFrame", function(data, varMetadata, ...)
@@ -120,7 +102,7 @@ setGeneric("ExpressionSet",
            function(assayData,
                     phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
                     featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
-                    experimentData=new("MIAME"),
+                    experimentData=MIAME(),
                     annotation=character(),
                     protocolData=annotatedDataFrameFrom(assayData, byrow=FALSE),
                     ...)
diff --git a/R/DataClasses.R b/R/DataClasses.R
index 9782da9..27d9527 100644
--- a/R/DataClasses.R
+++ b/R/DataClasses.R
@@ -4,7 +4,7 @@
 # Data are aggregated in the environment env if they are not there then the
 # get assigned with initfun, if they are there they get aggregated with agfun
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setClass("aggregator",
+.aggregator <- setClass("aggregator",
    representation(
       aggenv  = "environment",
       initfun = "function",
@@ -18,7 +18,7 @@ setClass("aggregator",
 # ==========================================================================
 # container: lists containing objects of specified class (R. Gentleman, 2001)
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setClass("container",
+.container <- setClass("container",
    representation(
       x       = "list",
       content = "character",
@@ -53,16 +53,16 @@ setClassUnion("data.frameOrNULL", c("data.frame", "NULL"))
 # ==========================================================================
 # MIAxE: a VIRTUAL class for experiment meta-data 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setClass("MIAxE",
+.MIAxe <- setClass("MIAxE",
     representation("VIRTUAL"),
     contains="Versioned",
-    prototype = prototype(new("Versioned", versions=c(MIAxE="1.0.0")))
+    prototype = prototype(.Versioned(versions=c(MIAxE="1.0.0")))
     )
  
 
 # MIAME: a class for microarray data - MIAME information (Rafael A. Irizarry)
 # More info: http://www.mged.org/Workgroups/MIAME/miame_1.1.html
-setClass("MIAME",
+.MIAME <- setClass("MIAME",
    representation(
       name           = "character",
       lab            = "character",
@@ -79,7 +79,7 @@ setClass("MIAME",
    ),
    contains=c("MIAxE"),
    prototype = prototype(
-      new("Versioned", versions=c(classVersion("MIAxE"), MIAME="1.1.0")),
+      .Versioned(versions=c(classVersion("MIAxE"), MIAME="1.1.0")),
       name           = "",
       lab            = "",
       contact        = "",
@@ -117,13 +117,13 @@ setClass("annotatedDataset",
 # of columns in the data slot equals the number of rows in the
 # metadata slot.
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setClass("AnnotatedDataFrame",
+.AnnotatedDataFrame <- setClass("AnnotatedDataFrame",
          representation(varMetadata = "data.frame",
                         data = "data.frame",
                         dimLabels = "character"),
          contains=c("Versioned"),
          prototype = prototype(
-           new("Versioned", versions=list(AnnotatedDataFrame="1.1.0")),
+           .Versioned(versions=list(AnnotatedDataFrame="1.1.0")),
            varMetadata = new( "data.frame" ),
            data = new( "data.frame" ),
            dimLabels=c("rowNames", "columnNames")))
@@ -142,7 +142,7 @@ setClassUnion("AssayData", c("list", "environment"))
 # representing samples, all assayData members providing information
 # for the same number of genes and samples).
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setClass("eSet",
+.eSet <- setClass("eSet",
          representation(assayData = "AssayData",
                         phenoData = "AnnotatedDataFrame",
                         featureData = "AnnotatedDataFrame",
@@ -152,41 +152,43 @@ setClass("eSet",
                         "VIRTUAL"),
          contains="VersionedBiobase",
          prototype = prototype(
-           new("VersionedBiobase", versions=c(eSet="1.3.0")),
-               assayData = list(), # use initialize to set as env, so different instances have different envs
-               phenoData = new("AnnotatedDataFrame",
+           .VersionedBiobase(versions=c(eSet="1.3.0")),
+               assayData = list(), # use initialize to set as env, so
+                                   # different instances have
+                                   # different envs
+               phenoData = .AnnotatedDataFrame(
                  dimLabels=c("sampleNames", "sampleColumns")),
-               featureData = new("AnnotatedDataFrame",
+               featureData = .AnnotatedDataFrame(
                  dimLabels=c("featureNames", "featureColumns")),
                annotation = character(),
-               protocolData = new("AnnotatedDataFrame",
+               protocolData = .AnnotatedDataFrame(
                  dimLabels=c("sampleNames", "sampleColumns"))))
-setClass("ExpressionSet",
+.ExpressionSet <- setClass("ExpressionSet",
          representation(experimentData="MIAME"),
          contains = "eSet",
          prototype = prototype(
-           new("VersionedBiobase",
+           .VersionedBiobase(
                versions=c(classVersion("eSet"), ExpressionSet="1.0.0")),
-               experimentData=new("MIAME")))
-setClass("NChannelSet",
+               experimentData=.MIAME()))
+.NChannelSet <- setClass("NChannelSet",
          contains = "eSet",
          prototype = prototype(
-           new("VersionedBiobase",
+           .VersionedBiobase(
                versions=c(classVersion("eSet"), NChannelSet="1.0.0")),
-           phenoData = new("AnnotatedDataFrame",
+           phenoData = .AnnotatedDataFrame(
              data=data.frame(),
              varMetadata=data.frame(
                labelDescription=character(0),
                channelDescription=factor()))))
-setClass("MultiSet",                    # any element in assayData slot
+.MultiSet <- setClass("MultiSet",      # any element in assayData slot
          contains = "eSet",
          prototype = prototype(
-           new("VersionedBiobase",
+           .VersionedBiobase(
                versions=c(classVersion("eSet"), MultiSet="1.0.0"))))
-setClass("SnpSet",                      # call, callProbability
+.SnpSet <- setClass("SnpSet",                      # call, callProbability
          contains = "eSet",
          prototype = prototype(
-           new("VersionedBiobase",
+           .VersionedBiobase(
                versions=c(classVersion("eSet"), SnpSet="1.0.0"))))
 # ==========================================================================
 # exprSet (DEFUNCT)
@@ -206,7 +208,7 @@ setClass("exprSet",
 )
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
-setClass("ScalarObject", contains="VIRTUAL",
+.ScalarObject <- setClass("ScalarObject", contains="VIRTUAL",
          validity=function(object) {
              if (length(object) != 1L)
                paste(class(object), "must have length one")
@@ -214,14 +216,18 @@ setClass("ScalarObject", contains="VIRTUAL",
                TRUE
          })
 
-setClass("ScalarLogical", contains=c("ScalarObject", "logical"),
-         prototype=NA)
+.ScalarLogical <- setClass("ScalarLogical",
+    contains=c("ScalarObject", "logical"),
+    prototype=NA)
 
-setClass("ScalarCharacter", contains=c("ScalarObject", "character"),
-         prototype="")
+.ScalarCharacter <- setClass("ScalarCharacter",
+    contains=c("ScalarObject", "character"),
+    prototype="")
 
-setClass("ScalarInteger", contains=c("ScalarObject", "integer"),
-         prototype=NA_integer_)
+.ScalarInteger <- setClass("ScalarInteger",
+    contains=c("ScalarObject", "integer"),
+    prototype=NA_integer_)
 
-setClass("ScalarNumeric", contains=c("ScalarObject", "numeric"),
-         prototype=NA_real_)
+.ScalarNumeric <- setClass("ScalarNumeric",
+    contains=c("ScalarObject", "numeric"),
+    prototype=NA_real_)
diff --git a/R/VersionedClasses.R b/R/VersionedClasses.R
index 45db689..dd23793 100644
--- a/R/VersionedClasses.R
+++ b/R/VersionedClasses.R
@@ -1,9 +1,10 @@
 ## Versions previously defined
-setClass("VersionsNull", contains="Versions")
-setClass("Versioned", representation(.__classVersion__ = "Versions"))
-setClass("VersionedBiobase",
-         contains="Versioned",
-         prototype=prototype(
-           .__classVersion__ = new("Versions", 
-             R = getRversion(),
-             Biobase = package_version(packageDescription("Biobase", NULL, "Version")))))
+.VersionsNull <- setClass("VersionsNull", contains="Versions")
+.Versioned <- setClass("Versioned",
+    representation(.__classVersion__ = "Versions"))
+.VersionedBiobase <- setClass("VersionedBiobase",
+    contains="Versioned",
+    prototype=prototype(
+      .__classVersion__ = .Versions(
+        R = getRversion(),
+        Biobase = package_version(packageDescription("Biobase", NULL, "Version")))))
diff --git a/R/VersionsClass.R b/R/VersionsClass.R
index 9ee642e..f69469c 100644
--- a/R/VersionsClass.R
+++ b/R/VersionsClass.R
@@ -3,7 +3,7 @@
 ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ## methods and class defined together so available for prototypes elsewhere
 
-setClass("Versions", contains="list")
+.Versions <- setClass("Versions", contains="list")
 
 setMethod("initialize", signature(.Object="Versions"),
           function(.Object, ...) callNextMethod(.Object, .asValidVersions(list(...))))
diff --git a/R/methods-AnnotatedDataFrame.R b/R/methods-AnnotatedDataFrame.R
index b98fa38..0fae35c 100644
--- a/R/methods-AnnotatedDataFrame.R
+++ b/R/methods-AnnotatedDataFrame.R
@@ -82,7 +82,7 @@ annotatedDataFrameFromMatrix <- function(object, byrow=FALSE, ...) {
         dimLabels <-
             if (byrow) c("featureNames", "featureColumns")
             else c("sampleNames", "sampleColumns")
-        new("AnnotatedDataFrame", data=data, dimLabels=dimLabels)
+        AnnotatedDataFrame(data=data, dimLabels=dimLabels)
     }
 }
 
@@ -94,7 +94,7 @@ annotatedDataFrameFromNull <- function(object, byrow=FALSE, ...) {
     dimLabels <-
         if (byrow) c("featureNames", "featureColumns")
         else c("sampleNames", "sampleColumns")
-    new("AnnotatedDataFrame", data=data.frame(), dimLabels=dimLabels)
+    AnnotatedDataFrame(data=data.frame(), dimLabels=dimLabels)
 }
 
 setMethod("annotatedDataFrameFrom",
@@ -115,6 +115,16 @@ setMethod("annotatedDataFrameFrom",
           signature(object="AssayData"),
           annotatedDataFrameFromAssayData)
 
+setMethod("dimnames", "AnnotatedDataFrame", function(x) {
+    dimnames(pData(x))
+})
+
+setReplaceMethod("dimnames", "AnnotatedDataFrame", function(x, value) {
+    sampleNames(x) <- value[[1]]
+    varLabels(x) <- value[[2]]
+    x
+})
+
 setMethod("dim", "AnnotatedDataFrame", function( x ) {
   d <- dim(pData(x))
   names(d) <- dimLabels(x)
@@ -141,8 +151,8 @@ setReplaceMethod("pData",
                    object="AnnotatedDataFrame",
                    value="data.frame"),
                  function(object, value) {
-                     varMetadata <-
-                         varMetadata(object)[names(value),,drop=FALSE]
+                     idx <- match(names(value), rownames(varMetadata(object)))
+                     varMetadata <- varMetadata(object)[idx,,drop=FALSE]
                      row.names(varMetadata) <- names(value)
                      initialize(object, data=value, varMetadata=varMetadata)
                  })
@@ -154,7 +164,7 @@ setReplaceMethod("sampleNames",
     signature(object="AnnotatedDataFrame", value="ANY"),
     function(object, value) 
 {
-    if (length(value) != dim(object at data)[[1]])
+    if (!is.null(value) && (length(value) != dim(object at data)[[1]]))
         stop("number of new names (", length(value), ") ",
              "should equal number of rows in AnnotatedDataFrame (",
              dim( object )[[1]], ")")
@@ -179,12 +189,15 @@ setReplaceMethod("varLabels",
     signature("AnnotatedDataFrame", "ANY"),
     function(object, value) 
 {
-    if (length(value) != dim(object at data)[[2]])
+    if (!is.null(value) && (length(value) != dim(object at data)[[2]]))
         stop("number of new varLabels (", length(value), ") ",
              "should equal number of columns in AnnotatedDataFrame (",
              dim(object)[[2]], ")")
-    colnames(object at data) <- value
-    row.names(object at varMetadata) <- value
+    if (!is.null(value)) {
+        ## silently ignore attempts to set colnames to NULL
+        colnames(object at data) <- value
+        row.names(object at varMetadata) <- value
+    }
     object
 })
 
@@ -276,14 +289,14 @@ setAs("phenoData", "AnnotatedDataFrame", function(from) {
     warning("contents of varLabels ignored\n", call.=FALSE)
   else
     varMetadata[["labelDescription"]] <- as.character(rep(NA, nrow(varLabels)))
-  new("AnnotatedDataFrame",
+  AnnotatedDataFrame(
       data=data,
       varMetadata=varMetadata,
       dimLabels=c("sampleNames", "sampleColumns"))
 })
 
 setAs("data.frame", "AnnotatedDataFrame",
-      function(from) new("AnnotatedDataFrame", data=from))
+      function(from) AnnotatedDataFrame(data=from))
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 selectSome <- function(obj, maxToShow=5) {
   len <- length(obj)
@@ -452,17 +465,17 @@ read.AnnotatedDataFrame <-
       filename, Sys.info()["nodename"], date())
     attr(vmd, "provenance") = provenance
     
-    new("AnnotatedDataFrame", data=pData, varMetadata=vmd)
+    AnnotatedDataFrame(data=pData, varMetadata=vmd)
     
 }
 
 setMethod("AnnotatedDataFrame",
           signature(data="missing", varMetadata="missing"),
 
-      function(data, varMetadata, dimLabels=c("rowNames", "columnNames"), ...)
+    function(data, varMetadata, dimLabels=c("rowNames", "columnNames"), ...)
 {
-    AnnotatedDataFrame(data=data.frame(), varMetadata=data.frame(),
-                   dimLabels=dimLabels, ...)
+    .AnnotatedDataFrame(data=data.frame(), varMetadata=data.frame(),
+                        dimLabels=dimLabels, ...)
 })
 
 setMethod("AnnotatedDataFrame",
@@ -472,8 +485,8 @@ setMethod("AnnotatedDataFrame",
 {
     varMetadata <- data.frame(labelDescription = rep(NA, ncol(data)))
     row.names(varMetadata) <- names(data)
-    AnnotatedDataFrame(data=data, varMetadata=varMetadata,
-                       dimLabels=dimLabels,...)
+    .AnnotatedDataFrame(data=data, varMetadata=varMetadata,
+                        dimLabels=dimLabels,...)
 })
 
 setMethod("AnnotatedDataFrame",
@@ -486,8 +499,8 @@ setMethod("AnnotatedDataFrame",
     row.names(varMetadata) <- names(data)
     varMetadata[["labelDescription"]] <-
         as.character(varMetadata[["labelDescription"]])
-    new("AnnotatedDataFrame", data=data, varMetadata=varMetadata,
-        dimLabels=dimLabels, ...)
+    .AnnotatedDataFrame(data=data, varMetadata=varMetadata,
+                        dimLabels=dimLabels, ...)
 })
 
 
diff --git a/R/methods-AssayData.R b/R/methods-AssayData.R
index 422b410..c68d934 100644
--- a/R/methods-AssayData.R
+++ b/R/methods-AssayData.R
@@ -122,10 +122,13 @@ setMethod("assayData",
           function(object) object)
 
 .assayDataDimnames <- function(assayData) {
-    switch(storageMode(assayData),
-           lockedEnvironment=,
-           environment=eapply(assayData, dimnames),
-           list=lapply(assayData, dimnames))
+    switch(storageMode(assayData), lockedEnvironment=, environment = {
+        result <- vector("list", length(assayData))
+        names(result) <- ls(assayData)
+        for (nm in ls(assayData))
+            result[[nm]] <- dimnames(assayData[[nm]])
+        result
+    }, list=lapply(assayData, dimnames))
 }
 
 setMethod("sampleNames", signature(object="AssayData"),
@@ -139,72 +142,79 @@ setMethod("sampleNames", signature(object="AssayData"),
                      safe.colnames(object[[ls(object)[1]]]))
           })
 
-setReplaceMethod("sampleNames",
-                 signature=signature(
-                   object="AssayData",
-                   value="list"),
-                 function(object, value) 
+setReplaceMethod("sampleNames", signature(object="AssayData", value="list"),
+    function(object, value) 
 {
     .names_found_unique <- function(names, table)
     {
         ok <- !is.null(names) && all(names %in% table) && 
               !any(duplicated(names))
-        if (!ok)
-            stop("'sampleNames' replacement list must have unique named elements corresponding to assayData element names")
+        if (!ok) {
+            txt <- "'sampleNames' replacement list must have unique named elements
+                    corresponding to assayData element names"
+            stop(paste(strwrap(txt, exdent=2), colapse="\n"))
+        }
     }
-    switch(assayDataStorageMode(object),
-           lockedEnvironment = {
-               .names_found_unique(names(value), ls(object))
-               object <- copyEnv(object)
-               for (nm in names(value))
-                   colnames(object[[nm]]) <- value[[nm]]
-               assayDataEnvLock(object)
-           }, environment = {
-               .names_found_unique(names(value), ls(object))
-               for (nm in names(value))
-                   colnames(object[[nm]]) <- value[[nm]]
-           }, list= {
-               .names_found_unique(names(value), names(object))
-               for (nm in names(value))
-                   colnames(object[[nm]]) <- value[[nm]]
-           })
+    mode <- assayDataStorageMode(object)
+    switch(mode, lockedEnvironment = {
+        .names_found_unique(names(value), ls(object))
+        object <- copyEnv(object)
+    }, environment = {
+        .names_found_unique(names(value), ls(object))
+    }, list= {
+        .names_found_unique(names(value), names(object))
+    })
+    for (nm in names(value)) {
+        dn <- dimnames(object[[nm]])
+        if (is.null(dn))
+            dn <- vector("list", length(dim(object[[nm]])))
+        dn[[2]] <- value[[nm]]
+        dimnames(object[[nm]]) <- dn
+    }
+    if (mode == "lockedEnvironment")
+        assayDataEnvLock(object)
     object
 })
 
-setReplaceMethod("sampleNames",
-    signature(object="AssayData", value="ANY"),
+setReplaceMethod("sampleNames", signature(object="AssayData", value="ANY"),
     function(object, value)
 {
-    dims <- 
-      switch(assayDataStorageMode(object),
-             lockedEnvironment=,
-             environment = eapply(object, ncol),
-             list = lapply(object, ncol))
+    mode <- assayDataStorageMode(object)
+    dims <- switch(mode, lockedEnvironment=, environment = {
+        result <- vector("list", length(object))
+        names(result) <- ls(object)
+        for (nm in ls(object))
+            result[[nm]] <- ncol(object[[nm]])
+        result
+    }, list = {
+        lapply(object, ncol)
+    })
+    
     if (length(dims)==0 && length(value) !=0)
-      return(object)                    # early exit; no samples to name
-    if (!all(dims==length(value)))
-      stop("'value' length (", length(value),
-           ") must equal sample number in AssayData (",dims[[1]], ")")
-    switch(assayDataStorageMode(object),
-           lockedEnvironment = {
-               object <- copyEnv(object)
-               for (nm in ls(object))
-                   colnames(object[[nm]]) <- value
-               assayDataEnvLock(object)
-           },
-           environment = {
-               for (nm in ls(object))
-                   colnames(object[[nm]]) <- value
-           },
-           list = {
-               for (nm in names(object))
-                   colnames(object[[nm]]) <- value
-           })
-    object
-})
+        return(object)                    # early exit; no samples to name
+    if (!all(dims==length(value))) {
+        txt <- sprintf("'value' length (%d) must equal sample number in AssayData (%d)",
+                       length(value), dims[[1]])
+        stop(paste(strwrap(txt, exdent=2), collapse="\n"))
+    }
 
+    nms <- switch(mode, lockedEnvironment = {
+        object <- copyEnv(object)
+        ls(object)
+    }, environment = ls(object), list = names(object))
 
+    for (nm in nms) {
+        dn <- dimnames(object[[nm]])
+        if (is.null(dn))
+            dn <- vector("list", length(dim(object[[nm]])))
+        dn[[2]] <- value
+        dimnames(object[[nm]]) <- dn
+    }
 
+    if (mode == "lockedEnvironment")
+        assayDataEnvLock(object)
+    object
+})
 
 setMethod("featureNames", signature(object="AssayData"),
           function(object) {
@@ -217,29 +227,40 @@ setMethod("featureNames", signature(object="AssayData"),
                      safe.rownames(object[[ls(object)[1]]]))
           })
 
-
 setReplaceMethod("featureNames", signature(object="AssayData", value="ANY"),
-                 function(object, value) {
-    dims <- 
-      switch(assayDataStorageMode(object),
-             lockedEnvironment=,
-             environment = eapply(object, nrow),
-             list = lapply(object, nrow))
+    function(object, value) 
+{
+    mode <- assayDataStorageMode(object)
+    dims <- switch(mode, lockedEnvironment=, environment = {
+        result <- vector("list", length(object))
+        names(result) <- ls(object)
+        for (nm in ls(object)) result[[nm]] <- nrow(object[[nm]])
+        result
+    }, list = lapply(object, nrow))
     if (length(dims)==0 && length(value) !=0)
-      return(object)                    # early exit; no features to name
-    if (!all(dims==length(value)))
-      stop("'value' length (", length(value),
-           ") must equal feature number in AssayData (",dims[[1]], ")")
-    switch(assayDataStorageMode(object),
-         lockedEnvironment = {
-           object <- copyEnv(object)
-           for (nm in ls(object)) rownames(object[[nm]]) <- value
-           assayDataEnvLock(object)
-         },
-         environment = for (nm in ls(object)) rownames(object[[nm]]) <- value,
-         list = for (nm in names(object)) rownames(object[[nm]]) <- value,
-         )
-  object
+        return(object)                    # early exit; no features to name
+    if (!all(dims==length(value))) {
+        txt <- sprintf("'value' length (%d) must equal feature number in AssayData (%d)",
+                       length(value), dims[[1]])
+        stop(paste(strwrap(txt, exdent=2), collapse="\n"))
+    }
+
+    nms <- switch(mode, lockedEnvironment = {
+        object <- copyEnv(object)
+        ls(object)
+    }, environment = ls(object), list=names(object))
+
+    for (nm in nms) {
+        dn <- dimnames(object[[nm]])
+        if (is.null(dn))
+            dn <- vector("list", length(dim(object[[nm]])))
+        dn[[1]] <- value
+        dimnames(object[[nm]]) <- dn
+    }
+
+    if (mode == "lockedEnvironment")
+        assayDataEnvLock(object)
+    object
 })
 
 setMethod("combine", c("AssayData", "AssayData"), function(x, y, ...) {
diff --git a/R/methods-ExpressionSet.R b/R/methods-ExpressionSet.R
index 7ae0b23..91644e8 100644
--- a/R/methods-ExpressionSet.R
+++ b/R/methods-ExpressionSet.R
@@ -1,34 +1,31 @@
 setMethod("initialize", "ExpressionSet",
-          function(.Object,
-                   assayData,
-                   phenoData,
-                   featureData,
-                   exprs = new("matrix"),
-                   ... ) {
-              if (missing(assayData)) {
-                  if (missing(phenoData))
-                    phenoData <- annotatedDataFrameFrom(exprs, byrow=FALSE)
-                  if (missing(featureData))
-                    featureData <- annotatedDataFrameFrom(exprs, byrow=TRUE)
-                  .Object <- callNextMethod(.Object,
-                                            phenoData = phenoData,
-                                            featureData = featureData,
-                                            exprs = exprs,
-                                            ...)
-              } else if (missing(exprs)) {
-                  if (missing(phenoData))
-                    phenoData <- annotatedDataFrameFrom(assayData, byrow=FALSE)
-                  if (missing(featureData))
-                    featureData <- annotatedDataFrameFrom(assayData, byrow=TRUE)
-                  .Object <- callNextMethod(.Object,
-                                            assayData = assayData,
-                                            phenoData = phenoData,
-                                            featureData = featureData,
-                                            ...)
-              } else stop("provide at most one of 'assayData' or 'exprs' to initialize ExpressionSet",
-                          call.=FALSE)
-              .harmonizeDimnames(.Object)
-          })
+    function(.Object, assayData, phenoData, featureData,
+             exprs=new("matrix"), ... )
+{
+    if (missing(assayData)) {
+        if (missing(phenoData))
+            phenoData <- annotatedDataFrameFrom(exprs, byrow=FALSE)
+        if (missing(featureData))
+            featureData <- annotatedDataFrameFrom(exprs, byrow=TRUE)
+        .Object <- callNextMethod(.Object,
+                                  phenoData = phenoData,
+                                  featureData = featureData,
+                                  exprs = exprs,
+                                  ...)
+    } else if (missing(exprs)) {
+        if (missing(phenoData))
+            phenoData <- annotatedDataFrameFrom(assayData, byrow=FALSE)
+        if (missing(featureData))
+            featureData <- annotatedDataFrameFrom(assayData, byrow=TRUE)
+        .Object <- callNextMethod(.Object,
+                                  assayData = assayData,
+                                  phenoData = phenoData,
+                                  featureData = featureData,
+                                  ...)
+    } else stop("provide at most one of 'assayData' or 'exprs' to initialize ExpressionSet",
+                call.=FALSE)
+    .harmonizeDimnames(.Object)
+})
 
 .harmonizeDimnames <- function(object) {
     err <- function(conflicts)
@@ -62,8 +59,10 @@ setAs("exprSet", "ExpressionSet", function(from) {
   desc <- from at description
   desc <- 
     if (class(desc)!="MIAME") {
-        warning("missing or mis-formed MIAME 'description' in original object; creating new, empty description")
-        new("MIAME")
+        txt <- "missing or mis-formed MIAME 'description' in original object;
+                creating new, empty description"
+        warning(paste0(strwrap(txt, indent=2), collapse="\n  "))
+        MIAME()
     } else updateObject(desc)
   exprs <- from at exprs
   phenoData <- as(from at phenoData, "AnnotatedDataFrame")
@@ -72,19 +71,14 @@ setAs("exprSet", "ExpressionSet", function(from) {
   if (all(dim(from at se.exprs) == dims)) {
     se.exprs <- from at se.exprs
     colnames(se.exprs) <- colnames(exprs)
-    new("ExpressionSet",
-        phenoData=phenoData,
-        experimentData=desc,
-        annotation=annotation,
-        exprs=exprs,
-        se.exprs=se.exprs)
+    .ExpressionSet(phenoData=phenoData, experimentData=desc,
+        annotation=annotation, exprs=exprs, se.exprs=se.exprs)
   } else {
-    warning("missing or mis-shaped 'se.exprs' in original object; creating ExpressionSet without se.exprs")
-    new("ExpressionSet",
-        phenoData=phenoData,
-        experimentData=desc,
-        annotation=annotation,
-        exprs=exprs)
+    txt <- "missing or mis-formed 'se.exprs' in original object;
+            creating ExpressionSet without se.exprs"
+    warning(paste0(strwrap(txt, indent=2), collapse="\n  "))
+    .ExpressionSet(phenoData=phenoData, experimentData=desc,
+                   annotation=annotation, exprs=exprs)
   }
 })
 
@@ -201,7 +195,7 @@ readExpressionSet <- function(exprsFile,
         pd = annotatedDataFrameFrom(ex, byrow=FALSE)
     }
 
-    obj = new("ExpressionSet", exprs=ex, phenoData=pd)
+    obj = ExpressionSet(ex, phenoData=pd)
 
 
     ## FIXME: these should probably added to obj before, or simultaneously to, exprs;
@@ -222,50 +216,45 @@ readExpressionSet <- function(exprsFile,
     obj
 }
 
-
-setMethod(ExpressionSet,
-          signature=signature(assayData="missing"),
+setMethod(ExpressionSet, "missing",
     function(assayData,
              phenoData=AnnotatedDataFrame(),
              featureData=AnnotatedDataFrame(),
-             experimentData=new("MIAME"), annotation=character(),
+             experimentData=MIAME(), annotation=character(),
              protocolData=AnnotatedDataFrame(),
              ...)
 {
-    new("ExpressionSet",
-        assayData=assayDataNew(exprs=matrix(0, 0, 0)),
+    .ExpressionSet(
+        assayData=assayDataNew(exprs=new("matrix")),
         phenoData=phenoData,
         featureData=featureData, experimentData=experimentData,
         annotation=annotation, protocolData=protocolData, ...)
 })
 
-setMethod(ExpressionSet,
-          signature=signature(assayData="environment"),
+setMethod(ExpressionSet, "environment",
     function(assayData,
              phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
              featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
-             experimentData=new("MIAME"), annotation=character(),
+             experimentData=MIAME(), annotation=character(),
              protocolData=annotatedDataFrameFrom(assayData, byrow=FALSE),
              ...)
 {
-    new("ExpressionSet", assayData=assayData, phenoData=phenoData,
+    .ExpressionSet(assayData=assayData, phenoData=phenoData,
         featureData=featureData, experimentData=experimentData,
         annotation=annotation, protocolData=protocolData, ...)
 })
 
 
-setMethod(ExpressionSet,
-          signature=signature(assayData="matrix"),
+setMethod(ExpressionSet, "matrix",
     function(assayData,
              phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
              featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
-             experimentData=new("MIAME"), annotation=character(),
+             experimentData=MIAME(), annotation=character(),
              protocolData=annotatedDataFrameFrom(assayData, byrow=FALSE),
              ...)
 {
     assayData <- assayDataNew(exprs=assayData)
-    new("ExpressionSet", assayData=assayData,
-        phenoData=phenoData,
+    .ExpressionSet(assayData=assayData, phenoData=phenoData,
         featureData=featureData, experimentData=experimentData,
         annotation=annotation, protocolData=protocolData, ...)
 })
diff --git a/R/methods-MIAME.R b/R/methods-MIAME.R
index 7315527..72ce938 100644
--- a/R/methods-MIAME.R
+++ b/R/methods-MIAME.R
@@ -114,18 +114,11 @@ MIAME <-
              pubMedIds = "", samples = list(),
              hybridizations = list(), normControls = list(),
              preprocessing = list(), other = list()) {
-        new("MIAME", name=name, 
-                     lab=lab,
-                     contact=contact,
-                     title=title,
-                     abstract=abstract,
-                     url=url,
-                     pubMedIds=pubMedIds,
-                     samples=samples,
-                     hybridizations=hybridizations,
-                     normControls=normControls,
-                     preprocessing=preprocessing,
-                     other=other)
+        .MIAME(name=name, lab=lab, contact=contact, title=title,
+               abstract=abstract, url=url, pubMedIds=pubMedIds,
+               samples=samples, hybridizations=hybridizations,
+               normControls=normControls, preprocessing=preprocessing,
+               other=other)
     }
 
 
@@ -133,22 +126,19 @@ MIAME <-
 read.MIAME <- function(filename=NULL,widget=getOption("BioC")$Base$use.widgets,...) {
    if(!is.null(filename)) {
       miame <- scan(filename,what="c",quiet=TRUE,sep="\n",...)
-      return(new("MIAME",name=miame[1],lab=miame[2],contact=miame[3],title=miame[4],abstract=miame[5],url=miame[6]))
+      MIAME(name=miame[1], lab=miame[2], contact=miame[3],
+            title=miame[4], abstract=miame[5], url=miame[6])
    }
    else
       if(widget) {
          require(tkWidgets) || stop("Requires tkWidgets")
          tmp <- tkMIAME()
-         return(new("MIAME",
-                name=tmp$ExperimentName,
-                lab=tmp$LabName,
-                contact=tmp$ContactInfo,
-                title=tmp$ExperimentTitle,
-                abstract=tmp$Description,
-                url=tmp$URL))
+         MIAME(name=tmp$ExperimentName, lab=tmp$LabName,
+               contact=tmp$ContactInfo, title=tmp$ExperimentTitle,
+               abstract=tmp$Description, url=tmp$URL)
       }
       else
-         return(new("MIAME"))
+         MIAME()
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 setMethod("combine", c("MIAME", "MIAME"), function(x, y, ...) {
diff --git a/R/methods-NChannelSet.R b/R/methods-NChannelSet.R
index e5a08f9..cc3f641 100644
--- a/R/methods-NChannelSet.R
+++ b/R/methods-NChannelSet.R
@@ -1,40 +1,56 @@
-setMethod("initialize",
-          signature(.Object="NChannelSet"),
-          function(.Object, assayData, phenoData,
-                   ...) {
-              mySlots <- slotNames(.Object)
-              dotArgs <- list(...)
-              isSlot <- names(dotArgs) %in% mySlots
-              if (missing(assayData)) {
-                  assayData <- do.call(assayDataNew, dotArgs[!isSlot],
-                                       envir=parent.frame())
-              }
-              if (missing(phenoData)) {
-                  phenoData <- annotatedDataFrameFrom(assayData, byrow=FALSE)
-              }
-              if (is.null(varMetadata(phenoData)[["channel"]])) {
-                  varMetadata(phenoData)[["channel"]] <- 
-                      factor(rep("_ALL_", nrow(varMetadata(phenoData))),
-                             levels=c(assayDataElementNames(assayData), "_ALL_"))
-              }
-              ## ensure sample names OK -- all assayData with names;
-              ## phenoData with correct names from assayData
-              appl <-
-                  if (storageMode(assayData)=="list") lapply
-                  else eapply
-              assaySampleNames <-
-                  appl(assayData, function(elt) {
-                      cnames <- colnames(elt)
-                      if (is.null(cnames)) sampleNames(phenoData)
-                      else cnames
-                  })
-              sampleNames(assayData) <- assaySampleNames
-              sampleNames(phenoData) <- sampleNames(assayData)
-              do.call(callNextMethod,
-                      c(.Object,
-                        assayData = assayData, phenoData = phenoData,
-                        dotArgs[isSlot]))
-          })
+NChannelSet <- .NChannelSet
+
+.init_NChannelSet <-              # copy constructor, validation
+    selectMethod(initialize, "ANY")
+
+setMethod("initialize", "NChannelSet",
+    function(.Object, assayData, phenoData, ...)
+{
+    mySlots <- slotNames(.Object)
+    dotArgs <- list(...)
+    isSlot <- names(dotArgs) %in% mySlots
+    if (missing(assayData)) {
+        assayData <- do.call(assayDataNew, dotArgs[!isSlot],
+                             envir=parent.frame())
+    }
+    if (missing(phenoData)) {
+        phenoData <- annotatedDataFrameFrom(assayData, byrow=FALSE)
+    }
+    if (is.null(varMetadata(phenoData)[["channel"]])) {
+        varMetadata(phenoData)[["channel"]] <- 
+            factor(rep("_ALL_", nrow(varMetadata(phenoData))),
+                   levels=c(assayDataElementNames(assayData), "_ALL_"))
+    }
+    ## ensure sample names OK -- all assayData with names;
+    ## phenoData with correct names from assayData
+    nms <- if (storageMode(assayData) == "list")
+        names(assayData)
+    else
+        ls(assayData)
+    assaySampleNames <- vector("list", length(nms))
+    names(assaySampleNames) <- nms
+    for (nm in nms) {
+        cnames <- colnames(assayData[[nm]])
+        assaySampleNames[[nm]] <- if (is.null(cnames)) {
+            sampleNames(phenoData)
+        } else cnames
+    }
+
+    sampleNames(assayData) <- assaySampleNames
+    sampleNames(phenoData) <- sampleNames(assayData)
+    do.call(callNextMethod,
+            c(.Object,
+              assayData = assayData, phenoData = phenoData,
+              dotArgs[isSlot]))
+})
+
+.invalid_NChannelAssayNames <- function(object)
+{
+    phenoChannels <- levels(varMetadata(object)[["channel"]])
+    assayChannels <- c("_ALL_", assayDataElementNames(object))
+    setdiff(union(assayChannels, phenoChannels),
+            intersect(assayChannels, phenoChannels))
+}
 
 setValidity("NChannelSet",
     function(object) 
@@ -50,16 +66,12 @@ setValidity("NChannelSet",
             txt <- paste("\n  'NChannelSet' varMetadata column 'channel'",
                          "must be class 'factor'")
             msg <- validMsg(msg, txt)
-        } else if (0 < length(channel)) {
-            phenoChannels <- unique(channel)
-            phenoChannels <- phenoChannels[!is.na(phenoChannels)]
-            okChannels <-
-                phenoChannels %in% c("_ALL_", channelNames(object))
-            if (!all(okChannels)) {
-                txt0 <- paste0(phenoChannels[!okChannels], collapse="', '")
-                txt <- paste0("\n  'NChannelSet' varMetadata ",
-                              "'channel' entries not in assayData: '",
-                              txt0, "'")
+        } else if (0 < length(levels(channel))) {
+            if (length(.invalid_NChannelAssayNames(object))) {
+                txt <- 'NChannelSet levels(varMetadata(object)$channel) /
+                        assayDataElementNames() mismatch; see
+                        ?"channelNames<-,NChannelSet,character-method"'
+                txt <- paste(strwrap(c("\n", txt), exdent=2), collapse="\n  ")
                 msg <- validMsg(msg, txt)
             }
         }
@@ -72,10 +84,82 @@ setValidity("NChannelSet",
     if (is.null(msg)) TRUE else msg
 })
 
-setMethod("channelNames",
-          signature = signature(
-            object = "NChannelSet"),
-          assayDataElementNames)
+.assayDataGets_NChannelSet <-
+    function(object, value)
+{
+    phenoData <- phenoData(object)
+    ## update channel names, making some attempt to preserve order
+    from <- channelNames(object)
+    to <- assayDataElementNames(value)
+    lvls <- c(from[from %in% to], to[!to %in% from], "_ALL_")
+    varMetadata(phenoData)$channel <- 
+        factor(as.character(varMetadata(phenoData)$channel), levels=lvls)
+
+    .init_NChannelSet(object, assayData=value, phenoData=phenoData)
+}
+
+setReplaceMethod("assayData", c("NChannelSet", "environment"),
+    .assayDataGets_NChannelSet)
+
+setReplaceMethod("assayData", c("NChannelSet", "list"),
+    .assayDataGets_NChannelSet)
+
+setMethod("channelNames", "NChannelSet", function(object, ...) {
+    nms <- assayDataElementNames(object)
+    lvls <- levels(varMetadata(object)$channel)
+    if (all(nms %in% lvls))
+        ## FIXME: this accomodates invalid (previous) NChannelSet instances
+        ## order to match channelNames
+        nms <- lvls[lvls %in% nms]
+    nms
+})
+
+setGeneric("channelNames<-",
+    function(object, ..., value) standardGeneric("channelNames<-"))
+
+setReplaceMethod("channelNames", c("NChannelSet", "character"),
+    function(object, ..., value)
+{
+    if (!is.null(names(value))) {
+        ## re-name & re-order
+        channelNames(object) <- as.list(value)
+    } else {
+        ## re-order
+        if (!all(sort(value) == sort(channelNames(object))))
+            stop("'value' elements must include all channelNames()")
+        varMetadata(object)$channel <-
+            factor(varMetadata(object)$channel, levels=c(value, "_ALL_"))
+        validObject(object)
+    }
+    object
+})
+
+setReplaceMethod("channelNames", c("NChannelSet", "list"),
+    function(object, ..., value)
+{
+    from <- unlist(value, use.names=FALSE)
+    if (!all(sort(from) == sort(channelNames(object))))
+       stop("'value' elements must include all channelNames()")
+    to <- names(value)
+    if (any(duplicated(to)))
+        stop("duplicated channelNames are not allowed")
+
+    assayData <- assayData(object)
+    levels(varMetadata(object)$channel) <- c(value, list("_ALL_" = "_ALL"))
+    if (is.list(assayData)) {
+        idx <- match(from, names(assayData))
+        names(assayData)[idx] <- to
+    } else {
+        env <- new.env(parent=emptyenv())
+        for (i in seq_along(value))
+            env[[ to[i] ]] = assayData[[ from[i] ]]
+        if (storageMode(object) == "lockedEnvironment")
+            assayDataEnvLock(env)
+        assayData <- env
+    }
+    assayData(object) <- assayData
+    object
+})
 
 setMethod("channel",
           signature = signature(
@@ -87,13 +171,12 @@ setMethod("channel",
                        "\n    was: '", paste0(name, collapse="', '"), "'")
               obj <- selectChannels(object, name) # subset phenoData appropriately
               sampleNames(phenoData(obj)) <- sampleNames(assayData(obj))
-              new("ExpressionSet",
+              ExpressionSet(assayData(obj)[[name]],
                   phenoData = phenoData(obj),
                   featureData = featureData(obj),
                   experimentData = experimentData(obj),
                   annotation=annotation(obj),
                   protocolData=protocolData(obj),
-                  exprs = assayData(obj)[[name]],
                   ...)
           })
 
@@ -134,25 +217,31 @@ setMethod("selectChannels",
 setMethod("sampleNames",
           signature=signature(object="NChannelSet"),
           function(object) {
-              appl <- 
-                if (storageMode(object)=="list") lapply
-                else eapply
-              res <- appl(assayData(object), colnames)
+              assayData <- assayData(object)
+              nms <- if (storageMode(object) == "list")
+                  names(assayData)
+              else
+                  ls(assayData)
+              res <- vector("list", length(nms))
+              names(res) <- nms
+              for (nm in nms)
+                  res[[nm]] <- colnames(assayData[[nm]])
               ident <- sapply(res[-1], function(elt, ref) all(elt==ref),
                               res[[1]])
               if (all(ident)) res[[1]]
               else res
           })
 
-setReplaceMethod("sampleNames",
-                 signature=signature(
-                   object="NChannelSet",
-                   value="list"),
-                 function(object, value) {
-                     sampleNames(assayData(object)) <- value
-                     sampleNames(phenoData(object)) <-
-                         sampleNames(assayData(object))
-                     sampleNames(protocolData(object)) <-
-                         sampleNames(assayData(object))
-                     object
-                 })
+setReplaceMethod("sampleNames", c("NChannelSet", "list"),
+    function(object, value)
+{
+    assayData <- assayData(object)
+    sampleNames(assayData) <- value
+    phenoData <- phenoData(object)
+    sampleNames(phenoData) <- sampleNames(assayData)
+    protocolData <- protocolData(object)
+    sampleNames(protocolData) <- sampleNames(assayData)
+
+    .init_NChannelSet(object, assayData=assayData,
+                      phenoData=phenoData, protocolData=protocolData)
+})
diff --git a/R/methods-ScalarObject.R b/R/methods-ScalarObject.R
index c0503a0..03ce0cb 100644
--- a/R/methods-ScalarObject.R
+++ b/R/methods-ScalarObject.R
@@ -1,9 +1,9 @@
 mkScalar <- function(obj) {
     switch(typeof(obj),
-           character=new("ScalarCharacter", obj),
-           logical=new("ScalarLogical", obj),
-           integer=new("ScalarInteger", obj),
-           double=new("ScalarNumeric", obj),
+           character=.ScalarCharacter(obj),
+           logical=.ScalarLogical(obj),
+           integer=.ScalarInteger(obj),
+           double=.ScalarNumeric(obj),
            stop("no scalar class implemented for type: ", typeof(obj)))
 }
 
diff --git a/R/methods-SnpSet.R b/R/methods-SnpSet.R
index 8e03efd..0131d65 100644
--- a/R/methods-SnpSet.R
+++ b/R/methods-SnpSet.R
@@ -4,7 +4,7 @@ setMethod("initialize", "SnpSet",
                                             callProbability = callProbability, ...),
                    phenoData = annotatedDataFrameFrom(assayData, byrow=FALSE),
                    featureData = annotatedDataFrameFrom(assayData, byrow=TRUE),
-                   experimentData = new("MIAME"),
+                   experimentData = MIAME(),
                    annotation = character(),
                    protocolData = phenoData[,integer(0)],
                    call = new("matrix"),
diff --git a/R/methods-VersionedClass.R b/R/methods-VersionedClass.R
index b3699dc..5a128fa 100644
--- a/R/methods-VersionedClass.R
+++ b/R/methods-VersionedClass.R
@@ -54,7 +54,7 @@ setMethod("isVersioned", signature(object="Versioned"),
 ## classVersion
 
 setMethod("classVersion", signature(object="ANY"),
-          function(object) new("VersionsNull"))
+          function(object) .VersionsNull())
 
 setMethod("classVersion", signature(object="character"),
           function(object) {
diff --git a/R/methods-VersionsNull.R b/R/methods-VersionsNull.R
index d3d4f82..7e47a79 100644
--- a/R/methods-VersionsNull.R
+++ b/R/methods-VersionsNull.R
@@ -4,7 +4,7 @@
 setMethod("initialize", signature(.Object="VersionsNull"),
           function(.Object, ...) {
               if (length(list(...)))
-                warning("ignoring arguments to new('VersionsNull')")
+                warning("ignoring arguments to '.VersionsNull()')")
               .Object
           })
 
diff --git a/R/methods-container.R b/R/methods-container.R
index e04a513..b79625d 100644
--- a/R/methods-container.R
+++ b/R/methods-container.R
@@ -5,7 +5,7 @@ setMethod("locked", "container", function(object) object at locked)
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 setMethod("[", "container",
    def = function(x, i, j, ..., drop = F) {
-      new("container", content = content(x), x = x at x[i], locked = locked(x))
+      .container(content = content(x), x = x at x[i], locked = locked(x))
    }
 )
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/R/methods-eSet.R b/R/methods-eSet.R
index 784fe43..05fe104 100644
--- a/R/methods-eSet.R
+++ b/R/methods-eSet.R
@@ -1,75 +1,68 @@
 # ==========================================================================
 # eSet Class Validator
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-setMethod("initialize",
-          signature(.Object="eSet"),
-          function(.Object,
-                   assayData,
-                   phenoData = annotatedDataFrameFrom(assayData, byrow=FALSE),
-                   featureData = annotatedDataFrameFrom(assayData, byrow=TRUE),
-                   experimentData = new("MIAME"),
-                   annotation = character(0),
-                   protocolData = phenoData[,integer(0)],
-                   ...) {
-              ## NB: Arguments provided in '...' are used to initialize
-              ## slots if possible (when called from some subclass).
-              ## Otherwise, extra args in '...' are added as elements
-              ## to assayData.  We do this to allow subclasses to
-              ## rely on default contructor behavior for initializing
-              ## slots.
-              ##
-              ## NB2: Extra args to the assayData constructor will
-              ## be passed along as long as current class doesn't
-              ## have a slot with a matching name.
-              mySlots <- slotNames(.Object)
-              dotArgs <- list(...)
-              isSlot <- names(dotArgs) %in% mySlots
-              if (missing(assayData))
-                assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir=parent.frame())
-              else {
-                  checkClass(assayData, "AssayData", class(.Object))
-                  nms <-
-                    if (storageMode(assayData)=="list") names(assayData)
-                    else ls(assayData)
-                  dupNames <- nms %in% names(dotArgs[!isSlot])
-                  if (any(dupNames))
-                    warning("initialize argument(s) '",
-                            paste(nms[dupNames], collapse="' '"),
-                            "' also present in 'assayData'; argument(s) ignored")
-              }
-              if (!missing(phenoData))
-                checkClass(phenoData, "AnnotatedDataFrame", class(.Object))
-              dimLabels(phenoData) <- c("sampleNames", "sampleColumns")
-              if (!missing(featureData))
-                checkClass(featureData, "AnnotatedDataFrame", class(.Object))
-              dimLabels(featureData) <- c("featureNames", "featureColumns")
-              ## create the protocolData, if necessary
-              if (!missing(protocolData)) {
-                checkClass(protocolData, "AnnotatedDataFrame", class(.Object))
-                dimLabels(protocolData) <- c("sampleNames", "sampleColumns")
-              }
-              ## coordinate sample names
-              adSampleNames <- sampleNames(assayData)
-              if (all(sapply(adSampleNames, is.null)))
-                sampleNames(assayData) <- sampleNames(phenoData)
-              pdSampleNames <- sampleNames(protocolData)
-              if (all(sapply(pdSampleNames, is.null)))
-                sampleNames(protocolData) <- sampleNames(phenoData)
-              ## where do feature names come from? assayData or featureData
-              adFeatureNames <- featureNames(assayData)
-              if (all(sapply(adFeatureNames, is.null)))
-                featureNames(assayData) <- featureNames(featureData)
-              ## create new instance from 'extra' dotArgs, and from instance
-              for (s in names(dotArgs)[isSlot])
-                slot(.Object, s) <- dotArgs[[s]]
-              callNextMethod(.Object,
-                             assayData=assayData,
-                             phenoData=phenoData,
-                             featureData=featureData,
-                             experimentData=experimentData,
-                             annotation=annotation,
-                             protocolData=protocolData)
-          })
+setMethod("initialize", signature(.Object="eSet"),
+    function(.Object, assayData,
+        phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
+        featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
+        experimentData=MIAME(), annotation=character(0),
+        protocolData=phenoData[,integer(0)], ...)
+{
+    ## NB: Arguments provided in '...' are used to initialize
+    ## slots if possible (when called from some subclass).
+    ## Otherwise, extra args in '...' are added as elements
+    ## to assayData.  We do this to allow subclasses to
+    ## rely on default contructor behavior for initializing
+    ## slots.
+    ##
+    ## NB2: Extra args to the assayData constructor will
+    ## be passed along as long as current class doesn't
+    ## have a slot with a matching name.
+    mySlots <- slotNames(.Object)
+    dotArgs <- list(...)
+    isSlot <- names(dotArgs) %in% mySlots
+    if (missing(assayData))
+        assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir=parent.frame())
+    else {
+        checkClass(assayData, "AssayData", class(.Object))
+        nms <-
+            if (storageMode(assayData)=="list") names(assayData)
+            else ls(assayData)
+        dupNames <- nms %in% names(dotArgs[!isSlot])
+        if (any(dupNames))
+            warning("initialize argument(s) '",
+                    paste(nms[dupNames], collapse="' '"),
+                    "' also present in 'assayData'; argument(s) ignored")
+    }
+    if (!missing(phenoData))
+        checkClass(phenoData, "AnnotatedDataFrame", class(.Object))
+    dimLabels(phenoData) <- c("sampleNames", "sampleColumns")
+    if (!missing(featureData))
+        checkClass(featureData, "AnnotatedDataFrame", class(.Object))
+    dimLabels(featureData) <- c("featureNames", "featureColumns")
+    ## create the protocolData, if necessary
+    if (!missing(protocolData)) {
+        checkClass(protocolData, "AnnotatedDataFrame", class(.Object))
+        dimLabels(protocolData) <- c("sampleNames", "sampleColumns")
+    }
+    ## coordinate sample names
+    adSampleNames <- sampleNames(assayData)
+    if (all(sapply(adSampleNames, is.null)))
+        sampleNames(assayData) <- sampleNames(phenoData)
+    pdSampleNames <- sampleNames(protocolData)
+    if (all(sapply(pdSampleNames, is.null)))
+        sampleNames(protocolData) <- sampleNames(phenoData)
+    ## where do feature names come from? assayData or featureData
+    adFeatureNames <- featureNames(assayData)
+    if (all(sapply(adFeatureNames, is.null)))
+        featureNames(assayData) <- featureNames(featureData)
+    ## create new instance from 'extra' dotArgs, and from instance
+    for (s in names(dotArgs)[isSlot])
+        slot(.Object, s) <- dotArgs[[s]]
+    callNextMethod(.Object, assayData=assayData, phenoData=phenoData,
+                   featureData=featureData, experimentData=experimentData,
+                   annotation=annotation, protocolData=protocolData)
+})
 
 updateOldESet <- function(from, toClass, ...) {  # to MultiExpressionSet
   from <- asS4(from)
@@ -91,7 +84,7 @@ updateOldESet <- function(from, toClass, ...) {  # to MultiExpressionSet
   }
   ## phenoData
   pData <- ophenoData at pData
-  phenoData <- new("AnnotatedDataFrame", data=pData, varMetadata=metadata)
+  phenoData <- AnnotatedDataFrame(data=pData, varMetadata=metadata)
   ## sampleNames
   if (any(sampleNames(assayData(from))!=sampleNames(phenoData))) {
     warning("creating assayData colnames from phenoData sampleNames")
@@ -179,7 +172,7 @@ setMethod("updateObject", signature(object="eSet"),
                   do.call(new,
                           c(list(class(object),
                                  assayData = updateObject(assayData(object), ..., verbose=verbose),
-                                 phenoData = new("AnnotatedDataFrame", data=pData(object),
+                                 phenoData = AnnotatedDataFrame(data=pData(object),
                                                  varMetadata=varMetadata(object)),
                                  featureData = annotatedDataFrameFrom(assayData(object), byrow=TRUE),
                                  experimentData = updateObject(experimentData(object), ..., verbose=verbose),
diff --git a/R/rowOp-methods.R b/R/rowOp-methods.R
index e1faeec..bc8bd08 100644
--- a/R/rowOp-methods.R
+++ b/R/rowOp-methods.R
@@ -1,17 +1,25 @@
-setGeneric("rowMedians", function(imat, na.rm=FALSE) {
+setGeneric("rowMedians", function(x, na.rm=FALSE, ...) {
+  # Backward compatibility for rowMedians(imat=...)
+  if (missing(x)) {
+    args <- list(...);
+    if (is.element("imat", names(args))) {
+      x <- args$imat;
+      .Deprecated(msg="The name of the matrix argument for Biobase::rowMedians() has been changed from 'imat' to 'x'.");
+    }
+  }
   standardGeneric("rowMedians")
 })
 
 
-setMethod("rowMedians", signature(imat="matrix"), function(imat, na.rm=FALSE) {
+setMethod("rowMedians", signature(x="matrix"), function(x, na.rm=FALSE, ...) {
   na.rm <- as.logical(na.rm);
   hasNAs <- TRUE;  # Add as an argument? /2007-08-24
-  .Call("rowMedians", imat, na.rm, hasNAs, PACKAGE="Biobase");
+  .Call("rowMedians", x, na.rm, hasNAs, TRUE, PACKAGE="Biobase");
 })
 
 
-setMethod("rowMedians", signature(imat="ExpressionSet"), function(imat, na.rm=FALSE) {
-  rowMedians(exprs(imat), na.rm=na.rm);
+setMethod("rowMedians", signature(x="ExpressionSet"), function(x, na.rm=FALSE, ...) {
+  rowMedians(exprs(x), na.rm=na.rm, ...);
 })
 
 
diff --git a/build/vignette.rds b/build/vignette.rds
new file mode 100644
index 0000000..e8cce3d
Binary files /dev/null and b/build/vignette.rds differ
diff --git a/inst/UnitTests/Makefile b/inst/UnitTests/Makefile
deleted file mode 100644
index 752bce2..0000000
--- a/inst/UnitTests/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TOP=../../..
-RUNIT_DIR=$(shell pwd)
-INST_PATH=$(shell dirname ${RUNIT_DIR})
-PKG_PATH=$(shell dirname ${INST_PATH})
-
-all: install test
-
-install:
-	cd ${TOP}; \
-	"$(R_HOME)/bin/R" CMD INSTALL --clean ${PKG_PATH} && \
-	cd ${RUNIT_DIR}
-
-test:
-	"$(R_HOME)/bin/R" --slave < runalltests.R
-
-%.R: FORCE
-	./runfile.sh $@
-
-FORCE:
diff --git a/inst/UnitTests/runall.sh b/inst/UnitTests/runall.sh
deleted file mode 100755
index 9065338..0000000
--- a/inst/UnitTests/runall.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-R --slave < runalltests.R
diff --git a/inst/UnitTests/runalltests.R b/inst/UnitTests/runalltests.R
deleted file mode 100644
index d14994c..0000000
--- a/inst/UnitTests/runalltests.R
+++ /dev/null
@@ -1,18 +0,0 @@
-library("Biobase")
-library("RUnit")
-
-options(warn=1)
-
-dirs <- '.'
-## dirs <- system.file("UnitTests", package="Biobase"),
-testFilePat <- ".*_test\\.R$"
-
-allSuite <- defineTestSuite(name="allSuite",
-                            dirs=dirs,
-                            testFileRegexp=testFilePat,
-                            rngKind="default",
-                            rngNormalKind="default")
-
-testData <- runTestSuite(allSuite)
-printTextProtocol(testData, showDetails=FALSE)
-
diff --git a/inst/UnitTests/runfile.sh b/inst/UnitTests/runfile.sh
deleted file mode 100755
index e7d2789..0000000
--- a/inst/UnitTests/runfile.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-TEST_FILE=$1
-R --slave <<-EOF
-	library('RUnit')
-	library('Biobase')
-	res <- runTestFile('${TEST_FILE}',
-    	rngKind='default', rngNormalKind='default')
-	printTextProtocol(res, showDetails=FALSE)
-EOF
diff --git a/inst/doc/BiobaseDevelopment.pdf b/inst/doc/BiobaseDevelopment.pdf
index 4733533..57ad635 100644
Binary files a/inst/doc/BiobaseDevelopment.pdf and b/inst/doc/BiobaseDevelopment.pdf differ
diff --git a/inst/doc/Bioconductor.pdf b/inst/doc/Bioconductor.pdf
index 93d9b41..0d6bdf8 100644
Binary files a/inst/doc/Bioconductor.pdf and b/inst/doc/Bioconductor.pdf differ
diff --git a/inst/doc/ExpressionSetIntroduction.pdf b/inst/doc/ExpressionSetIntroduction.pdf
index 4e702f8..0556913 100644
Binary files a/inst/doc/ExpressionSetIntroduction.pdf and b/inst/doc/ExpressionSetIntroduction.pdf differ
diff --git a/inst/doc/HowTo.pdf b/inst/doc/HowTo.pdf
index eea95a0..c0d25dc 100644
Binary files a/inst/doc/HowTo.pdf and b/inst/doc/HowTo.pdf differ
diff --git a/inst/doc/Qviews.pdf b/inst/doc/Qviews.pdf
index 4cab84d..42d60b3 100644
Binary files a/inst/doc/Qviews.pdf and b/inst/doc/Qviews.pdf differ
diff --git a/inst/doc/esApply.pdf b/inst/doc/esApply.pdf
index 12f848a..b192161 100644
Binary files a/inst/doc/esApply.pdf and b/inst/doc/esApply.pdf differ
diff --git a/inst/UnitTests/VersionedClass_data/1.8/AnnotatedDataFrame.Rda b/inst/unitTests/VersionedClass_data/1.8/AnnotatedDataFrame.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/1.8/AnnotatedDataFrame.Rda
rename to inst/unitTests/VersionedClass_data/1.8/AnnotatedDataFrame.Rda
diff --git a/inst/UnitTests/VersionedClass_data/1.8/ExpressionSet.Rda b/inst/unitTests/VersionedClass_data/1.8/ExpressionSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/1.8/ExpressionSet.Rda
rename to inst/unitTests/VersionedClass_data/1.8/ExpressionSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/1.8/MIAME.Rda b/inst/unitTests/VersionedClass_data/1.8/MIAME.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/1.8/MIAME.Rda
rename to inst/unitTests/VersionedClass_data/1.8/MIAME.Rda
diff --git a/inst/UnitTests/VersionedClass_data/1.8/exprSet.Rda b/inst/unitTests/VersionedClass_data/1.8/exprSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/1.8/exprSet.Rda
rename to inst/unitTests/VersionedClass_data/1.8/exprSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/1.8/phenoData.Rda b/inst/unitTests/VersionedClass_data/1.8/phenoData.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/1.8/phenoData.Rda
rename to inst/unitTests/VersionedClass_data/1.8/phenoData.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/AnnotatedDataFrame.Rda b/inst/unitTests/VersionedClass_data/2.0/AnnotatedDataFrame.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/AnnotatedDataFrame.Rda
rename to inst/unitTests/VersionedClass_data/2.0/AnnotatedDataFrame.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/ExpressionSet.Rda b/inst/unitTests/VersionedClass_data/2.0/ExpressionSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/ExpressionSet.Rda
rename to inst/unitTests/VersionedClass_data/2.0/ExpressionSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/MIAME.Rda b/inst/unitTests/VersionedClass_data/2.0/MIAME.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/MIAME.Rda
rename to inst/unitTests/VersionedClass_data/2.0/MIAME.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/MultiSet.Rda b/inst/unitTests/VersionedClass_data/2.0/MultiSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/MultiSet.Rda
rename to inst/unitTests/VersionedClass_data/2.0/MultiSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/ScalarCharacter.Rda b/inst/unitTests/VersionedClass_data/2.0/ScalarCharacter.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/ScalarCharacter.Rda
rename to inst/unitTests/VersionedClass_data/2.0/ScalarCharacter.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/SnpSet.Rda b/inst/unitTests/VersionedClass_data/2.0/SnpSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/SnpSet.Rda
rename to inst/unitTests/VersionedClass_data/2.0/SnpSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/Versioned.Rda b/inst/unitTests/VersionedClass_data/2.0/Versioned.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/Versioned.Rda
rename to inst/unitTests/VersionedClass_data/2.0/Versioned.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/VersionedBiobase.Rda b/inst/unitTests/VersionedClass_data/2.0/VersionedBiobase.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/VersionedBiobase.Rda
rename to inst/unitTests/VersionedClass_data/2.0/VersionedBiobase.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/Versions.Rda b/inst/unitTests/VersionedClass_data/2.0/Versions.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/Versions.Rda
rename to inst/unitTests/VersionedClass_data/2.0/Versions.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/VersionsNull.Rda b/inst/unitTests/VersionedClass_data/2.0/VersionsNull.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/VersionsNull.Rda
rename to inst/unitTests/VersionedClass_data/2.0/VersionsNull.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/aggregator.Rda b/inst/unitTests/VersionedClass_data/2.0/aggregator.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/aggregator.Rda
rename to inst/unitTests/VersionedClass_data/2.0/aggregator.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/container.Rda b/inst/unitTests/VersionedClass_data/2.0/container.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/container.Rda
rename to inst/unitTests/VersionedClass_data/2.0/container.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/exprSet.Rda b/inst/unitTests/VersionedClass_data/2.0/exprSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/exprSet.Rda
rename to inst/unitTests/VersionedClass_data/2.0/exprSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/2.0/phenoData.Rda b/inst/unitTests/VersionedClass_data/2.0/phenoData.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/2.0/phenoData.Rda
rename to inst/unitTests/VersionedClass_data/2.0/phenoData.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/AnnotatedDataFrame.Rda b/inst/unitTests/VersionedClass_data/devel/AnnotatedDataFrame.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/AnnotatedDataFrame.Rda
rename to inst/unitTests/VersionedClass_data/devel/AnnotatedDataFrame.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/ExpressionSet.Rda b/inst/unitTests/VersionedClass_data/devel/ExpressionSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/ExpressionSet.Rda
rename to inst/unitTests/VersionedClass_data/devel/ExpressionSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/MIAME.Rda b/inst/unitTests/VersionedClass_data/devel/MIAME.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/MIAME.Rda
rename to inst/unitTests/VersionedClass_data/devel/MIAME.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/MultiSet.Rda b/inst/unitTests/VersionedClass_data/devel/MultiSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/MultiSet.Rda
rename to inst/unitTests/VersionedClass_data/devel/MultiSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/NChannelSet.Rda b/inst/unitTests/VersionedClass_data/devel/NChannelSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/NChannelSet.Rda
rename to inst/unitTests/VersionedClass_data/devel/NChannelSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/SWPD.rda b/inst/unitTests/VersionedClass_data/devel/SWPD.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/SWPD.rda
rename to inst/unitTests/VersionedClass_data/devel/SWPD.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/ScalarCharacter.Rda b/inst/unitTests/VersionedClass_data/devel/ScalarCharacter.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/ScalarCharacter.Rda
rename to inst/unitTests/VersionedClass_data/devel/ScalarCharacter.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/ScalarInteger.Rda b/inst/unitTests/VersionedClass_data/devel/ScalarInteger.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/ScalarInteger.Rda
rename to inst/unitTests/VersionedClass_data/devel/ScalarInteger.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/ScalarLogical.Rda b/inst/unitTests/VersionedClass_data/devel/ScalarLogical.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/ScalarLogical.Rda
rename to inst/unitTests/VersionedClass_data/devel/ScalarLogical.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/ScalarNumeric.Rda b/inst/unitTests/VersionedClass_data/devel/ScalarNumeric.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/ScalarNumeric.Rda
rename to inst/unitTests/VersionedClass_data/devel/ScalarNumeric.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/SnpSet.Rda b/inst/unitTests/VersionedClass_data/devel/SnpSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/SnpSet.Rda
rename to inst/unitTests/VersionedClass_data/devel/SnpSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/Versioned.Rda b/inst/unitTests/VersionedClass_data/devel/Versioned.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/Versioned.Rda
rename to inst/unitTests/VersionedClass_data/devel/Versioned.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/VersionedBiobase.Rda b/inst/unitTests/VersionedClass_data/devel/VersionedBiobase.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/VersionedBiobase.Rda
rename to inst/unitTests/VersionedClass_data/devel/VersionedBiobase.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/Versions.Rda b/inst/unitTests/VersionedClass_data/devel/Versions.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/Versions.Rda
rename to inst/unitTests/VersionedClass_data/devel/Versions.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/VersionsNull.Rda b/inst/unitTests/VersionedClass_data/devel/VersionsNull.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/VersionsNull.Rda
rename to inst/unitTests/VersionedClass_data/devel/VersionsNull.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/aggregator.Rda b/inst/unitTests/VersionedClass_data/devel/aggregator.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/aggregator.Rda
rename to inst/unitTests/VersionedClass_data/devel/aggregator.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/bbsym.rda b/inst/unitTests/VersionedClass_data/devel/bbsym.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/bbsym.rda
rename to inst/unitTests/VersionedClass_data/devel/bbsym.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/container.Rda b/inst/unitTests/VersionedClass_data/devel/container.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/container.Rda
rename to inst/unitTests/VersionedClass_data/devel/container.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/eset.rda b/inst/unitTests/VersionedClass_data/devel/eset.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/eset.rda
rename to inst/unitTests/VersionedClass_data/devel/eset.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/exprSet.Rda b/inst/unitTests/VersionedClass_data/devel/exprSet.Rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/exprSet.Rda
rename to inst/unitTests/VersionedClass_data/devel/exprSet.Rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/golubMergeSub.rda b/inst/unitTests/VersionedClass_data/devel/golubMergeSub.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/golubMergeSub.rda
rename to inst/unitTests/VersionedClass_data/devel/golubMergeSub.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/sample.eSet.rda b/inst/unitTests/VersionedClass_data/devel/sample.eSet.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/sample.eSet.rda
rename to inst/unitTests/VersionedClass_data/devel/sample.eSet.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/sample.exprSet.1.rda b/inst/unitTests/VersionedClass_data/devel/sample.exprSet.1.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/sample.exprSet.1.rda
rename to inst/unitTests/VersionedClass_data/devel/sample.exprSet.1.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/sample.exprSet.rda b/inst/unitTests/VersionedClass_data/devel/sample.exprSet.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/sample.exprSet.rda
rename to inst/unitTests/VersionedClass_data/devel/sample.exprSet.rda
diff --git a/inst/UnitTests/VersionedClass_data/devel/swrep.rda b/inst/unitTests/VersionedClass_data/devel/swrep.rda
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/devel/swrep.rda
rename to inst/unitTests/VersionedClass_data/devel/swrep.rda
diff --git a/inst/UnitTests/VersionedClass_data/raw/exprs.tab b/inst/unitTests/VersionedClass_data/raw/exprs.tab
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/raw/exprs.tab
rename to inst/unitTests/VersionedClass_data/raw/exprs.tab
diff --git a/inst/UnitTests/VersionedClass_data/raw/pData.tab b/inst/unitTests/VersionedClass_data/raw/pData.tab
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/raw/pData.tab
rename to inst/unitTests/VersionedClass_data/raw/pData.tab
diff --git a/inst/UnitTests/VersionedClass_data/raw/varMetadata.tab b/inst/unitTests/VersionedClass_data/raw/varMetadata.tab
similarity index 100%
rename from inst/UnitTests/VersionedClass_data/raw/varMetadata.tab
rename to inst/unitTests/VersionedClass_data/raw/varMetadata.tab
diff --git a/inst/UnitTests/AnnotatedDataFrame_test.R b/inst/unitTests/test_AnnotatedDataFrame.R
similarity index 87%
rename from inst/UnitTests/AnnotatedDataFrame_test.R
rename to inst/unitTests/test_AnnotatedDataFrame.R
index 9418788..892e0b0 100644
--- a/inst/UnitTests/AnnotatedDataFrame_test.R
+++ b/inst/unitTests/test_AnnotatedDataFrame.R
@@ -4,7 +4,8 @@ obj1 <- new("AnnotatedDataFrame",
               row.names=LETTERS[1:10]),
             varMetadata=data.frame(
               labelDescription=names(dat),
-              class=sapply(dat, class), typeof=sapply(dat, typeof), mode=sapply(dat, mode),
+              class=sapply(dat, class), typeof=sapply(dat, typeof),
+              mode=sapply(dat, mode),
               row.names=c("x","y","z")))
 
 obj2 <- local({
@@ -14,9 +15,10 @@ obj2 <- local({
 })
 
 checkAsp <- function(obj1, obj) {
-    checkTrue(all(sapply(obj[,colnames(obj1), drop=FALSE], typeof)==sapply(obj1, typeof)))
-    checkTrue(all(sapply(obj[,colnames(obj1), drop=FALSE], class)==sapply(obj1, class)))
-    checkTrue(all(sapply(obj[,colnames(obj1), drop=FALSE], mode)==sapply(obj1, mode)))
+    cidx <- colnames(obj1)
+    checkTrue(all(sapply(obj[,cidx, drop=FALSE], typeof)==sapply(obj1, typeof)))
+    checkTrue(all(sapply(obj[,cidx, drop=FALSE], class)==sapply(obj1, class)))
+    checkTrue(all(sapply(obj[,cidx, drop=FALSE], mode)==sapply(obj1, mode)))
 }
 checkData <- function(obj1, obj2, obj) {
     checkTrue(all(colnames(obj1) %in% colnames(obj)))
@@ -115,6 +117,13 @@ testVarMetadataAssign <- function() {
     df <- data.frame(labelDescription="foo", row.names="Sample")
     varMetadata(to) <- df
     checkTrue(validObject(to))
+
+    ## avoid varMetatadata duplication via partial match
+    ## https://stat.ethz.ch/pipermail/bioconductor/2014-February/057883.html
+    adf <- AnnotatedDataFrame(data.frame(xx=1:5))
+    varMetadata(adf)["xx", "labelDescription"] <- "lbl"
+    adf$x <- 1:5
+    checkIdentical(c("lbl", NA), varMetadata(adf)$labelDescription)
 }
 
 testMetadataFactors <- function() {
@@ -158,8 +167,8 @@ testPhenoDataFactors <- function() {
     obj <- combine(obj1, obj2)
     checkTrue(all(pData(obj)[1:nrow(obj1),colnames(pData(obj1)),drop=FALSE]==
                   pData(obj1)))
-    checkTrue(all(pData(obj)[nrow(obj1)+1:nrow(obj2),colnames(pData(obj2)),drop=FALSE]==
-                  pData(obj2)))
+    checkTrue(all(pData(obj)[nrow(obj1)+1:nrow(obj2),colnames(pData(obj2)),
+                             drop=FALSE] == pData(obj2)))
 }
 
 testDimLabels <- function() {
@@ -285,3 +294,26 @@ testAnnotatedDataFrameFrom <- function() {
     a <- annotatedDataFrameFrom(ad, byrow=FALSE)
     checkIdentical(LETTERS[1:10], sampleNames(a))
 }
+
+testAnnotatedDataFrameDimnames <- function() {
+    adf0 <- AnnotatedDataFrame(data.frame(x=1:5, y=5:1, row.names=letters[1:5]),
+                              data.frame(foo=1:2, row.names=c("x", "y")))
+    adf <- adf0
+    dimnames(adf) <- dimnames(adf)
+    checkIdentical(adf0, adf)
+
+    adf <- adf0
+    exp <- list(LETTERS[seq_len(nrow(adf0))], letters[seq_len(ncol(adf0))])
+    dimnames(adf) <- exp
+    checkIdentical(exp, dimnames(adf))
+
+    df0 <- varMetadata(adf0)
+    rownames(df0) <- exp[[2]]
+    checkIdentical(df0, varMetadata(adf))
+
+    adf <- adf0
+    dimnames(adf) <- NULL
+    checkTrue(validObject(adf))
+    checkIdentical(list(as.character(1:5), colnames(adf0)), dimnames(adf))
+}
+    
diff --git a/inst/UnitTests/AssayData_test.R b/inst/unitTests/test_AssayData.R
similarity index 100%
rename from inst/UnitTests/AssayData_test.R
rename to inst/unitTests/test_AssayData.R
diff --git a/inst/UnitTests/DataClasses_test.R b/inst/unitTests/test_DataClasses.R
similarity index 100%
rename from inst/UnitTests/DataClasses_test.R
rename to inst/unitTests/test_DataClasses.R
diff --git a/inst/UnitTests/EsetSubclasses_test.R b/inst/unitTests/test_EsetSubclasses.R
similarity index 99%
rename from inst/UnitTests/EsetSubclasses_test.R
rename to inst/unitTests/test_EsetSubclasses.R
index 61c16a8..06542f7 100644
--- a/inst/UnitTests/EsetSubclasses_test.R
+++ b/inst/unitTests/test_EsetSubclasses.R
@@ -421,7 +421,7 @@ testSetAs <- function() {
   opts <- options()
   options(warn=-1)
   ## would like to be able to specify storage.mode, but how to specify?...
-  fp <- system.file(package="Biobase", "UnitTests",
+  fp <- system.file(package="Biobase", "unitTests",
                     "VersionedClass_data", "devel", "exprSet.Rda")
   load(fp)
   suppressMessages(e <- as(exprSet,"ExpressionSet"))
@@ -434,7 +434,7 @@ testSetAs <- function() {
   pubMedIds(gm) = "10521349"
   checkNewGolubMerge(gm,Golub_Merge)
 
-  fp <- system.file(package="Biobase", "UnitTests",
+  fp <- system.file(package="Biobase", "unitTests",
                     "VersionedClass_data", "devel", "sample.eSet.rda")
   load(fp)
   suppressMessages(es <- updateOldESet(sample.eSet, "SwirlSet"))
diff --git a/inst/UnitTests/ExpressionSet_test.R b/inst/unitTests/test_ExpressionSet.R
similarity index 100%
rename from inst/UnitTests/ExpressionSet_test.R
rename to inst/unitTests/test_ExpressionSet.R
diff --git a/inst/UnitTests/NChannelSet_test.R b/inst/unitTests/test_NChannelSet.R
similarity index 84%
rename from inst/UnitTests/NChannelSet_test.R
rename to inst/unitTests/test_NChannelSet.R
index 1ea6849..a2f49ba 100644
--- a/inst/UnitTests/NChannelSet_test.R
+++ b/inst/unitTests/test_NChannelSet.R
@@ -62,7 +62,8 @@ testNew5 <- function() {
                        y=numeric(ncol(R)),
                        z=numeric(ncol(R)))
     varMetadata <- data.frame(labelDescription=character(ncol(data)),
-                              channel=factor(rep("_ALL_", ncol(data))))
+                              channel=factor(rep("_ALL_", ncol(data)),
+                                levels=c("R", "G", "_ALL_")))
     phenoData <- new("AnnotatedDataFrame",
                      data=data, varMetadata=varMetadata)
 
@@ -106,6 +107,20 @@ testNew6 <- function() {
     checkTrue(validObject(obj))
 }
 
+testAssayDataGets <- function() {
+    assayData <- assayDataNew(R = matrix(0, 10, 5), G = matrix(1,10,5))
+    obj <- NChannelSet(assayData = assayData)
+    exp <- -1 * assayData(obj)[["G"]]
+    assayDataElement(obj, "G") <- exp
+    checkIdentical(exp, assayData(obj)[["G"]])
+
+    exp <- assayData(obj)[["R"]]
+    assayDataElement(obj, "G") <- NULL
+    checkIdentical("R", channelNames(obj))
+    checkIdentical("R", assayDataElementNames(obj))
+    checkIdentical(exp, assayData(obj)[["R"]])
+}
+
 testDifferentSampleNames <- function() {
     ## channels have different identifiers
     assayData <- assayDataNew(R = matrix(0,10,5,
@@ -126,8 +141,7 @@ testSampleNamesUpdate <- function() {
     checkTrue(validObject(obj))
     checkTrue(all(sampleNames(obj)[["R"]] == LETTERS[1:5]))
 
-    sampleNames(obj) <- list(R=LETTERS[5:1],
-                             G=letters[5:1])
+    sampleNames(obj) <- list(R=LETTERS[5:1], G=letters[5:1])
     checkTrue(validObject(obj))
     checkTrue(all(sampleNames(obj)[["R"]] == LETTERS[5:1]) &&
               all(sampleNames(obj)[["G"]] == letters[5:1]))
@@ -219,4 +233,25 @@ testChannel <- function() {
     checkIdentical(assayDataElementNames(gobj), "exprs")
 }
 
+testChannelNames_replace <- function()
+{
+    obj <- NChannelSet(R=matrix(-1, 5, 5), G=matrix(1, 5, 5))
+    checkIdentical(c("G", "R"), channelNames(obj))
+    channelNames(obj) <- c(Gn="G", Rd="R")   ## rename
+    checkIdentical(c("Gn", "Rd"), channelNames(obj))
+    channelNames(obj) <- c("Rd", "Gn")       ## reorder
+    checkIdentical(c("Rd", "Gn"), channelNames(obj))
+    checkTrue(all(assayData(obj)[["Gn"]] == 1))
+
+    exp <- "'value' elements must include all channelNames()"
+    obs <- tryCatch(channelNames(obj) <- "X", error=conditionMessage)
+    checkIdentical(exp, obs)
+    obs <- tryCatch(channelNames(obj) <- c(X="Gn"), error=conditionMessage)
+    checkIdentical(exp, obs)
 
+    exp <- "duplicated channelNames are not allowed"
+    obs <- tryCatch(channelNames(obj) <- c(X="Gn", X="Rd"),
+                    error=conditionMessage)
+    checkIdentical(exp, obs)
+   
+}
diff --git a/inst/UnitTests/SnpSet_test.R b/inst/unitTests/test_SnpSet.R
similarity index 100%
rename from inst/UnitTests/SnpSet_test.R
rename to inst/unitTests/test_SnpSet.R
diff --git a/inst/UnitTests/UpdateObject_test.R b/inst/unitTests/test_UpdateObject.R
similarity index 94%
rename from inst/UnitTests/UpdateObject_test.R
rename to inst/unitTests/test_UpdateObject.R
index cdbddcc..3395fda 100644
--- a/inst/UnitTests/UpdateObject_test.R
+++ b/inst/unitTests/test_UpdateObject.R
@@ -71,19 +71,19 @@ testUpdateESetMisc <- function() {
     fun <- function(nm)
         isS4(eval(parse(text=paste(nm,"(obj)", sep=""))))
 
-    load(system.file("UnitTests", "VersionedClass_data", "devel",
+    load(system.file("unitTests", "VersionedClass_data", "devel",
                      "sample.exprSet.rda", package="Biobase"))
     suppressMessages(obj <- as(sample.exprSet, "ExpressionSet"))
     checkTrue(validObject(obj, complete=TRUE))
     checkTrue(all(sapply(idx, fun)))
 
-    load(system.file("UnitTests", "VersionedClass_data", "devel",
+    load(system.file("unitTests", "VersionedClass_data", "devel",
                      "sample.eSet.rda", package="Biobase"))
     obj <- as(sample.eSet, "MultiSet")
     checkTrue(validObject(obj, complete=TRUE))
     checkTrue(all(sapply(idx, fun)))
 
-    load(system.file("UnitTests", "VersionedClass_data", "devel", "eset.rda",
+    load(system.file("unitTests", "VersionedClass_data", "devel", "eset.rda",
                      package="Biobase"))
     obj <- as(eset, "ExpressionSet")
     checkTrue(validObject(obj, complete=TRUE))
@@ -97,7 +97,7 @@ testUpdateMiscPreviousInstances <- function() {
     options(warn=-1)
     on.exit(options(opts))
 
-    rda <- dir(system.file("UnitTests", "VersionedClass_data",
+    rda <- dir(system.file("unitTests", "VersionedClass_data",
                            package="Biobase"), full.names=TRUE,
                recursive=TRUE, pattern="^([^(ExpressionSet)]).*\\.Rda")
 
@@ -122,7 +122,7 @@ testUpdatePreviousExpressionSet <- function() {
     options(warn=-1)
     on.exit(options(opts))
 
-    rda <- dir(system.file("UnitTests", "VersionedClass_data",
+    rda <- dir(system.file("unitTests", "VersionedClass_data",
                            package="Biobase"), full.names=TRUE,
                recursive=TRUE, pattern="^ExpressionSet.*\\.Rda")
 
diff --git a/inst/UnitTests/VersionedClass_test.R b/inst/unitTests/test_VersionedClass.R
similarity index 98%
rename from inst/UnitTests/VersionedClass_test.R
rename to inst/unitTests/test_VersionedClass.R
index 8ae448e..ed7cdd5 100644
--- a/inst/UnitTests/VersionedClass_test.R
+++ b/inst/unitTests/test_VersionedClass.R
@@ -1,6 +1,6 @@
 nonvirtualClasses <- NULL
 instanceDir <-
-    system.file("UnitTests", "VersionedClass_data", package="Biobase")
+    system.file("unitTests", "VersionedClass_data", package="Biobase")
 
 .setUp <- function() {
     nms <- ls(getNamespace("Biobase"),all=TRUE)
diff --git a/inst/UnitTests/cache_test.R b/inst/unitTests/test_cache.R
similarity index 100%
rename from inst/UnitTests/cache_test.R
rename to inst/unitTests/test_cache.R
diff --git a/inst/UnitTests/checkClass_test.R b/inst/unitTests/test_checkClass.R
similarity index 100%
rename from inst/UnitTests/checkClass_test.R
rename to inst/unitTests/test_checkClass.R
diff --git a/inst/UnitTests/combine_test.R b/inst/unitTests/test_combine.R
similarity index 100%
rename from inst/UnitTests/combine_test.R
rename to inst/unitTests/test_combine.R
diff --git a/inst/UnitTests/copyEnv_test.R b/inst/unitTests/test_copyEnv.R
similarity index 100%
rename from inst/UnitTests/copyEnv_test.R
rename to inst/unitTests/test_copyEnv.R
diff --git a/inst/UnitTests/esApply_test.R b/inst/unitTests/test_esApply.R
similarity index 100%
rename from inst/UnitTests/esApply_test.R
rename to inst/unitTests/test_esApply.R
diff --git a/inst/UnitTests/subListExtract_test.R b/inst/unitTests/test_subListExtract.R
similarity index 100%
rename from inst/UnitTests/subListExtract_test.R
rename to inst/unitTests/test_subListExtract.R
diff --git a/inst/UnitTests/unsaveSetSlot_test.R b/inst/unitTests/test_unsaveSetSlot.R
similarity index 100%
rename from inst/UnitTests/unsaveSetSlot_test.R
rename to inst/unitTests/test_unsaveSetSlot.R
diff --git a/inst/UnitTests/utilities.R b/inst/unitTests/utilities.R
similarity index 96%
rename from inst/UnitTests/utilities.R
rename to inst/unitTests/utilities.R
index 24883aa..21b085f 100644
--- a/inst/UnitTests/utilities.R
+++ b/inst/unitTests/utilities.R
@@ -1,4 +1,4 @@
-## these assume we're in Biobase/inst/UnitTests
+## these assume we're in Biobase/inst/unitTests
 
 createCurrentInstances <- function(instanceDir = "VersionedClass_data") {
     require("Biobase")
diff --git a/man/channel.Rd b/man/channel.Rd
index c139e99..6c4e6fc 100644
--- a/man/channel.Rd
+++ b/man/channel.Rd
@@ -21,10 +21,10 @@ channel(object, name, ...)
 \author{Biocore}
 
 \examples{
-obj <- new("NChannelSet",
+obj <- NChannelSet(
            R=matrix(runif(100), 20, 5),
            G=matrix(runif(100), 20, 5))
 ## G channel as ExpressionSet
 channel(obj, "G")
-  }
+}
 \keyword{manip}
diff --git a/man/channelNames.Rd b/man/channelNames.Rd
index 249a985..fc2140f 100644
--- a/man/channelNames.Rd
+++ b/man/channelNames.Rd
@@ -1,27 +1,52 @@
 \name{channelNames}
 \alias{channelNames}
+\alias{channelNames<-}
 
-\title{Retrieve channel names from object}
+\title{Retrieve and set channel names from object}
 \description{
-  This generic function reports the channels present in an object.
+  This generic function reports or updates the channels in an object.
 }
 \usage{
 channelNames(object, ...)
+channelNames(object, ...) <- value
 }
 \arguments{
   \item{object}{An S4 object, typically derived from class
     \code{\link{eSet}}}
+  \item{value}{Replacement value, either a character vector (to
+    re-order existing channel names or a named character vector or list
+    (to change channel names from the vector elements to the
+    corresponding names).}
   \item{...}{Additional argument, not currently used.}
 }
+
+\details{
+
+  \code{channelNames} returns the names of the channels in a defined
+  order. Change the order using the replacement method with a permuation
+  of the channel names as \code{value}. Rename channels using the
+  replacement method with a named list, where the vector elements are a
+  permutation of the current channels, with corresponding names the new
+  identifier for the channel.
+  
+}
+
 \value{
   \code{character}.
 }
 \author{Biocore}
 
 \examples{
-obj <- new("NChannelSet",
+## channelNames default to alphabetical order of channels
+obj <- NChannelSet(
            R=matrix(runif(100), 20, 5),
-           G=matrix(runif(100), 20, 5))
+           G=matrix(-runif(100), 20, 5))
 channelNames(obj)
-  }
+channelNames(obj) <- c(Gn="G", Rd="R")   ## rename
+channelNames(obj)
+channelNames(obj) <- c("Rd", "Gn")       ## reorder
+channelNames(obj)
+all(assayData(obj)[["Gn"]] <= 0)
+all(assayData(obj)[["Rd"]] >= 0)
+}
 \keyword{manip}
diff --git a/man/class.AnnotatedDataFrame.Rd b/man/class.AnnotatedDataFrame.Rd
index 9d21205..5b9c7a7 100644
--- a/man/class.AnnotatedDataFrame.Rd
+++ b/man/class.AnnotatedDataFrame.Rd
@@ -21,6 +21,8 @@
 \alias{coerce,data.frame,AnnotatedDataFrame-method}
 \alias{coerce,phenoData,AnnotatedDataFrame-method}
 \alias{dim,AnnotatedDataFrame-method}
+\alias{dimnames,AnnotatedDataFrame-method}
+\alias{dimnames<-,AnnotatedDataFrame-method}
 \alias{dimLabels,AnnotatedDataFrame-method}
 \alias{dimLabels<-,AnnotatedDataFrame,character-method}
 \alias{ncol,AnnotatedDataFrame-method}
@@ -163,6 +165,9 @@ an \code{AnnotatedDataFrame} from \code{\link{AssayData-class}}.
       \code{ncol(<AnnotatedDataFrame>)}:}{Number of samples and
       variables (\code{dim}) and variables (\code{ncol}) in the
       argument.}
+    \item{\code{dimnames(<AnnotatedDataFrame>)},
+      \code{rownames(<AnnotatedDataFrame>)},
+      \code{colnames(<AnnotatedDataFrame>)}:}{row and column names.}
   }
 }
 \author{V.J. Carey, after initial design by R. Gentleman }
diff --git a/man/class.ExpressionSet.Rd b/man/class.ExpressionSet.Rd
index 0fdd44e..2ff5998 100644
--- a/man/class.ExpressionSet.Rd
+++ b/man/class.ExpressionSet.Rd
@@ -37,7 +37,7 @@
 ExpressionSet(assayData,
     phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
     featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
-    experimentData=new("MIAME"), annotation=character(),
+    experimentData=MIAME(), annotation=character(),
     protocolData=annotatedDataFrameFrom(assayData, byrow=FALSE),
     ...)
 
@@ -64,17 +64,17 @@ ExpressionSet(assayData,
 
   }
 
-  \item{phenoData}{An optional \code{data.frame} or
-    \code{AnnotatedDataFrame} containing information about each
-    sample. The number of rows in \code{phenoData} must match the number
-    of columns in \code{assayData}. Row names of \code{phenoData} must
-    match column names of the matrix / matricies in \code{assayData}.}
-
-  \item{featureData}{An optional \code{data.frame} or
-    \code{AnnotatedDataFrame} containing information about each
-    feature. The number of rows in \code{featureData} must match the
-    number of rows in \code{assayData}. Row names of \code{featureData}
-    must match row names of the matrix / matricies in \code{assayData}.}
+  \item{phenoData}{An optional \code{AnnotatedDataFrame} containing
+    information about each sample. The number of rows in
+    \code{phenoData} must match the number of columns in
+    \code{assayData}. Row names of \code{phenoData} must match column
+    names of the matrix / matricies in \code{assayData}.}
+
+  \item{featureData}{An optional \code{AnnotatedDataFrame} containing
+    information about each feature. The number of rows in
+    \code{featureData} must match the number of rows in
+    \code{assayData}. Row names of \code{featureData} must match row
+    names of the matrix / matricies in \code{assayData}.}
 
   \item{experimentData}{An optional \code{MIAME} instance with meta-data
     (e.g., the lab and resulting publications from the analysis) about
diff --git a/man/class.MIAxE.Rd b/man/class.MIAxE.Rd
index f7c34df..10c1cf8 100644
--- a/man/class.MIAxE.Rd
+++ b/man/class.MIAxE.Rd
@@ -47,8 +47,8 @@
 \examples{
 
 # Create a new class
-setClass("MyData", contains="MIAxE")
-new("MyData")
+MyData <- setClass("MyData", contains="MIAxE")
+MyData()
 
 # MIAxE objects cannot be instantiated directly
 try(new("MIAxE"))
diff --git a/man/class.NChannelSet.Rd b/man/class.NChannelSet.Rd
index b77f1cf..8f90092 100644
--- a/man/class.NChannelSet.Rd
+++ b/man/class.NChannelSet.Rd
@@ -3,7 +3,11 @@
 \alias{NChannelSet-class}
 \alias{NChannelSet}
 \alias{class.NChannelSet}
+\alias{assayData<-,NChannelSet,environment-method}
+\alias{assayData<-,NChannelSet,list-method}
 \alias{channelNames,NChannelSet-method}
+\alias{channelNames<-,NChannelSet,character-method}
+\alias{channelNames<-,NChannelSet,list-method}
 \alias{channel,NChannelSet,character-method}
 \alias{sampleNames,NChannelSet-method}
 \alias{sampleNames<-,NChannelSet,list-method}
@@ -30,7 +34,7 @@
   phenotypic data is maintained by the selection or subset.}
 
 \section{Objects from the Class}{
-  Objects can be created by calls of the form \code{new("NChannelSet",
+  Objects can be created by calls of the form \code{NChannelSet(
     assayData, phenoData, ...)}. See the examples below.
 }
 
@@ -118,10 +122,13 @@
       passed to the \code{ExpressionSet} constructor, for instance
       to influence \code{storage.mode}.
     }
-    \item{\code{channelNames(object)}}{
+
+    \item{\code{channelNames(object)}, \code{channelNames(object) <- value}}{
       \code{signature(object = "NChannelSet")}.
-      Obtain names of channels contained in \code{object}.
+      Obtain, reorder, or rename channels contained in
+      \code{object}. See \code{\link{channelNames}}.
     }
+
     \item{\code{selectChannels(object, names, ...}}{
       \code{signature(object = "NChannelSet", names = "character")}.
       Create a new \code{NChannelSet} from \code{object}, containing
@@ -168,11 +175,11 @@
 }
 \examples{
 ## An empty NChannelSet
-obj <- new("NChannelSet")
+obj <- NChannelSet()
 
 ## An NChannelSet with two channels (R, G) and no phenotypic data
-obj <- new("NChannelSet",
-           R=matrix(0,10,5), G=matrix(0,10,5))
+obj <- NChannelSet(R=matrix(0,10,5), G=matrix(0,10,5))
+
 ## An NChannelSet with two channels and channel-specific phenoData
 R <- matrix(0, 10, 3, dimnames=list(NULL, LETTERS[1:3]))
 G <- matrix(1, 10, 3, dimnames=list(NULL, LETTERS[1:3]))
@@ -185,10 +192,8 @@ varMetadata <- data.frame(labelDescription=c(
                             "G-specific phenoData",
                             "Both channel phenoData"),
                           channel=factor(c("R", "G", "_ALL_")))
-phenoData <- new("AnnotatedDataFrame",
-                 data=data, varMetadata=varMetadata)
-obj <- new("NChannelSet",
-           assayData=assayData, phenoData=phenoData)
+phenoData <- AnnotatedDataFrame(data=data, varMetadata=varMetadata)
+obj <- NChannelSet(assayData=assayData, phenoData=phenoData)
 obj
 
 ## G channel as NChannelSet
diff --git a/man/class.Versioned.Rd b/man/class.Versioned.Rd
index ec915e9..25a6d1e 100644
--- a/man/class.Versioned.Rd
+++ b/man/class.Versioned.Rd
@@ -50,19 +50,18 @@ obj <- new("Versioned", versions=list(A="1.0.0"))
 obj
 classVersion(obj)
 
-setClass("A", contains="Versioned")
+A <- setClass("A", contains="Versioned")
 
 classVersion("A")
-a <- new("A")
+a <- A()
 a # 'show' nothing by default
 classVersion(a)
 
-setClass("B",
-         contains="Versioned",
+B <- setClass("B", contains="Versioned",
          prototype=prototype(new("Versioned",versions=list(B="1.0.0"))))
 
 classVersion("B")
-b <- new("B")
+b <- B()
 classVersion(b)
 
 classVersion(b)["B"] <- "1.0.1"
@@ -72,7 +71,7 @@ classVersion("B")
 classVersion("B") < classVersion(b)
 classVersion(b) == "1.0.1"
 
-setClass("C",
+C <- setClass("C",
          representation(x="numeric"),
          contains=("VersionedBiobase"),
          prototype=prototype(new("VersionedBiobase", versions=c(C="1.0.1"))))
@@ -80,8 +79,7 @@ setClass("C",
 setMethod("show", signature(object="C"),
           function(object) print(object at x))
 
-c <- new("C", x=1:10)
-
+c <- C(x=1:10)
 c
 
 classVersion(c)
diff --git a/man/class.VersionedBiobase.Rd b/man/class.VersionedBiobase.Rd
index 287f8f4..3b7235e 100644
--- a/man/class.VersionedBiobase.Rd
+++ b/man/class.VersionedBiobase.Rd
@@ -33,21 +33,20 @@ classVersion(obj)
 obj <- new("VersionedBiobase", versions=list(A="1.0.0"))
 classVersion(obj)
 
-setClass("A", contains="VersionedBiobase")
+A <- setClass("A", contains="VersionedBiobase")
 
 classVersion("A")
-a <- new("A")
+a <- A()
 classVersion(a)
 
 obj <- new("VersionedBiobase", versions=c(MyVersion="1.0.0"))
 classVersion(obj)
 
-setClass("B",
-         contains="VersionedBiobase",
+B <- setClass("B", contains="VersionedBiobase",
          prototype=prototype(new("VersionedBiobase",versions=list(B="1.0.0"))))
 
 classVersion("B")
-b <- new("B")
+b <- B()
 classVersion(b)
 
 removeClass("A")
diff --git a/man/class.eSet.Rd b/man/class.eSet.Rd
index 52982b6..bb990ea 100644
--- a/man/class.eSet.Rd
+++ b/man/class.eSet.Rd
@@ -269,43 +269,33 @@
 
 # create a new, ad hoc, class, for personal use
 # all methods outlined above are available automatically
-setClass("MySet", contains="eSet")
-new("MySet")
+.MySet <- setClass("MySet", contains="eSet")
+.MySet()
 
-# Create a more robust class, with initialization and validation methods
+# Create a more robust class, with constructor and validation methods
 # to ensure assayData contains specific matricies
-setClass("TwoColorSet", contains="eSet")
+.TwoColorSet <- setClass("TwoColorSet", contains="eSet")
 
-setMethod("initialize", "TwoColorSet",
-          function(.Object,
-                   phenoData = new("AnnotatedDataFrame"),
-                   experimentData = new("MIAME"),
-                   annotation = character(),
-                   R = new("matrix"),
-                   G = new("matrix"),
-                   Rb = new("matrix"),
-                   Gb = new("matrix"),
-                   ... ) {
-            callNextMethod(.Object,
-                           phenoData = phenoData,
-                           experimentData = experimentData,
-                           annotation = annotation,
-                           R=R, G=G, Rb=Rb, Gb=Gb,
-                           ...)
-          })
+TwoColorSet <-
+    function(phenoData=AnnotatedDataFrame(), experimentData=MIAME(),
+             annotation=character(), R=new("matrix"), G=new("matrix"),
+             Rb=new("matrix"), Gb=new("matrix"), ...)
+{
+    .TwoColorSet(phenoData=phenoData, experimentData=experimentData,
+                 annotation=annotation, R=R, G=G, Rb=Rb, Gb=Gb, ...)
+}
 
 setValidity("TwoColorSet", function(object) {
   assayDataValidMembers(assayData(object), c("R", "G", "Rb", "Gb"))
 })
 
-new("TwoColorSet")
+TwoColorSet()
 
 # eSet objects cannot be instantiated directly, only derived objects
 try(new("eSet"))
 
 removeClass("MySet")
 removeClass("TwoColorSet")
-removeMethod("initialize", "TwoColorSet")
 }
 
 \keyword{classes}
diff --git a/man/copySubstitute.Rd b/man/copySubstitute.Rd
index f7d08cd..80a3cdd 100644
--- a/man/copySubstitute.Rd
+++ b/man/copySubstitute.Rd
@@ -9,7 +9,8 @@
 }
 
 \usage{
-copySubstitute(src, dest, symbolValues, symbolDelimiter="@", allowUnresolvedSymbols=FALSE, recursive = FALSE, removeExtension = "\\\\.in$")
+copySubstitute(src, dest, symbolValues, symbolDelimiter="@", allowUnresolvedSymbols=FALSE,
+               recursive = FALSE, removeExtension = "\\\\.in$")
 }
 
 \arguments{
diff --git a/man/dge.Rd b/man/dge.Rd
deleted file mode 100644
index ab7fe61..0000000
--- a/man/dge.Rd
+++ /dev/null
@@ -1,49 +0,0 @@
-\name{dge}
-\alias{conditions}
-\alias{conditions<-}
-\alias{design}
-\alias{design<-}
-\alias{counts}
-\alias{counts<-}
-\alias{dispTable}
-\alias{dispTable<-}
-\alias{sizeFactors}
-\alias{sizeFactors<-}
-\alias{estimateSizeFactors}
-\alias{estimateDispersions}
-
-\title{Accessors and generic functions used in the context of count datasets}
-
-\description{These generic functions provide basic interfaces to operations on
-and data access to count datasets.}
-
-\usage{
-counts(object, ...)
-counts(object, ...) <- value
-dispTable(object, ...)
-dispTable(object, ...)  <- value
-sizeFactors(object, ...)
-sizeFactors(object, ...) <- value
-conditions(object, ...)
-conditions(object, ...) <- value
-design(object, ...)
-design(object, ...) <- value
-estimateSizeFactors(object, ...)
-estimateDispersions(object, ...)
-}
-
-\arguments{
-  \item{object}{Object of class for which methods are defined, e.g.,
-    \code{CountDataSet} or \code{ExonCountSet}.}
-  \item{value}{Value to be assigned to corresponding components of
-    \code{object}; supported types depend on method implementation.}
-  \item{...}{Further arguments, perhaps used by metohds}
-}
-
-\details{For the details, please consult the manual pages of the
-  methods in the \code{DESeq} and \code{DEXSeq} packages and the package
-  vignettes.}
-
-\author{W. Huber, S. Anders}
-
-\keyword{manip}
diff --git a/man/isCurrent.Rd b/man/isCurrent.Rd
index f152dfe..533e0a8 100644
--- a/man/isCurrent.Rd
+++ b/man/isCurrent.Rd
@@ -53,10 +53,10 @@ isCurrent(obj)
 
 isCurrent(1:10) # NA
 
-setClass("A", contains="VersionedBiobase",
+A <- setClass("A", contains="VersionedBiobase",
          prototype=prototype(new("VersionedBiobase", versions=c(A="1.0.0"))))
 
-a <- new("A")
+a <- A()
 classVersion(a)
 
 isCurrent(a, "VersionedBiobase") # is the 'VersionedBiobase' portion current?
diff --git a/man/isVersioned.Rd b/man/isVersioned.Rd
index ab882e7..04d872c 100644
--- a/man/isVersioned.Rd
+++ b/man/isVersioned.Rd
@@ -41,9 +41,9 @@ isVersioned(obj)
 
 isVersioned(1:10) # FALSE
 
-setClass("A", contains="VersionedBiobase",
+A <- setClass("A", contains="VersionedBiobase",
          prototype=prototype(new("VersionedBiobase", versions=c(A="1.0.0"))))
-a <- new("A")
+a <- A()
 isVersioned(a)
 
 removeClass("A")
diff --git a/man/rowMedians.Rd b/man/rowMedians.Rd
index fd5f1a3..d2f6c57 100644
--- a/man/rowMedians.Rd
+++ b/man/rowMedians.Rd
@@ -9,28 +9,33 @@
   Calculates the median for each row in a matrix.
 }
 
-\usage{rowMedians(imat, na.rm=FALSE)}
+\usage{rowMedians(x, na.rm=FALSE, ...)}
 
 \arguments{
- \item{imat}{A \code{\link[base]{numeric}} \code{\link[base]{matrix}}.}
- \item{na.rm}{If \code{\link[base:logical]{TRUE}}, \code{\link[base]{NA}}s are excluded before calculating the medians, otherwise not.}
+ \item{x}{A \code{\link[base]{numeric}} NxK \code{\link[base]{matrix}}.}
+ \item{na.rm}{If \code{\link[base:logical]{TRUE}},
+   \code{\link[base]{NA}}s are excluded first, otherwise not.}
  \item{...}{Not use.}
 }
 
 \value{
-  Returns a \code{\link[base]{double}} \code{\link[base]{vector}} of length equal to number of rows in \code{x}.
+  Returns a \code{\link[base]{numeric}} \code{\link[base]{vector}} of
+  length N.
 }
 
 \section{Missing values}{
   Missing values are excluded before calculating the medians.
 }
 
-\section{Benchmarking}{
-  This implementation is optimized for speed and memory to calculate.
-  As the example shows, this implementation is roughly 3-10 times faster
-  than using \code{apply(x, MARGIN=1, FUN=medians)}.
-  As the example might show, the \code{\link{rowQ}()} does not (have to)
-  handle missing values, and is therefore in some cases faster.
+\details{
+  The implementation of \code{rowMedians()}
+  is optimized for both speed and memory.
+  To avoid coercing to \code{\link[base]{double}}s (and hence memory
+  allocation), there is a special implementation for
+  \code{\link[base]{integer}} matrices.  That is, if \code{x} is an
+  \code{\link[base]{integer}} \code{\link[base]{matrix}}, then 
+  \code{rowMedians(as.double(x))} would require three times the memory
+  of \code{rowMedians(x)}, but all this is avoided.
 }
 
 \author{Henrik Bengtsson}
diff --git a/man/selectChannels.Rd b/man/selectChannels.Rd
index 96d9990..61a77e7 100644
--- a/man/selectChannels.Rd
+++ b/man/selectChannels.Rd
@@ -21,9 +21,7 @@ selectChannels(object, names, ...)
 \author{Biocore}
 
 \examples{
-obj <- new("NChannelSet",
-           R=matrix(runif(100), 20, 5),
-           G=matrix(runif(100), 20, 5))
+obj <- NChannelSet(R=matrix(runif(100), 20, 5), G=matrix(runif(100), 20, 5))
 
 ## G channel as NChannelSet
 selectChannels(obj, "G")
diff --git a/src/Rinit.c b/src/Rinit.c
index 9063986..4f3c9db 100644
--- a/src/Rinit.c
+++ b/src/Rinit.c
@@ -7,7 +7,7 @@ SEXP copyEnv(SEXP e1, SEXP e2, SEXP all);
 SEXP listToEnv(SEXP, SEXP);
 SEXP listLen(SEXP);
 SEXP rowQ(SEXP, SEXP);
-SEXP rowMedians(SEXP, SEXP, SEXP);
+SEXP rowMedians(SEXP, SEXP, SEXP, SEXP);
 SEXP rowQuantiles(SEXP, SEXP);
 SEXP unsafe_set_slot(SEXP obj, SEXP slot, SEXP value);
 SEXP lc_prefix(SEXP, SEXP);
@@ -24,7 +24,7 @@ __declspec(dllexport)
         {"listToEnv", (DL_FUNC)&listToEnv, 2},
         {"listLen", (DL_FUNC)&listLen, 1},
         {"rowQ", (DL_FUNC)&rowQ, 2},
-        {"rowMedians", (DL_FUNC)&rowMedians, 3},
+        {"rowMedians", (DL_FUNC)&rowMedians, 4},
         {"unsafe_set_slot", (DL_FUNC)&unsafe_set_slot, 3},
         {"lc_prefix", (DL_FUNC)&lc_prefix, 2},
         {"sublist_extract", (DL_FUNC)&sublist_extract, 4},
diff --git a/src/envir.c b/src/envir.c
index ef85bfc..0ddc721 100644
--- a/src/envir.c
+++ b/src/envir.c
@@ -44,7 +44,8 @@ SEXP copyEnv(SEXP e1, SEXP e2, SEXP all)
         /* no inheritance in lookup */
         PROTECT(sym = install(CHAR(STRING_ELT(nms, i))));
         val = findVarInFrame3(e1, sym, TRUE);
-        defineVar(sym, NAMED(val) ? duplicate(val) : val, e2);
+        INCREMENT_NAMED(val);
+        defineVar(sym, val, e2);
         UNPROTECT(1);
     }
     UNPROTECT(1);
diff --git a/src/rowMedians.c b/src/rowMedians.c
index 612ff3f..60b159e 100644
--- a/src/rowMedians.c
+++ b/src/rowMedians.c
@@ -1,270 +1,38 @@
 /***************************************************************************
  Public methods:
  SEXP rowMedians(SEXP x, SEXP naRm, SEXP hasNA)
+ SEXP colMedians(SEXP x, SEXP naRm, SEXP hasNA)
 
- Private methods:
- SEXP rowMediansReal(SEXP x, int nrow, int ncol, int narm, int hasna)
- SEXP rowMediansInteger(SEXP x, int nrow, int ncol, int narm, int hasna)
+ Authors: Adopted from rowQuantiles.c by R. Gentleman.
 
  Copyright Henrik Bengtsson, 2007
  **************************************************************************/
-
-/* Include R packages */
-#include <R.h>
 #include <Rdefines.h>
-#include <Rmath.h>
-
-
-
-SEXP rowMediansReal(SEXP x, int nrow, int ncol, int narm, int hasna) {
-  SEXP ans;
-  int isOdd;
-  int ii, jj, kk, qq;
-  int *colOffset;
-  double *rowData, *xx;
-  double value;
-
-  xx = REAL(x);
-
-  /* R allocate memory for the 'rowData'.  This will be 
-     taken care of by the R garbage collector later on. */
-  rowData = (double *) R_alloc(ncol, sizeof(double));
-
-  /* R allocate a double vector of length 'nrow' */
-  PROTECT(ans = allocVector(REALSXP, nrow));
-
-  /* If there are no missing values, don't try to remove them. */
-  if (hasna == FALSE)
-    narm = FALSE;
-
-  /* When narm == FALSE, isOdd and qq are the same for all rows */
-  if (narm == FALSE) {
-    isOdd = (ncol % 2 == 1);
-    qq = (int)(ncol/2) - 1;
-  } else {
-    isOdd = FALSE;
-    qq = 0;
-  }
-  //  Rprintf("isOdd=%d, qq=%d\n", isOdd, qq);
-
-  value = 0;
-
-  /* Pre-calculate the column offsets */
-  colOffset = (int *) R_alloc(ncol, sizeof(int));
-  for(jj=0; jj < ncol; jj++) 
-    colOffset[jj] = (int)jj*nrow;
-
-  if (hasna == TRUE) {
-    for(ii=0; ii < nrow; ii++) {
-      if(ii % 1000 == 0)
-        R_CheckUserInterrupt(); 
-
-      // Rprintf("ii=%d\n", ii);
-
-      kk = 0;  /* The index of the last non-NA value detected */
-      for(jj=0; jj < ncol; jj++) {
-        value = xx[ii+colOffset[jj]];
-
-        if (ISNA(value)) {
-          if (narm == FALSE) {
-            kk = -1;
-            break;
-          }
-        } else {
-          rowData[kk] = value;
-          kk = kk + 1;
-        }
-      }
-  
-      if (kk == 0) {
-        REAL(ans)[ii] = R_NaN;
-      } else if (kk == -1) {
-        REAL(ans)[ii] = R_NaReal;
-      } else {
-        /* When narm == TRUE, isOdd and qq may change with row */
-        if (narm == TRUE) {
-          isOdd = (kk % 2 == 1);
-          qq = (int)(kk/2) - 1;
-        }
-  
-        /* Permute x[0:kk-1] so that x[qq] is in the correct 
-           place with smaller values to the left, ... */
-        rPsort(rowData, kk, qq+1);
-        value = rowData[qq+1];
-
-        // Rprintf("kk=%d, qq+1=%d, value=%d\n", kk, qq, value);
-
-        if (isOdd == TRUE) {
-          REAL(ans)[ii] = value;
-        } else {
-          if (narm == TRUE || !ISNA(value)) {
-            /* Permute x[0:qq-2] so that x[qq-1] is in the correct 
-               place with smaller values to the left, ... */
-            rPsort(rowData, qq+1, qq);
-            value = (rowData[qq] + value)/2;
-            //  Rprintf("qq+1=%d, qq=%d, value=%d\n", qq+1, qq, value);
-          }
-          REAL(ans)[ii] = value;
-        }
-
-      }
-    }
-  } else {
-    for(ii=0; ii < nrow; ii++) {
-      if(ii % 1000 == 0)
-        R_CheckUserInterrupt(); 
-
-      for(jj=0; jj < ncol; jj++)
-        rowData[jj] = xx[ii+colOffset[jj]];
-  
-      /* Permute x[0:ncol-1] so that x[qq] is in the correct 
-         place with smaller values to the left, ... */
-      rPsort(rowData, ncol, qq+1);
-      value = rowData[qq+1];
-
-      if (isOdd == TRUE) {
-        REAL(ans)[ii] = (double)value;
-      } else {
-        /* Permute x[0:qq-2] so that x[qq-1] is in the correct 
-           place with smaller values to the left, ... */
-        rPsort(rowData, qq+1, qq);
-        value = (rowData[qq] + value)/2;
-        REAL(ans)[ii] = (double)value;
-      }
-
-    }
-  } /* if (hasna ...) */
-
-  UNPROTECT(1);
 
-  return(ans);
-} /* rowMediansReal() */
-
-
-
-
-SEXP rowMediansInteger(SEXP x, int nrow, int ncol, int narm, int hasna) {
-  SEXP ans;
-  int isOdd;
-  int ii, jj, kk, qq;
-  int *colOffset;
-  int *rowData, *xx;
-  int value;
-
-  xx = INTEGER(x);
+SEXP rowMedians_Real(SEXP x, int nrow, int ncol, int narm, int hasna, int byrow);
+SEXP rowMedians_Integer(SEXP x, int nrow, int ncol, int narm, int hasna, int byrow);
 
-  /* R allocate memory for the 'rowData'.  This will be 
-     taken care of by the R garbage collector later on. */
-  rowData = (int *) R_alloc(ncol, sizeof(int));
 
-  /* R allocate a int vector of length 'nrow' */
-  PROTECT(ans = allocVector(REALSXP, nrow));
+/* 
+TEMPLATE rowMedians_<Integer|Real>(...):
+- SEXP rowMedians_Real(...);
+- SEXP rowMedians_Integer(...);
+ */
+#define METHOD rowMedians
 
-  /* If there are no missing values, don't try to remove them. */
-  if (hasna == FALSE)
-    narm = FALSE;
+#define X_TYPE 'i'
+#include "rowMedians_TYPE-template.h"
 
-  /* When narm == FALSE, isOdd and qq are the same for all rows */
-  if (narm == FALSE) {
-    isOdd = (ncol % 2 == 1);
-    qq = (int)(ncol/2) - 1;
-  } else {
-    isOdd = FALSE;
-    qq = 0;
-  }
-
-  value = 0;
-
-  /* Pre-calculate the column offsets */
-  colOffset = (int *) R_alloc(ncol, sizeof(int));
-  for(jj=0; jj < ncol; jj++) 
-    colOffset[jj] = (int)jj*nrow;
+#define X_TYPE 'r'
+#include "rowMedians_TYPE-template.h"
 
-  if (hasna == TRUE) {
-    for(ii=0; ii < nrow; ii++) {
-      if(ii % 1000 == 0)
-        R_CheckUserInterrupt(); 
-
-      kk = 0;  /* The index of the last non-NA value detected */
-      for(jj=0; jj < ncol; jj++) {
-        value = xx[ii+colOffset[jj]];
-        if (value == NA_INTEGER) {
-          if (narm == FALSE) {
-            kk = -1;
-            break;
-          }
-        } else {
-          rowData[kk] = value;
-          kk = kk + 1;
-        }
-      }
-  
-      if (kk == 0) {
-        REAL(ans)[ii] = R_NaN;
-      } else if (kk == -1) {
-        REAL(ans)[ii] = R_NaReal;
-      } else {
-        /* When narm == TRUE, isOdd and qq may change with row */
-        if (narm == TRUE) {
-          isOdd = (kk % 2 == 1);
-          qq = (int)(kk/2) - 1;
-        }
-  
-        /* Permute x[0:kk-1] so that x[qq] is in the correct 
-           place with smaller values to the left, ... */
-        iPsort(rowData, kk, qq+1);
-        value = rowData[qq+1];
-
-        if (isOdd == TRUE) {
-          REAL(ans)[ii] = (double)value;
-        } else {
-          if (narm == TRUE || value != NA_INTEGER) {
-            /* Permute x[0:qq-2] so that x[qq-1] is in the correct 
-               place with smaller values to the left, ... */
-            iPsort(rowData, qq+1, qq);
-            if (rowData[qq] == NA_INTEGER)
-              REAL(ans)[ii] = R_NaReal;
-            else
-              REAL(ans)[ii] = (double)((rowData[qq] + value))/2;
-          } else {
-            REAL(ans)[ii] = (double)value;
-          }
-        }
-      }
-    }
-  } else {
-    for(ii=0; ii < nrow; ii++) {
-      if(ii % 1000 == 0)
-        R_CheckUserInterrupt(); 
+#undef METHOD 
 
-      for(jj=0; jj < ncol; jj++)
-        rowData[jj] = xx[ii+colOffset[jj]]; 
-  
-      /* Permute x[0:ncol-1] so that x[qq] is in the correct 
-         place with smaller values to the left, ... */
-      iPsort(rowData, ncol, qq+1);
-      value = rowData[qq+1];
-      if (isOdd == TRUE) {
-        REAL(ans)[ii] = (double)value;
-      } else {
-        iPsort(rowData, qq+1, qq);
-        REAL(ans)[ii] = (double)((rowData[qq] + value))/2;
-      }
-    }
-  } /* if (hasna ...) */
 
-  UNPROTECT(1);
-
-  return(ans);
-} /* rowMediansInteger() */
-
-
-
-SEXP rowMedians(SEXP x, SEXP naRm, SEXP hasNA) {
+SEXP rowMedians(SEXP x, SEXP naRm, SEXP hasNA, SEXP byRow) {
+  int narm, hasna, byrow;
   SEXP ans;
   int nrow, ncol;
-  int narm;
-  int hasna;
 
   /* Argument 'x': */
   if (!isMatrix(x))
@@ -281,33 +49,51 @@ SEXP rowMedians(SEXP x, SEXP naRm, SEXP hasNA) {
   if (narm != TRUE && narm != FALSE)
     error("Argument 'naRm' must be either TRUE or FALSE.");
 
+  /* Argument 'hasNA': */
   hasna = LOGICAL(hasNA)[0];
 
+  /* Argument 'byRow': */
+  byrow = INTEGER(byRow)[0];
+
+
   /* Get dimensions of 'x'. */
   PROTECT(ans = getAttrib(x, R_DimSymbol));
-  nrow = INTEGER(ans)[0];
-  ncol = INTEGER(ans)[1];
+  if (byrow) {
+    nrow = INTEGER(ans)[0];
+    ncol = INTEGER(ans)[1];
+  } else {
+    nrow = INTEGER(ans)[1];
+    ncol = INTEGER(ans)[0];
+  }
 
   /* Double matrices are more common to use. */
   if (isReal(x)) {
-    ans = rowMediansReal(x, nrow, ncol, narm, hasna);
+    ans = rowMedians_Real(x, nrow, ncol, narm, hasna, byrow);
   } else if (isInteger(x)) {
-    ans = rowMediansInteger(x, nrow, ncol, narm, hasna);
+    ans = rowMedians_Integer(x, nrow, ncol, narm, hasna, byrow);
   } else {
-    ans = NULL;
+    UNPROTECT(1);
+    error("Argument 'x' must be a numeric.");
   }
 
   UNPROTECT(1);
 
-  if (ans == NULL)
-    error("Argument 'x' must be a numeric.");
-
   return(ans);
 } /* rowMedians() */
 
 
 /***************************************************************************
  HISTORY:
+ 2013-01-13 [HB]
+ o Added argument 'byRow' to rowMedians() and dropped colMedians().
+ o Using internal arguments 'by_row' instead of 'by_column'.
+ 2011-12-11 [HB]
+ o BUG FIX: rowMediansReal(..., na.rm=TRUE) did not handle NaN:s, only NA:s.
+   Note that NaN:s does not exist for integers.
+ 2011-10-12 [HJ]
+ o Added colMedians().
+ o Now rowMediansInteger/Real() can operate also by columns, cf. argument
+   'by_column'.
  2007-08-14 [HB]
  o Added checks for user interrupts every 1000 line.
  o Added argument 'hasNA' to rowMedians().
@@ -319,5 +105,5 @@ SEXP rowMedians(SEXP x, SEXP naRm, SEXP hasNA) {
   o By implementing a special version for integers, there is no need to
     coerce to double in R, which would take up twice the amount of memory.
   o rowMedians() now handles NAs too.
-  o Created from rowQuantiles.c.
+  o Adopted from rowQuantiles.c in Biobase of Bioconductor.
  **************************************************************************/
diff --git a/src/rowMedians_TYPE-template.h b/src/rowMedians_TYPE-template.h
new file mode 100644
index 0000000..5386ac1
--- /dev/null
+++ b/src/rowMedians_TYPE-template.h
@@ -0,0 +1,206 @@
+/***********************************************************************
+ TEMPLATE:
+  SEXP rowMedians_<Integer|Real>(...)
+
+ GENERATES:
+  SEXP rowMedians_Integer(SEXP x, int nrow, int ncol, int narm, int hasna, int byrow)
+  SEXP rowMedians_Real(SEXP x, int nrow, int ncol, int narm, int hasna, int byrow)
+
+ Arguments:
+   The following macros ("arguments") should be defined for the 
+   template to work as intended.
+
+  - METHOD: the name of the resulting function
+  - X_TYPE: 'i' or 'r'
+
+ Authors:
+  Adopted from rowQuantiles.c by R. Gentleman.
+  Template by Henrik Bengtsson.
+
+ Copyright: Henrik Bengtsson, 2007-2013
+ ***********************************************************************/ 
+#include <R.h>
+#include <Rdefines.h>
+#include <Rmath.h>
+
+/* Expand arguments:
+    X_TYPE => (X_C_TYPE, X_IN_C, X_ISNAN, [METHOD_NAME])
+ */
+#include "templates-types.h" 
+
+#if X_TYPE == 'i'
+  #define PSORT iPsort
+#elif X_TYPE == 'r'
+  #define PSORT rPsort
+#endif
+
+
+SEXP METHOD_NAME(SEXP x, int nrow, int ncol, int narm, int hasna, int byrow) {
+  SEXP ans;
+  int isOdd;
+  int ii, jj, kk, qq;
+  int *colOffset;
+  X_C_TYPE *rowData, *xx, value;
+
+  xx = X_IN_C(x);
+
+  /* R allocate memory for the 'rowData'.  This will be 
+     taken care of by the R garbage collector later on. */
+  rowData = (X_C_TYPE *) R_alloc(ncol, sizeof(X_C_TYPE));
+
+  /* R allocate a double vector of length 'nrow'
+     Note that 'nrow' means 'ncol' if byrow=FALSE. */
+  PROTECT(ans = allocVector(REALSXP, nrow));
+
+  /* If there are no missing values, don't try to remove them. */
+  if (hasna == FALSE)
+    narm = FALSE;
+
+  /* When narm == FALSE, isOdd and qq are the same for all rows */
+  if (narm == FALSE) {
+    isOdd = (ncol % 2 == 1);
+    qq = (int)(ncol/2) - 1;
+  } else {
+    isOdd = FALSE;
+    qq = 0;
+  }
+
+  value = 0;
+
+  /* Pre-calculate the column offsets */
+  colOffset = (int *) R_alloc(ncol, sizeof(int));
+
+  // HJ begin
+  if (byrow) {
+    for(jj=0; jj < ncol; jj++) 
+      colOffset[jj] = (int)jj*nrow;
+  } else {
+    for(jj=0; jj < ncol; jj++) 
+      colOffset[jj] = jj;
+  }
+  // HJ end
+
+  if (hasna == TRUE) {
+    for(ii=0; ii < nrow; ii++) {
+      if(ii % 1000 == 0)
+        R_CheckUserInterrupt(); 
+
+      int rowIdx = byrow ? ii : ncol*ii; //HJ
+
+      kk = 0;  /* The index of the last non-NA value detected */
+      for(jj=0; jj < ncol; jj++) {
+        value = xx[rowIdx+colOffset[jj]]; //HJ
+
+        if (X_ISNAN(value)) {
+          if (narm == FALSE) {
+            kk = -1;
+            break;
+          }
+        } else {
+          rowData[kk] = value;
+          kk = kk + 1;
+        }
+      }
+  
+      if (kk == 0) {
+        REAL(ans)[ii] = R_NaN;
+      } else if (kk == -1) {
+        REAL(ans)[ii] = R_NaReal;
+      } else {
+        /* When narm == TRUE, isOdd and qq may change with row */
+        if (narm == TRUE) {
+          isOdd = (kk % 2 == 1);
+          qq = (int)(kk/2) - 1;
+        }
+  
+        /* Permute x[0:kk-1] so that x[qq] is in the correct 
+           place with smaller values to the left, ... */
+        PSORT(rowData, kk, qq+1);
+        value = rowData[qq+1];
+
+        if (isOdd == TRUE) {
+          REAL(ans)[ii] = (double)value;
+        } else {
+          if (narm == TRUE || !X_ISNAN(value)) {
+            /* Permute x[0:qq-2] so that x[qq-1] is in the correct 
+               place with smaller values to the left, ... */
+            PSORT(rowData, qq+1, qq);
+            if (X_ISNAN(rowData[qq]))
+              REAL(ans)[ii] = R_NaReal;
+            else
+              REAL(ans)[ii] = ((double)(rowData[qq] + value))/2;
+          } else {
+            REAL(ans)[ii] = (double)value;
+          }
+        }
+      }
+    }
+  } else {
+    for(ii=0; ii < nrow; ii++) {
+      if(ii % 1000 == 0)
+        R_CheckUserInterrupt(); 
+
+      int rowIdx = byrow ? ii : ncol*ii; //HJ
+
+      for(jj=0; jj < ncol; jj++)
+        rowData[jj] = xx[rowIdx+colOffset[jj]]; //HJ
+  
+      /* Permute x[0:ncol-1] so that x[qq] is in the correct 
+         place with smaller values to the left, ... */
+      PSORT(rowData, ncol, qq+1);
+      value = rowData[qq+1];
+
+      if (isOdd == TRUE) {
+        REAL(ans)[ii] = (double)value;
+      } else {
+        /* Permute x[0:qq-2] so that x[qq-1] is in the correct 
+           place with smaller values to the left, ... */
+        PSORT(rowData, qq+1, qq);
+        REAL(ans)[ii] = (double)((rowData[qq] + value))/2;
+      }
+
+    }
+  } /* if (hasna ...) */
+
+  UNPROTECT(1);
+
+  return(ans);
+}
+
+/* Undo template macros */
+#undef PSORT
+#include "templates-types_undef.h" 
+
+
+/***************************************************************************
+ HISTORY:
+ 2013-04-23 [HB]
+  o BUG FIX: The integer template of rowMedians_<Integer|Real>() would
+    not handle ties properly.  This was because ties were calculated as
+    '(double)((rowData[qq] + value)/2)' instead of 
+    '((double)(rowData[qq] + value))/2'.
+ 2013-01-13 [HB]
+  o Merged rowMedians_Integer() and rowMedians_Read() into template
+    rowMedians_<Integer|Real>().
+ 2013-01-13 [HB]
+ o Using internal arguments 'by_row' instead of 'by_column'.
+ 2011-12-11 [HB]
+ o BUG FIX: rowMediansReal(..., na.rm=TRUE) did not handle NaN:s, only NA:s.
+   Note that NaN:s does not exist for integers.
+ 2011-10-12 [HJ]
+ o Added colMedians().
+ o Now rowMediansInteger/Real() can operate also by columns, cf. argument
+   'by_column'.
+ 2007-08-14 [HB]
+ o Added checks for user interrupts every 1000 line.
+ o Added argument 'hasNA' to rowMedians().
+ 2005-12-07 [HB]
+ o BUG FIX: When calculating the median of an even number (non-NA) values,
+    the length of the second sort was one element too short, which made the
+    method to freeze, i.e. rPsort(rowData, qq, qq) is now (...qq+1, qq).
+ 2005-11-24 [HB]
+  o By implementing a special version for integers, there is no need to
+    coerce to double in R, which would take up twice the amount of memory.
+  o rowMedians() now handles NAs too.
+  o Adopted from rowQuantiles.c in Biobase of Bioconductor.
+ **************************************************************************/
diff --git a/src/templates-types.h b/src/templates-types.h
new file mode 100644
index 0000000..bc9ea8e
--- /dev/null
+++ b/src/templates-types.h
@@ -0,0 +1,46 @@
+/*
+ * Sets type-specific macros
+ */
+
+#define CONCAT(x,y) x ##_## y
+#define CONCAT_MACROS(x,y) CONCAT(x,y)
+
+/*
+ Data type macros for argument 'x'
+ */
+#if X_TYPE == 'i'
+  #ifndef METHOD_NAME
+    #define METHOD_NAME CONCAT_MACROS(METHOD, Integer)
+  #endif
+  #define X_C_TYPE int
+  #define X_IN_C INTEGER
+  #define X_ISNAN(x) (x == NA_INTEGER)
+#elif X_TYPE == 'r'
+  #ifndef METHOD_NAME
+    #define METHOD_NAME CONCAT_MACROS(METHOD, Real)
+  #endif
+  #define X_C_TYPE double
+  #define X_IN_C REAL
+  #define X_ISNAN(x) ISNAN(x)
+#endif
+
+
+/*
+ Data type macros for result ('ans')
+ */
+#ifndef ANS_TYPE
+  /* Default to same as 'x' */
+  #define ANS_TYPE X_TYPE
+#endif
+
+#if ANS_TYPE == 'i'
+  #define ANS_SXP INTSXP
+  #define ANS_NA NA_INTEGER
+  #define ANS_C_TYPE int
+  #define ANS_IN_C INTEGER
+#elif ANS_TYPE == 'r'
+  #define ANS_SXP REALSXP
+  #define ANS_NA NA_REAL
+  #define ANS_C_TYPE double
+  #define ANS_IN_C REAL
+#endif
diff --git a/src/templates-types_undef.h b/src/templates-types_undef.h
new file mode 100644
index 0000000..4501a5f
--- /dev/null
+++ b/src/templates-types_undef.h
@@ -0,0 +1,18 @@
+#undef CONCAT
+#undef CONCAT_MACROS
+
+#undef METHOD_NAME
+
+#undef X_C_TYPE
+#undef X_IN_C
+#undef X_ISNAN
+
+#undef ANS_SXP
+#undef ANS_NA
+#undef ANS_C_TYPE
+#undef ANS_IN_C
+
+#undef X_TYPE
+#undef ANS_TYPE
+
+#undef MARGIN
diff --git a/tests/test-all.R b/tests/test-all.R
index b440be4..39b172c 100644
--- a/tests/test-all.R
+++ b/tests/test-all.R
@@ -1,2 +1 @@
-require("Biobase") || stop("unable to load Biobase")
-BiocGenerics:::testPackage("Biobase", "UnitTests", ".*_test\\.R$")
+BiocGenerics:::testPackage("Biobase")
diff --git a/vignettes/BiobaseDevelopment.Rnw b/vignettes/BiobaseDevelopment.Rnw
new file mode 100644
index 0000000..a6cf2a6
--- /dev/null
+++ b/vignettes/BiobaseDevelopment.Rnw
@@ -0,0 +1,684 @@
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+%\VignetteIndexEntry{Notes for eSet developers}
+%\VignetteDepends{}
+%\VignetteKeywords{Expression Analysis}
+%\VignettePackage{Biobase}
+\documentclass[]{article}
+
+\usepackage{times}
+\usepackage{hyperref}
+
+\newcommand{\Rfunction}[1]{{\texttt{#1}}}
+\newcommand{\Robject}[1]{{\texttt{#1}}}
+\newcommand{\Rpackage}[1]{{\textit{#1}}}
+\newcommand{\Rmethod}[1]{{\texttt{#1}}}
+\newcommand{\Rfunarg}[1]{{\texttt{#1}}}
+\newcommand{\Rclass}[1]{{\textit{#1}}}
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\R}{\textsf{R}}
+\newcommand{\eSet}{\Robject{eSet}}
+\newcommand{\ExpressionSet}{\Robject{ExpressionSet}}
+\newcommand{\Biobase}{\Rpackage{Biobase}}
+
+\newcommand{\term}[1]{\emph{#1}}
+\newcommand{\mref}[2]{\htmladdnormallinkfoot{#2}{#1}}
+
+\begin{document}
+
+\title{\Biobase{} development and the new \eSet}
+\author{\mref{mailto:mtmorgan at fhcrc.org}{Martin T. Morgan}}
+\date{7 August, 2006}
+\maketitle
+
+Revised 4 September, 2006 -- \Robject{featureData} slot.
+Revised 20 April 2007 -- minor wording changes; \Rfunarg{verbose} and
+other arguments passed through \Rmethod{updateObject} example;
+introduce a second variant of \Rmethod{initialize} illustrating its
+use as a copy constructor.
+Revised 4 November, 2010 -- \Robject{experimentData} slot as \Rclass{MIAxE} 
+class. \Rclass{MIAME} class is now subclass of \Rclass{MIAxE}.
+
+\section{Introduction}
+
+These notes help \emph{developers} who are interested in using and
+extending the \eSet{} class hierarchy, and using features in
+\Biobase. The information here is not useful to regular users of
+\Biobase.
+
+This document illustrates the \Biobase{} structures and approaches
+that make it it easy for developers to creatively use and extend the
+\eSet{} class hierarchy.
+
+The document starts with a brief description of the motivation for
+change, and a comparison of the old (before August, 2006) and new
+\eSet{}s and related functionality (e.g.,the \Rclass{Versioned} class
+and \Rfunction{updateObject} methods). We then illustrate how \eSet{}
+can be extended to handle additional types of data, and how new
+methods can exploit the \eSet{} class hierarchy. We conclude with a
+brief summary of lessons learned, useful developer-related
+side-effects of efforts to revise \eSet{}, and possible directions for
+future development.
+
+\section{Comparing old and new}
+
+What is an \eSet{}?
+\begin{itemize}
+\item Coordinate high through-put (e.g., gene expression) and phenotype data.
+\item Provide common data container for diverse Bioconductor packages.
+\end{itemize}
+Motivation for change (August, 2006).
+\begin{itemize}
+\item What was broken?  Complex data structure. Inconsistent object
+  validity. No straight-forward way to extend \eSet{} to new data
+  types. 
+\item What forward-looking design goals did we have? Flexible storage
+  model. Class hierarchy to promote code reuse and facilitate
+  extension to new data objects. Methods for updating serialized instances.
+\end{itemize}
+Key features in the redesign.
+\begin{itemize}
+\item Simplified data content.
+\item Structured class hierarchy .
+\item Alternative storage modes.
+\item More validity checking.
+\item Conversion of example data in \Biobase{}, and many other data
+  sets elsewhere in Bioconductor, to \Rclass{ExpressionSet}.
+\item \Rclass{Versioned} class information (in the development branch).
+\item \Rfunction{updateObject} methods (in the development branch).
+\end{itemize}
+
+\section{A quick tour}
+<<Biobase,echo=FALSE,results=hide>>=
+options(width=69)
+library(Biobase)
+@ 
+
+\subsection{The \eSet{} object: high-throughput experiments}
+Purpose.
+\begin{itemize}
+\item Coordinate and contain high-throughput genomic data.
+\end{itemize}
+Structure: virtual base class.
+<<eSet-class>>=
+getClass("eSet")
+@ 
+\begin{itemize}
+\item \Robject{assayData}: high-throughput data.
+\item \Robject{phenoData}: sample covariates.
+\item \Robject{featureData}: feature covariates.
+\item \Robject{experimentData}: experimental description.
+\item \Robject{annotation}: assay description.
+\item See below, and \verb|?"eSet-class"|
+\end{itemize}
+
+\subsubsection{\Robject{assayData}: high-throughput data}
+Purpose.
+\begin{itemize}
+\item Efficiently and flexibly contain high-volume data.
+\end{itemize}
+Structure: \Rclass{list}, \Rclass{environment}, or \Rclass{lockEnvironment} class union.
+\begin{itemize}
+\item Each element of \Rclass{list} / \Rclass{environment} / \Rclass{lockEnvironment} is a matrix
+\item Rows: \emph{features}, e.g., gene names.
+\item Columns: \emph{samples} represented on each chip. 
+\item All matricies must have the same dimensions, row names, and column names.
+\item Subclasses determine which matricies \emph{must} be present.
+\item See \verb|?"AssayData-class"|
+\end{itemize}
+
+\subsubsection{\Robject{phenoData}: sample covariates}
+Purpose.
+\begin{itemize}
+\item Contain and document sample covariates.
+\end{itemize}
+Structure: \Rclass{AnnotatedDataFrame}.
+\begin{itemize}
+\item \Robject{data}: \Rclass{data.frame}.
+  \begin{itemize}
+  \item Rows: sample identifiers.
+  \item Columns: measured covariates.
+  \end{itemize}
+\item \Robject{varMetadata}: \Rclass{data.frame}.
+  \begin{itemize}
+  \item Rows: measured covariate labels.
+  \item Columns: covariate descriptors. 
+  \end{itemize}
+\item See \verb|?"AnnotatedDataFrame-class"|
+\end{itemize}
+
+\subsubsection{\Robject{featureData}: feature covariates}
+Purpose.
+\begin{itemize}
+\item Contain and document feature covariates specific to the
+  experiment; use the \Robject{annotation} slot for chip-level descriptions.
+\end{itemize}
+Structure: \Rclass{AnnotatedDataFrame}.
+\begin{itemize}
+\item \Robject{data}: \Rclass{data.frame}.
+  \begin{itemize}
+  \item Rows: feature identifiers. These match row names of \Robject{assayData}.
+  \item Columns: measured covariates.
+  \end{itemize}
+\item \Robject{varMetadata}: \Rclass{data.frame}.
+  \begin{itemize}
+  \item Rows: measured covariate labels.
+  \item Columns: covariate descriptors. 
+  \end{itemize}
+\item See \verb|?"AnnotatedDataFrame-class"|
+\end{itemize}
+
+\subsubsection{\Robject{experimentData}: experiment description}
+Purpose.
+\begin{itemize}
+\item Summarize where and how the experiment was performed.
+\end{itemize}
+Structure: \Rclass{MIAxE} virtual class
+\begin{itemize}
+\item[] {In Biobase version 2.11 the \Rclass{MIAxE} virtual class was introduced 
+as a general container for experiment meta-data. The \Rclass{MIAME} class
+is now a subclass of \Rclass{MIAxE}. See \verb|?"MIAxE-class"|. 
+The \Rclass{MIAME} class structure is as follows} 
+\end{itemize}
+\begin{itemize}
+\item \Robject{title}: experiment title.
+\item \Robject{name}: experimenter name(s).
+\item \Robject{preprocessing}: \Robject{list} of pre-processing steps.
+\item Additional slots.
+\item See \verb|?"MIAME-class"|.
+\end{itemize}
+
+\subsubsection{\Robject{annotation}: assay description}
+Purpose.
+\begin{itemize}
+\item Link experiment to annotation package.
+\end{itemize}
+Structure: \Rclass{character}
+\begin{itemize}
+\item Label identifying annotation package.
+\end{itemize}
+
+%% Methods
+
+\subsection{Important \eSet{} methods}
+Initialization.
+\begin{itemize}
+\item \eSet{} is \verb|VIRTUAL|, initialize via subclass \Rfunction{callNextMethod}
+\end{itemize}
+Accessors (get, set).
+\begin{itemize}
+\item \Rfunction{assayData(obj); assayData(obj) <- value}: access or assign \Robject{assayData}
+\item \Rfunction{phenoData(obj); phenoData(obj) <- value}: access or assign \Robject{phenoData}
+\item \Rfunction{experimentData(obj); experimentData(obj) <- value}: access or assign \Robject{experimentData}
+\item \Rfunction{annotation(obj); annotation(obj) <- value}: access or assign \Robject{annotation}
+\end{itemize}
+Subsetting.
+\begin{itemize}
+\item \Rfunction{obj[i, j]}: select genes $i$ and samples $j$.
+\item \Rfunction{obj\$name; obj\$name <- value}:
+  retrieve  or assign covariate \Robject{name} in \Robject{phenoData}
+\end{itemize}
+
+\subsubsection{Additional \eSet{} methods}
+\begin{itemize}
+\item \Rfunction{show}.
+\item \Rfunction{storageMode}: influence how \Robject{assayData} is stored.
+\item \Rfunction{updateObject}: update \eSet{} objects to their current version.
+\item \Rfunction{validObject}: ensure that \eSet{} is valid.
+\end{itemize}
+
+The \Rfunction{validObject} method is particularly important to
+\eSet{}, ensuring that \eSet{} contains consistent structure to data.
+<<eSet-validity>>=
+getValidity(getClass("eSet"))
+@ 
+The validity methods for \eSet{} reflect our design goals. All
+\Robject{assayData} members must have identical row and column
+dimensions and \Robject{featureNames}. The names and numbers of
+samples must be the same in \Robject{assayData} and
+\Robject{phenoData} slots. Validity methods are defined for the
+classes underlying each slot as well. For instance, the validity
+methods for \Robject{AnnotatedDataFrame} check that variables used in
+\Robject{pData} are at least minimally described in \Robject{varMetadata}.
+
+%% Subclasses
+
+\subsection{Subclasses of \eSet}
+\Biobase{} defines three classes that extend \eSet{}. \ExpressionSet{}
+(discussed further below) is meant to contain microarray gene
+expression data. \Rclass{SnpSet} is a preliminary class to contain SNP
+data; other classes in development (e.g., in \Rpackage{oligo}) may
+provide alternative implementations for SNP data. \Rclass{MultiSet} is
+an \ExpressionSet-like class, but without restriction on the names
+(though not structure) of elements in the \Robject{assayData} slot.
+
+\subsubsection{\ExpressionSet}
+Purpose: 
+\begin{itemize}
+\item Contain gene expression data.
+\end{itemize}
+Required \Robject{assayData} members.
+\begin{itemize}
+\item \Robject{exprs}, a matrix of expression values.
+\end{itemize}
+Important methods.
+\begin{itemize}
+\item Initialization (additional details below):
+<<ExpressionSet-initialize,eval=FALSE>>=
+obj <- new("ExpressionSet", phenoData = new("AnnotatedDataFrame"), experimentData = new("MIAME"), annotation = character(), exprs = new("matrix")) 
+@ 
+\item \Rfunction{exprs(obj), exprs(obj) <- value}: get or set \Robject{exprs}; methods defined for \Rclass{ExpressionSet}, \Rclass{AssayData}.
+\end{itemize}
+ 
+
+\subsubsection{\Rclass{MultiSet} and \Rclass{SnpSet}}
+\Rclass{MultiSet}.
+\begin{itemize}
+\item Purpose: flexibly contain a collection of expression data matricies.
+\item Required \Robject{assayData} members: none.
+\end{itemize}
+\Rclass{SnpSet}.
+\begin{itemize}
+\item Purpose: contain genomic SNP calls.
+\item Required \Robject{assayData} members: \Robject{call}, \Robject{callProbability}.
+\end{itemize}
+
+\section{Comments on \Robject{assayData}: high-throughput data storage}
+The \Robject{assayData} slot is meant to store high-throughput
+data. The idea is that the slot contains identically sized matrices
+containing expression or other data. All matrices in the slot must
+have the same dimension, and are structured so that rows represent
+`features' and columns represent `samples'. Validity methods enforce
+that row and column names of slot elements are identical. 
+
+For technical reasons, creating instance of \Rclass{AssayData} is
+slightly different from the way this is usually done in
+\R{}. Normally, one creates an instance of a class with an expression
+like \Rfunction{new("ExpressionSet", ...)}, with the \ldots
+representing additional arguments. \Rclass{AssayData} objects are
+created with
+<<newAssayData,eval=FALSE>>=
+assayDataNew("environment", elt)
+@ 
+where \Robject{elt} might be a matrix of expression values. For the
+curious, the reason for this setup stems from our desire to have a
+class that \Rfunction{is} a list or environment, rather than a class
+that has a slot that contains a list or environment. The
+\Rfunction{is} relationship is desirable to avoid unnecessary
+function calls to access slots, and requires that a class
+\Rfunction{contain} the base type (e.g., \Rclass{environment}). Until
+recently an \R{} object could not \Rfunction{contain} an
+\Rclass{environment}.
+
+The \Robject{assayData} slot of \ExpressionSet{} objects must contain
+a matrix named \Robject{exprs}. Nonetheless, the \ExpressionSet{}
+validity method tries to be liberal -- it guarantees that the object
+has an \Robject{exprs} element, but allows for other elements too. The
+prudent developer wanting consistent additional data elements should
+derive a class from \ExpressionSet{} that enforces the presence of
+their desired elements.
+
+The \Rclass{AssayData} class allows for data elements to be stored in
+three different ways (see \Rfunction{?storageMode} and
+\Rfunction{?"storageMode<-"} for details): as a \Robject{list},
+\Robject{environment}, or \Robject{lockedEnvironment}.  Developers are
+probably familiar with \Robject{list} objects; a drawback is that
+\Robject{exprs} elements may be large, and some operations on lists in
+\R{} may trigger creation of many copies of the the \Robject{exprs}
+element. This can be expensive in both space and time. Environments
+are nearly unique in \R{}, in that they are passed by reference rather
+than value. This eliminates some copying, but has the unfortunate
+consequence that side-effects occur -- modifications to an environment
+inside a function influence the value of elements outside the
+function. For these reasons, environments can be useful as `read only'
+arguments to functions, but can have unexpected consequences when
+functions modify their arguments.  Locked environments implemented in
+\Biobase{} try to strike a happy medium, allowing pass by reference for
+most operations but triggering (whole-environment) copying when
+elements in the environment are modified. The locking mechanism is
+enforced by only allowing known `safe' operations to occur, usually by
+channeling user actions through the accessor methods:
+<<assayData-storageMode>>=
+data(sample.ExpressionSet)
+storageMode(sample.ExpressionSet)
+tryCatch(assayData(sample.ExpressionSet)$exprs <- log(exprs(sample.ExpressionSet)),
+         error=function(err) cat(conditionMessage(err)))
+exprs(sample.ExpressionSet) <- log(exprs(sample.ExpressionSet))
+@ 
+The \Rfunction{setReplaceMethod} for \Robject{exprs} (and
+\Robject{assayData}) succeeds by performing a deep copy of the entire
+environment. Because this is very inefficient, the recommended paradigm
+to update an element in a \Robject{lockedEnvironment} is to extract
+it, make many changes, and then reassign it. Developers can study
+\Robject{assayData} methods to learn more about how to lock and unlock
+environment bindings.  \Biobase{} allows the experienced user to
+employ (and run the risks of) environments, but the expectation is
+that most user objects are construced with the default
+\Robject{lockedEnvironment} or \Robject{list}.
+
+A longer term consideration in designing \Rclass{AssayData} was to
+allow more flexible methods of data storage, e.g., through
+database-hosted arrays. This is facilitated by using generic functions
+such as \Rfunction{exprs()} for data access, so that classes derived
+from \Rclass{AssayData} can provide implementations appropriate for
+their underlying storage mode.
+
+
+\section{Extending \eSet}
+A designer wanting to implement \eSet{} for a particular type of data
+creates a class that `contains' \eSet{}. The steps for doing this are
+described below. One example of such a class is \ExpressionSet,
+designed to hold a matrix of gene expression values in the
+\Robject{assayData} slot. 
+<<ExpressionSet-class>>=
+getClass("ExpressionSet")
+getValidity(getClass("ExpressionSet"))
+@ 
+The data structure of an \ExpressionSet{} is identical to that of
+\eSet, and in fact is inherited (without additional slot creation)
+from \eSet{}. The main difference is that the validity methods of
+\eSet{} are augmented by a method to check that the
+\Robject{assayData} slot contains an entity named \Robject{"exprs"}. A
+valid \ExpressionSet{} object must also satisfy all the validity
+requirements of \eSet{}, but the developer does not explicitly invoke
+validity checking of the parts of the data structure inherited from
+\eSet{}.
+
+\subsection{Implementing a new class: a \Rclass{SwirlSet} example}
+
+We want the \emph{Swirl} data set (see the \Robject{SW} two color data
+set that motivates this class) to contain four elements in the
+\Robject{assayData} slot: \Robject{R}, \Robject{G}, \Robject{Rb},
+\Robject{Gb}. To derive a class from \eSet{} for this data, we create
+a class, and provide initializaation and validation methods.
+
+We create a class as follows:
+<<SwirlSet-class>>=
+setClass("SwirlSet", contains="eSet")
+@ 
+Notice that there are no new data elements in \Rclass{SwirlSet}
+compared with \eSet{}. The \Rfunction{initialize} method is written as
+<<SwirlSet-initialize>>=
+setMethod("initialize", "SwirlSet",
+          function(.Object,
+                   R = new("matrix"),
+                   G = new("matrix"),
+                   Rb = new("matrix"),
+                   Gb = new("matrix"),
+                   ...) {
+            callNextMethod(.Object,
+                           R=R, G=G, Rb=Rb, Gb=Gb,
+                           ...)
+        })
+@ 
+% 
+A slightly different \Rmethod{initialize} method allows the user to
+specify either the \Robject{assayData} or the \Robject{assayData}
+content. In advanced use, this has the advantage that
+\Rmethod{initialize} can be used as a `copy constructor' to update
+several slots simultaneously.
+<<SwirlSet-initialize-2>>=
+setMethod("initialize", "SwirlSet",
+          function(.Object,
+                   assayData=assayDataNew(
+                     R=R, G=G, Rb=Rb, Gb=Gb),
+                   R = new("matrix"),
+                   G = new("matrix"),
+                   Rb = new("matrix"),
+                   Gb = new("matrix"),
+                   ...) {
+            if (!missing(assayData) && 
+                any(!missing(R), !missing(G), !missing(Rb), !missing(Gb))) {
+                warning("using 'assayData'; ignoring 'R', 'G', 'Rb', 'Gb'")
+            }
+            callNextMethod(.Object, assayData=assayData, ...)
+        })
+@ 
+
+The structure of the \Rfunction{initialize} method is a bit different
+from those often seen in \R{}. Often, \Rfunction{initialize} has only
+\Robject{.Object} as a named argument, or, if there are other named
+arguments, they correspond to slot names. Here our initialize method
+accepts four arguments, named after the \Robject{assayData} elements.
+Inside the \Rfunction{initialize} method, the named arguments are
+passed to the next initialization method in the hierarch (i.e.,
+\Rfunction{initialize} defined for \eSet). The \eSet{}
+\Rfunction{initialize} method then uses these arguments to populate
+the data slots in \Robject{.Object}. In particular, \eSet{} places all
+arguments other \Rfunction{phenoData}, \Rfunction{experimentData}, and
+\Rfunction{annotation} into the \Robject{assayData} slot.  The \eSet{}
+\Rfunction{initialize} method then returns the result to the
+\Rfunction{initialize} method of \Rclass{SwirlSet}, which returns a
+\Rclass{SwirlSet} object to the user:
+<<SwirlSet-new>>=
+new("SwirlSet")
+@ 
+
+General programing guidelines emerge from experience with the
+\Rfunction{initialize} method of \eSet{} and derived classes. First,
+an appropriate strategy is to name only those data elements that will
+be manipulated directly by the \Rfunction{initialize} method. For
+instance, the definition above did \emph{not} name \Robject{phenoData}
+and other \eSet{} slots by name. To do so is not incorrect, but would
+require that they be explicitly named (e.g.,
+\Rfunction{phenoData=phenoData}) in the \Rfunction{callNextMethod}
+code. Second, the arguments \Robject{R, G, Rb, Rg} are present in the
+\Rfunction{initialize} method to provide defaults consistent with
+object construction; the `full' form of \Rfunction{callNextMethod},
+replicating the named arguments, is required in the version of \R{} in
+which this class was developed. Third, named arguments can be
+manipulated before \Rfunction{callNextMethod} is invoked.  Fourth, the
+return value of \Rfunction{callNextMethod} can be captured\ldots
+<<initialize-.Object,eval=FALSE>>=
+setMethod("initialize", "MySet",
+          function(.Object, ...) {
+              .Object <- callNextMethod(.Object, ...)
+          })
+              .
+@ 
+and manipulated before being returned to the user. Finally, it is the
+responsbilitiy of the developer to ensure that a valid object is
+created; \Rfunction{callNextMethod} is a useful way to exploit
+correctly designed \Rfunction{initialize} methods for classes that the
+object extends, but the developer is free to use other techniques to
+create valid versions of their class.
+
+A validity method might complete our new class. A validity method is
+essential to ensure that the unique features of \Rclass{SwirlSet} --
+our reason for designing the new class -- are indeed present. We
+define our validity method to ensure that the \Robject{assayData} slot
+contains our four types of expression elements:
+<<SwirlSet-validity>>=
+setValidity("SwirlSet", function(object) {
+  assayDataValidMembers(assayData(object), c("R", "G", "Rb", "Gb"))
+})
+@ 
+
+Notice that we do not have to explicitly request that the validity of
+other parts of the \Rclass{SwirlSet} object are valid; this is done
+for us automatically. Objects are checked for validity when they are
+created, but not when modified. This is partly for efficiency reasons,
+and partly because object updates might transiently make them
+invalid. So a good programing practice is to ensure validity after
+modification, e.g.,
+<<validity-sometimes,eval=FALSE>>=
+myFancyFunction <- function(obj) {
+  assayData(obj) <- fancyAssaydData # obj invalid...
+  phenoData(obj) <- justAsFancyPhenoData # but now valid
+  validObject(obj)
+  obj
+}
+@ 
+Assigning \Robject{fancyAssaydData} might invalidate the object, but
+\Robject{justAsFancyPhenoData} restores validity.
+
+\section{\Rclass{Versioned}}
+
+One problem encountered in the Bioconductor project is that data
+objects stored to disk become invalid as the underlying class
+definition changes. For instance, earlier releases of \Biobase{}
+contain a sample \Rclass{eSet} object. But under the changes discussed
+here, \eSet{} is virtual and the stored object is no longer valid. The
+challenge is to easily identify invalid objects, and to provide a
+mechanism for updating old objects to their new representation.
+
+\Biobase{} introduces the \Rclass{Versioned} and
+\Rclass{VersionedBiobase} classes to facilitate this. These classes
+are incorporated into key \Biobase class definitions.\Biobase also
+defines \Rmethod{updateObject} methods (the \Rfunction{updateObject}
+generic function is defined in the \Rpackage{BiocGenerics} package)
+for conveniently updating old objects to their new representation.
+<<updateObject-eg>>=
+data(sample.ExpressionSet)
+classVersion(sample.ExpressionSet)
+obj <- updateObject(sample.ExpressionSet)
+@ 
+The version information for this object is a named list. The first two
+elements indicate the version of R and Biobase used to create the
+object. The latter two elements are contained in the class prototype,
+and the class prototype is consulted to see if the instance of an
+object is 'current'. These lists can be subsetted in the usual way,
+e.g.,
+<<isCurrent>>=
+isCurrent(sample.ExpressionSet)[c("eSet", "ExpressionSet")]
+@ 
+
+Versioned classes, \Rfunction{updateObject} and related methods
+simplify the long-term maintenance of data objects. Take the fictious
+\Rclass{MySet} as an example. 
+<<MultiSet-obj>>=
+setClass("MySet",
+         contains = "eSet",
+         prototype = prototype(
+           new("VersionedBiobase",
+               versions=c(classVersion("eSet"), MySet="1.0.0"))))
+obj <- new("MySet")
+classVersion(obj)
+@ 
+This is a new class, and might undergo changes in its structure at
+some point in the future. When these changes are introduced, the
+developer will change the version number of the class in its prototype
+(the last line, below):
+<<MultiSetRevised>>=
+setClass("MySet",
+         contains = "eSet",
+         prototype = prototype(
+           new("VersionedBiobase",
+               versions=c(classVersion("eSet"), MySet="1.0.1"))))
+isCurrent(obj)
+@ 
+and add code to update to the new version
+<<updateObject-MultiSet>>=
+setMethod("updateObject", signature(object="MySet"),
+          function(object, ..., verbose=FALSE) {
+              if (verbose) message("updateObject(object = 'MySet')")
+              object <- callNextMethod()
+              if (isCurrent(object)["MySet"]) return(object)
+              ## Create an updated instance.
+              if (!isVersioned(object))
+                  ## Radical surgery -- create a new, up-to-date instance
+                  new("MySet",
+                      assayData = updateObject(assayData(object),
+                        ...., verbose=verbose),
+                      phenoData = updateObject(phenoData(object),
+                        ..., verbose=verbose),
+                      experimentData = updateObject(experimentData(object),
+                        ..., verbose=verbose),
+                      annotation = updateObject(annotation(object),
+                        ..., verbose=verbose))
+              else {
+                  ## Make minor changes, and update version by consulting class definition
+                  classVersion(object)["MySet"] <-
+                      classVersion("MySet")["MySet"]
+                  object
+              }
+          })
+@ 
+The code after \Rfunction{if(!isVersioned)} illustrates one way of
+performing `radical surgery, creating a new up-to-date instance by
+updating all slots. The \Rfunction{else} clause represents more modest
+changes, using methods to update stale
+information. \Rfunction{updateObject} then returns a new, enhanced
+object:  
+<<updateObject>>=
+classVersion(updateObject(obj))
+@ 
+
+As in the example, versioning helps in choosing which modifications to
+perform -- minor changes for a slightly out-of-date object, radical
+surgery for something more ancient. Version information might also be
+used in methods, where changing class representation might facilitate
+more efficient routines.
+
+\subsection{\Rclass{Versioned} versus \Rclass{VersionedBiobase}}
+
+The information on \R{} and \Biobase{} versions is present in \eSet{}
+derived classes because \eSet{} contains \Rclass{VersionedBiobase}. On
+the other hand, \Rclass{AnnotatedDataFrame} contains \Rclass{Versioned}, and
+has only information about its own class version.
+<<classVersion-AnnotatedDataFrame>>=
+classVersion(new("AnnotatedDataFrame"))
+@ 
+The rationale for this is that \Rclass{AnnotatedDataFrame} is and will likely
+remain relatively simple, and details about \R{} and \Biobase{} are
+probably irrelevant to its use. On the other hand, some aspects of
+\eSet{} and the algorithms that operate on them are more cutting edge
+and subject to changes in \R{} or \Biobase{}. Knowing the version of
+\R{} and \Biobase{} used to create an instance might provide valuable
+debugging information.
+
+\subsection{Adding \Rclass{Versioned} information to your own classes}
+
+The key to versioning your own classes is to define your class to
+\Rfunction{contain} \Rclass{Versioned} or \Rclass{VersionedBiobase},
+and to add the version information in the prototype. For instance, to
+add a class-specific version stamp to \Rclass{SwirlSet} we would
+modify the class defintion to
+<<SwirlSet-version>>=
+setClass("SwirlSet", contains = "eSet",
+         prototype = prototype(
+           new("VersionedBiobase",
+               versions=c(classVersion("eSet"), SwirlSet="1.0.0"))))
+classVersion(new("SwirlSet"))
+@ 
+See additional examples in the \Rclass{Versioned} help page. 
+
+It is also possible to add arbitrary information to particular
+instances.
+<<arbitraryClassVersions>>=
+obj <- new("SwirlSet")
+classVersion(obj)["MyID"] <- "0.0.1"
+classVersion(obj)
+classVersion(updateObject(obj))
+@ 
+
+There is additional documentation about these classes and methods in
+\Biobase{}.
+
+\section{Summary}
+
+This document summarizes \Biobase, outlining strategies that
+developers using \Biobase{} may find useful. The main points are to
+introduce the \eSet{} class hierarchy, to illustrate how developers
+can effectively extend this class, and to introduce class versions as
+a way of tracking and easily updating objects. It is anticipated that
+\eSet{}-derived classes will play an increasingly important role in
+\Biobase{} development.
+
+\section{Session Information}
+
+The version number of \R{} and packages loaded for generating the vignette were:
+<<echo=FALSE,results=tex>>=
+toLatex(sessionInfo())
+@
+
+\end{document}
diff --git a/vignettes/Bioconductor.Rnw b/vignettes/Bioconductor.Rnw
new file mode 100644
index 0000000..daadd8a
--- /dev/null
+++ b/vignettes/Bioconductor.Rnw
@@ -0,0 +1,96 @@
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+%\VignetteIndexEntry{Bioconductor Overview}
+%\VignetteDepends{}
+%\VignetteKeywords{Documentation}
+%\VignettePackage{Biobase}
+\documentclass[12pt]{article}
+
+\usepackage{times}
+\usepackage{hyperref}
+
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\bibliographystyle{plainnat}
+
+\begin{document}
+
+\title{What is Bioconductor}
+\maketitle
+
+\section*{Prequisites}
+
+Bioconductor is a project to develop innovative software tools for use
+in computational biology.
+It is based on the R language ({\url www.r-project.org}).
+You should already be quite familiar with R before using
+Bioconductor. There are several on--line resources that can help you
+get started using R. They can be found from the R website.
+Some users find this a very steep learning curve; your experience may
+be similar.
+
+Bioconductor packages provide flexible interactive tools for carrying
+out a number of different computational tasks. They are generally not
+as fast as other analysis tools (since they are interactive) and often
+reflect current ideas. Most can be improved and interested users should 
+file bug reports and feature requests on the Bioconductor mailing list.
+
+
+Bioconductor welcome collaboration in many different forms. These
+include new packages, fixes or additions to existing packages and help
+on different projects that are currently underway.
+Please see the {\em Current Projects} web page to see if there are any
+projects that are intersting to you.
+
+\subsection*{How to report a bug}
+
+Please provide enough information for us to help you. This typically
+includes the platform (windows, Unix, Macintosh) that you are using as
+well as version numbers for R and for the package that seems to be
+working incorrectly.
+
+Include a small complete example that can be run and demonstrates the
+problem. In some cases it is also important that you describe what you
+thought you should get.
+
+Please note:
+\begin{itemize}
+\item bugs in R should be reported to the R community
+\item missing features are not bugs -- they are feature requests.
+\end{itemize}
+
+\section{Bioconductor Design}
+
+Bioconductor relies on the R package system to distribute code and
+data. Most packages use S4 methods and classes (as described in {\em
+  Programming with Data} by J. M. Chambers). This adherence to object
+oriented programming makes it easier to build component software and
+helps to deal with the complexity of the data.
+
+One of the important Bioconductor packages is {\em annotate}. This
+package provides access to various genomic annotation data. 
+This package makes use of various web resources and precompiled data
+packages to provide tools for exploring biological data.
+
+\section{Session Information}
+
+The version number of R and packages loaded for generating the vignette were:
+
+\begin{verbatim}
+<<echo=FALSE,results=tex>>=
+sessionInfo()
+@
+\end{verbatim}
+
+\end{document}
diff --git a/vignettes/ExpressionSetIntroduction.Rnw b/vignettes/ExpressionSetIntroduction.Rnw
new file mode 100644
index 0000000..03e79ba
--- /dev/null
+++ b/vignettes/ExpressionSetIntroduction.Rnw
@@ -0,0 +1,493 @@
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+%\VignetteDepends{Biobase}
+%\VignetteIndexEntry{An introduction to Biobase and ExpressionSets}
+%\VignetteKeywords{tutorial, environment, graphics, ExpressionSet}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\documentclass[12pt]{article}
+\usepackage{amsmath,fullpage}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+\usepackage{theorem}
+\usepackage{float}
+\usepackage{ifthen}
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\newcommand{\R}{{\textsf{R}}}
+\newcommand{\code}[1]{{\texttt{#1}}}
+\newcommand{\term}[1]{{\emph{#1}}}
+\newcommand{\Rpackage}[1]{\textsf{#1}}
+\newcommand{\Rfunction}[1]{\texttt{#1}}
+\newcommand{\Robject}[1]{\texttt{#1}}
+\newcommand{\Rclass}[1]{{\textit{#1}}}
+\newcommand{\Rmethod}[1]{{\textit{#1}}}
+\newcommand{\Rfunarg}[1]{{\textit{#1}}}
+
+%% Excercises and Questions
+\usepackage{theorem}
+\theoremstyle{break} \newtheorem{Ex}{Exercise}
+\theoremstyle{break} \newtheorem{Q}{Question}
+%% And solution or answer
+\newenvironment{solution}{%
+  \begin{center}
+    \begin{minipage}{0.75\textwidth}
+      %%     \color{blue}
+    }{
+    \end{minipage}
+  \end{center}
+  \bigskip%
+}
+
+\bibliographystyle{plainnat}
+\title{An Introduction to Bioconductor's \Rclass{ExpressionSet} Class}
+
+\author{Seth Falcon, Martin Morgan, and Robert Gentleman}
+\date{6 October, 2006; revised  9 February, 2007}
+
+\begin{document}
+
+<<init, echo=FALSE>>=
+options(width=65)
+@ 
+
+\maketitle
+
+\section{Introduction}
+\Rpackage{Biobase} is part of the Bioconductor project, and is used by
+many other packages. \Rpackage{Biobase} contains standardized data
+structures to represent genomic data. The \Rclass{ExpressionSet} class
+is designed to combine several different sources of information into a
+single convenient structure. An \Rclass{ExpressionSet} can be
+manipulated (e.g., subsetted, copied) conveniently, and is the input
+or output from many Bioconductor functions.
+
+The data in an \Rclass{ExpressionSet} is complicated, consisting of
+expression data from microarray experiments (\code{assayData};
+\code{assayData} is used to hint at the methods used to access
+different data components, as we will see below), `meta-data'
+describing samples in the experiment (\code{phenoData}), annotations
+and meta-data about the features on the chip or technology used for
+the experiment (\code{featureData}, \code{annotation}), information
+related to the protocol used for processing each sample (and usually
+extracted from manufacturer files, \code{protocolData}), and a
+flexible structure to describe the experiment
+(\code{experimentData}). The \Rclass{ExpressionSet} class coordinates
+all of this data, so that you do not usually have to worry about the
+details. However, an \Rclass{ExpressionSet} needs to be created in the
+first place, and creation can be complicated.
+
+In this introduction we learn how to create and manipulate
+\Rclass{ExpressionSet} objects, and practice some basic \R{} skills.
+
+\section{Preliminaries}
+
+\subsection{Installing Packages}
+
+If you are reading this document and have not yet installed any
+software on your computer, visit \url{http://bioconductor.org} and
+follow the instructions for installing \R{} and Bioconductor.  Once
+you have installed \R{} and Bioconductor, you are ready to go with
+this document. In the future, you might find that you need to install
+one or more additional packages. The best way to do this is to start
+an \R{} session and evaluate commands like
+<<install-pkg, eval=false>>=
+source("http://bioconductor.org/biocLite.R")
+biocLite(c("Biobase"))
+@ 
+%% 
+
+\subsection{Loading Packages}
+
+The definition of the \Rclass{ExpressionSet} class along with many
+methods for manipulating \Rclass{ExpressionSet} objects are defined in
+the \Rpackage{Biobase} package.  In general, you need to load class
+and method definitions before you use them.  When using Bioconductor,
+this means loading \R{} packages using \Rfunction{library} or
+\Rfunction{require}.
+
+<<loadlib, results=hide>>=
+library("Biobase")
+@ 
+
+\begin{Ex}
+What happens when you try to load a package that is not installed?
+\end{Ex}
+\begin{solution}
+When using \Rfunction{library}, you get an error message.  With
+\Rfunction{require}, the return value is \Robject{FALSE} and a warning
+is printed.
+\end{solution}
+
+\section{Building an ExpressionSet From .CEL and other files}
+
+Many users have access to .CEL or other files produced by microarray
+chip manufacturer hardware. Usually the strategy is to use a
+Bioconductor package such as \Rpackage{affyPLM}, \Rpackage{affy},
+\Rpackage{oligo}, or \Rpackage{limma}, to read these files.
+These Bioconductor packages have functions (e.g.,
+\Rfunction{ReadAffy}, \Rfunction{expresso}, or \Rfunction{justRMA} in
+\Rpackage{affy}) to read CEL files and perform preliminary
+preprocessing, and to represent the resulting data as an
+\Rclass{ExpressionSet} or other type of object.  Suppose the result
+from reading and preprocessing CEL or other files is named
+\Robject{object}, and \Robject{object} is different from
+\Rclass{ExpressionSet}; a good bet is to try, e.g.,
+<<convert,eval=FALSE>>=
+library(convert)
+as(object, "ExpressionSet")
+@ 
+%% 
+It might be the case that no converter is available. The path then is
+to extract relevant data from \Robject{object} and use this to create
+an \Rclass{ExpressionSet} using the instructions below.
+
+\section{Building an ExpressionSet From Scratch}
+
+As mentioned in the introduction, the data from many high-throughput
+genomic experiments, such as microarray experiments, usually consist
+of several conceptually distinct parts: assay data, phenotypic
+meta-data, feature annotations and meta-data, and a description of the
+experiment. We'll construct each of these components, and then
+assemble them into an \Rclass{ExpressionSet}.
+
+\subsection{Assay data}
+
+One important part of the experiment is a matrix of `expression'
+values.  The values are usually derived from microarrays of one sort
+or another, perhaps after initial processing by manufacturer software
+or Bioconductor packages. The matrix has $F$ rows and $S$ columns,
+where $F$ is the number of features on the chip and $S$ is the number
+of samples.
+
+A likely scenario is that your assay data is in a 'tab-delimited' text
+file (as exported from a spreadsheet, for instance) with rows
+corresponding to features and columns to samples.  The strategy is to
+read this file into \R{} using the \Rfunction{read.table} command,
+converting the result to a \Rclass{matrix}. A typical command
+to read
+a tab-delimited file that includes column `headers' is
+<<read-table-geneData>>=
+dataDirectory <- system.file("extdata", package="Biobase")
+exprsFile <- file.path(dataDirectory, "exprsData.txt")
+exprs <- as.matrix(read.table(exprsFile, header=TRUE, sep="\t",
+                              row.names=1,
+                              as.is=TRUE))
+@ 
+%% 
+The first two lines create a file path pointing to where the assay
+data is stored; replace these with a character string pointing to your
+own file, e.g,
+<<exprsFile,eval=FALSE>>=
+exprsFile <- "c:/path/to/exprsData.txt"
+@ 
+%% 
+(Windows users: note the use of \verb+/+ rather than \verb+\+; this
+is because \R{} treats the \verb+\+ character as an `escape' sequence to
+change the meaning of the subsequent character). See the help pages
+for \Rfunction{read.table} for more detail.  A common variant is that
+the character separating columns is a comma (``comma-separated
+values'', or ``csv'' files), in which case the \Robject{sep} argument
+might be \Robject{sep=","}.
+
+It is always important to verify that the data you have read matches
+your expectations. At a minimum, check the class and dimensions of
+\Robject{geneData} and take a peak at the first several rows
+<<geneData-peak>>=
+class(exprs)
+dim(exprs)
+colnames(exprs)
+head(exprs[,1:5])
+@ 
+%% 
+
+At this point, we can create a minimal \Rclass{ExpressionSet} object using the
+\code{ExpressionSet} constructor:
+<<ExpressionSet-basic>>=
+minimalSet <- ExpressionSet(assayData=exprs)
+@ 
+% 
+We'll get more benefit from expression sets by creating a richer
+object that coordinates phenotypic and other data with our expression
+data, as outlined in the following sections.
+
+\subsection{Phenotypic data}
+
+Phenotypic data summarizes information about the samples (e.g., sex,
+age, and treatment status; referred to as `covariates').  The
+information describing the samples can be represented as a table with
+$S$ rows and $V$ columns, where $V$ is the number of covariates.
+An example of phenotypic data can be input with
+<<pData>>=
+pDataFile <- file.path(dataDirectory, "pData.txt")
+pData <- read.table(pDataFile,
+                    row.names=1, header=TRUE, sep="\t")
+dim(pData)
+rownames(pData)
+summary(pData)
+@ 
+%% 
+There are three columns of data, and 26 rows. Note that the number of
+rows of phenotypic data match the number of columns of expression
+data, and indeed that the row and column names are identically
+ordered:
+<<geneCovariate-geneData-name-match>>=
+all(rownames(pData)==colnames(exprs))
+@ 
+%% 
+This is an essential feature of the relationship between the
+assay and phenotype data; \Rclass{ExpressionSet} will complain if
+these names do not match.
+
+Phenotypic data can take on a number of different forms. For instance,
+some covariates might reasonably be represented as numeric values.
+Other covariates (e.g., gender, tissue type, or cancer status) might
+better be represented as \Robject{factor} objects (see the help page
+for \Robject{factor} for more information). It is especially important
+that the phenotypic data are encoded correctly; the \Robject{colClasses}
+argument to \Rfunction{read.table} can be helpful in correctly
+inputing (and ignoring, if desired) columns from the file.
+
+\begin{Ex}
+  What class does \Rfunction{read.table} return?
+\end{Ex}
+
+\begin{Ex}
+  Determine the column names of \Robject{pData}.  Hint:
+  \Robject{apropos("name")}.
+\end{Ex}
+\begin{solution}
+<<colnames>>=
+names(pData)
+@ 
+\end{solution}
+
+\begin{Ex}
+  Use \Rfunction{sapply} to determine the classes of each column of
+  \Robject{pData}.  Hint: read the help page for \Rfunction{sapply}.
+\end{Ex}
+\begin{solution}
+<<sapplyClasses>>=
+sapply(pData, class)
+@ 
+\end{solution}
+
+\begin{Ex}
+  What is the sex and Case/Control status of the 15th and 20th
+  samples?  And for the sample(s) with \Robject{score} greater than
+  $0.8$.
+\end{Ex}
+\begin{solution}
+<<simpleSubsetting>>=
+pData[c(15, 20), c("gender", "type")]
+pData[pData$score>0.8,]
+@ 
+\end{solution}
+
+Investigators often find that the meaning of simple column names does
+not provide enough information about the covariate -- What is the
+cryptic name supposed to represent? What units are the covariates
+measured in? We can create a data frame containing such meta-data (or
+read the information from a file using \Rfunction{read.table}) with
+<<metadata-create>>=
+metadata <- data.frame(labelDescription=
+                       c("Patient gender", 
+                         "Case/control status", 
+                         "Tumor progress on XYZ scale"),
+                       row.names=c("gender", "type", "score"))
+@ 
+%% 
+This creates a \Rclass{data.frame} object with a single column called
+\code{labelDescription}, and with row names identical to the column
+names of the \Rclass{data.frame} containing the phenotypic data. The
+column \Robject{labelDescription} \emph{must} be present; other columns
+are optional.
+
+Bioconductor's \Rpackage{Biobase} package provides a class called
+\Rclass{AnnotatedDataFrame} that conveniently stores and manipulates
+the phenotypic data and its metadata in a coordinated fashion. Create
+and view an \Rclass{AnnotatedDataFrame} instance with:
+<<AnnotatedDataFrame>>=
+phenoData <- new("AnnotatedDataFrame", 
+                 data=pData, varMetadata=metadata)
+phenoData
+@ 
+%% 
+Some useful operations on an \Rclass{AnnotatedDataFrame} include
+\Rmethod{sampleNames}, \Rmethod{pData} (to extract the original
+\Robject{pData} \Rclass{data.frame}), and \Rmethod{varMetadata}. In addition,
+\Rclass{AnnotatedDataFrame} objects can be subset much like a
+\Rclass{data.frame}:
+<<AnnotatedDataFrame-subset>>=
+head(pData(phenoData))
+phenoData[c("A","Z"),"gender"]
+pData(phenoData[phenoData$score>0.8,])
+@ 
+%% 
+
+\subsection{Annotations and feature data}
+
+Meta-data on features is as important as meta-data on samples, and can
+be very large and diverse.  A single chip design (i.e., collection of
+features) is likely to be used in many different experiments, and it
+would be inefficient to repeatedly collect and coordinate the same
+meta-data for each \Rclass{ExpressionSet} instance. Instead, the ideas
+is to construct specialized meta-data packages for each type of chip
+or instrument.  Many of these packages are available from the
+Bioconductor web site.  These packages contain information such as the
+gene name, symbol and chromosomal location. There are other meta-data
+packages that contain the information that is provided by other
+initiatives such as GO and KEGG.  The \Rpackage{annotate} and
+\Rpackage{AnnotationDbi} packages provides basic data manipulation
+tools for the meta-data packages.
+
+The appropriate way to create annotation data for features is very
+straight-forward: we provide a character string identifying the type of
+chip used in the experiment. For instance, the data we are using is
+from the Affymetrix hgu95av2 chip:
+<<annotation>>=
+annotation <- "hgu95av2"
+@ 
+%% 
+It is also possible to record information about features that are
+unique to the experiment (e.g., flagging particularly relevant
+features).  This is done by creating or modifying an
+\Robject{AnnotatedDataFrame} like that for \Robject{phenoData} but
+with row names of the \Rclass{AnnotatedDataFrame} matching rows of the
+assay data.
+
+\subsection{Experiment description}
+
+Basic description about the experiment (e.g., the investigator or lab
+where the experiment was done, an overall title, and other notes) can
+be recorded by creating a \Rclass{MIAME} object. One way to create a
+\Rclass{MIAME} object is to use the \Rfunction{new} function:
+<<R.MIAME>>=
+experimentData <- new("MIAME",
+  name="Pierre Fermat",
+  lab="Francis Galton Lab",
+  contact="pfermat at lab.not.exist",
+  title="Smoking-Cancer Experiment",
+  abstract="An example ExpressionSet",
+  url="www.lab.not.exist",
+  other=list(
+    notes="Created from text files"
+  ))
+@ 
+%% 
+Usually, \Rfunction{new} takes as arguments  the class name and
+pairs of names and values corresponding to different slots in the
+class; consult the help page for \Rclass{MIAME} for details of
+available slots.
+
+\subsection{Assembling an \Rclass{ExpressionSet}}
+
+An \Rclass{ExpressionSet} object is created by assembling its component
+parts and callng the \code{ExpressionSet} constructor:
+<<ExpressionSetFinally>>=
+exampleSet <- ExpressionSet(assayData=exprs, 
+                  phenoData=phenoData, 
+                  experimentData=experimentData,
+                  annotation="hgu95av2")
+@ 
+%% 
+Note that the names on the right of each equal sign can refer to any
+object of appropriate class for the argument. See the help page for
+\Rclass{ExpressionSet} for more information.  
+
+We created a rich data object to coordinate diverse sources of
+information. Less rich objects can be created by providing less
+information. As mentioned earlier, a minimal expression set can be
+created with
+<<ExpressionSet-minimal>>=
+minimalSet <- ExpressionSet(assayData=exprs)
+@ 
+%% 
+Of course this object has no information about phenotypic or feature
+data, or about the chip used for the assay.
+
+\section{\Rclass{ExpressionSet} Basics}
+
+Now that you have an \Rclass{ExpressionSet} instance, let's explore
+some of the basic operations.  You can get an overview of the
+structure and available methods for \Rclass{ExpressionSet} objects by
+reading the help page:
+<<helpExpressionSet, eval=FALSE>>=
+help("ExpressionSet-class")
+@ 
+
+When you print an \Rclass{ExpressionSet} object, a brief summary of
+the contents of the object is displayed (displaying the entire object
+would fill your screen with numbers):
+<<showExpressionSet>>=
+exampleSet
+@ 
+
+\subsection{Accessing Data Elements}
+
+A number of accessor functions are available to extract data from an
+\Rclass{ExpressionSet} instance.
+You can access the columns of the phenotype data (an
+\Rclass{AnnotatedDataFrame} instance) using \verb+$+:
+<<usingDollar>>=
+exampleSet$gender[1:5]
+exampleSet$gender[1:5] == "Female"
+@ 
+%% 
+You can retrieve the names of the features using
+\Rfunction{featureNames}.  For many microarray datasets, the feature
+names are the probe set identifiers.
+<<featureNames>>=
+featureNames(exampleSet)[1:5]
+@ 
+%% 
+The unique identifiers of the samples in the data set are available
+via the \Rfunction{sampleNames} method.  The \Rfunction{varLabels}
+method lists the column names of the phenotype data:
+<<sampleNames>>=
+sampleNames(exampleSet)[1:5]
+varLabels(exampleSet)
+@ 
+%% 
+Extract the expression matrix of
+sample information using \Rfunction{exprs}:
+<<exprs>>=
+mat <- exprs(exampleSet)
+dim(mat)
+@ 
+
+\subsubsection{Subsetting}
+
+Probably the most useful operation to perform on
+\Rclass{ExpressionSet} objects is subsetting.  Subsetting an
+\Rclass{ExpressionSet} is very similar to subsetting the expression
+matrix that is contained within the \Rclass{ExpressionSet}, the first
+argument subsets the features and the second argument subsets the
+samples.  Here are some examples: Create a new \Rclass{ExpressionSet}
+consisting of the 5 features and the first 3 samples:
+<<first10>>=
+vv <- exampleSet[1:5, 1:3]
+dim(vv)
+featureNames(vv)
+sampleNames(vv)
+@ 
+%% 
+Create a subset consisting of only the male samples:
+<<males>>=
+males <- exampleSet[ , exampleSet$gender == "Male"]
+males
+@ 
+
+\section{What was used to create this document}
+
+The version number of \R{} and the packages and their versions that were
+used to generate this document are listed below.
+
+<<echo=FALSE,results=tex>>=
+toLatex(sessionInfo())
+@
+ 
+\end{document}
diff --git a/vignettes/HowTo.Rnw b/vignettes/HowTo.Rnw
new file mode 100644
index 0000000..6d670a3
--- /dev/null
+++ b/vignettes/HowTo.Rnw
@@ -0,0 +1,91 @@
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+% \VignetteIndexEntry{Notes for writing introductory 'how to' documents}
+%\VignetteDepends{}
+%\VignetteKeywords{Expression Analysis}
+%\VignettePackage{Biobase}
+\documentclass[12pt]{article}
+
+\usepackage{times}
+\usepackage{hyperref}
+
+\newcommand{\Rfunction}[1]{{\texttt{#1}}}
+\newcommand{\Robject}[1]{{\texttt{#1}}}
+\newcommand{\Rpackage}[1]{{\textit{#1}}}
+\newcommand{\Rmethod}[1]{{\texttt{#1}}}
+\newcommand{\Rfunarg}[1]{{\texttt{#1}}}
+\newcommand{\Rclass}[1]{{\textit{#1}}}
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\bibliographystyle{plainnat}
+
+\begin{document}
+
+\section*{How to write a HowTo}
+
+One of the goals of the Bioconductor project is to produce (and
+encourage others to produce) documentation on how to perform various
+tasks. Our main interest is in tasks associated with computational
+biology. However, we hope to produce HowTo documents for a wide
+variety of tasks.
+
+R has a very good mechanism for documenting individual functions,
+methods and classes. However, there are many situations where the task
+that we want to perform requires the use of many components. In other
+cases we would like to document the overall purpose of an R package
+rather than the individual functions. In this document we provide some
+advice on how to construct a document to describe how to perform a task.
+
+In most cases HowTo's will be written using \Rfunction{Sweave} in the
+\Rpackage{tools} package.
+In this document we give some general advice on how to write a HowTo.
+Of courese there is no \textit{right} way to do this but we feel that we
+can provide a few design principles that will help authors write
+better HowTo's.
+
+
+These design principles are listed below:
+\begin{itemize}
+\item It should be short (2 pages at most) and explicit.
+\item It should be about a single topic.
+\item It should contain runnable code and rely on data that are
+  available in R or the libraries needed to carry out the task being
+  documented.
+\item HowTo's should not be about single functions. The function
+  documentation is the right place to document that. HowTo's should
+  document a process or task and will typically involve several functions.
+
+\item To paraphrase Paul Halmos, you should imagine that you are
+  writing a document for a friend who is as smart and has the same
+  general level of knowledge as you but who does
+  not know how to do the specific task at hand.
+
+\item Make use of the indexing system. The title of the document should
+be included in the \verb+% \VignetteIndexEntry+.
+It should
+contain the word \verb+HowTo+ to easily allow for programmatic
+manipulation and sorting of the HowTo's.
+\end{itemize}
+
+\section{Session Information}
+
+The version number of R and packages loaded for generating the vignette were:
+
+\begin{verbatim}
+<<echo=FALSE,results=tex>>=
+sessionInfo()
+@
+\end{verbatim}
+
+\end{document}
diff --git a/vignettes/Qviews.Rnw b/vignettes/Qviews.Rnw
new file mode 100644
index 0000000..f2bfbd9
--- /dev/null
+++ b/vignettes/Qviews.Rnw
@@ -0,0 +1,176 @@
+%\VignetteIndexEntry{quick views of eSet instances}
+%\VignetteDepends{Biobase, ALL}
+%\VignetteKeywords{Data representation, Analysis}
+%\VignettePackage{Biobase}
+
+
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+\documentclass[12pt]{article}
+\usepackage{amsmath,fullpage}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+
+\newcommand{\Rfunction}[1]{{\texttt{#1}}}
+\newcommand{\Robject}[1]{{\texttt{#1}}}
+\newcommand{\Rpackage}[1]{{\textit{#1}}}
+\newcommand{\Rmethod}[1]{{\texttt{#1}}}
+\newcommand{\Rfunarg}[1]{{\texttt{#1}}}
+\newcommand{\Rclass}[1]{{\textit{#1}}}
+
+\textwidth=6.2in
+
+\bibliographystyle{plainnat} 
+ 
+\begin{document}
+%\setkeys{Gin}{width=0.55\textwidth}
+
+\title{quick view tools for eSets}
+\author{VJ Carey}
+
+\maketitle
+\tableofcontents
+
+\section{Introduction}
+
+In teaching a course where a large number of datasets are
+introduced over a short period of time, the relationship
+between data content and software infrastructure can
+be hard to master.  This document introduces a number of
+experimental approaches to getting rapid access to key
+elements of eSet derivatives.
+
+
+
+We will work with the ALL data for demonstration.
+<<doa,echo=FALSE,results=hide>>=
+if (!("Biobase" %in% search())) library(Biobase)
+if (!("ALL" %in% search())) library(ALL)
+if (!("ALL" %in% objects())) data(ALL)
+<<getaEF,eval=FALSE>>=
+library(Biobase)
+library(ALL)
+data(ALL)
+ALL
+@
+
+\section{An alternative to the current show method}
+
+It could be nice to tell the package from which the dataset
+was loaded.
+
+<<mkprov>>=
+dataSource = function(dsn) {
+ if (!is(dsn, "character")) dsn = try(deparse(substitute(dsn)))
+ if (inherits(dsn, "try-error")) stop("can't parse dsn arg")
+ dd = data()$results
+ if (is.na(match(dsn, dd[,"Item"]))) return(NULL)
+ paste("package:", dd[ dd[,"Item"] == dsn, "Package" ], sep="")
+}
+ 
+
+<<newmeth,echo=FALSE,results=hide>>=
+setGeneric("peek", function(x,maxattr=10)standardGeneric("peek"))
+setMethod("peek", c("eSet", "numeric"), function(x,maxattr=10) {
+ ds = dataSource(deparse(substitute(x)))
+ if (!is.null(ds)) ds = paste(" [from ", ds, "]", sep="")
+  else ds = ""
+ cat(deparse(substitute(x)), ds, ":\n", sep="")
+ cat("Platform annotation: ", annotation(x),"\n")
+ cat("primary assay results are:\n")
+ print(dim(x))
+ cat("sample attributes are:\n")
+   vn = rownames(varMetadata(x))
+   ld = substr(varMetadata(x)$labelDescription,1,50)
+   dd = data.frame("labelDescription[truncated]"=ld)
+   rownames(dd) = vn
+ if ((ndd <- nrow(dd)) <= maxattr) show(dd)
+ else {
+    cat("first", maxattr, "of", ndd, "attributes:\n")
+    show(dd[1:maxattr,,drop=FALSE])
+    }
+ cat("----------\n")
+ cat("use varTable to see values/freqs of all sample attributes\n")
+ cat("----------\n")
+})
+setMethod("peek", c("eSet", "missing"), function(x,maxattr=10) {
+ ds = dataSource(deparse(substitute(x)))
+ if (!is.null(ds)) ds = paste(" [from ", ds, "]", sep="")
+  else ds = ""
+ cat(deparse(substitute(x)), ds, ":\n", sep="")
+ cat("Platform annotation: ", annotation(x),"\n")
+ cat("primary assay results are:\n")
+ print(dim(x))
+ cat("sample attributes are:\n")
+   vn = rownames(varMetadata(x))
+   ld = substr(varMetadata(x)$labelDescription,1,50)
+   dd = data.frame("labelDescription[truncated]"=ld)
+   rownames(dd) = vn
+ if ((ndd <- nrow(dd)) <= maxattr) show(dd)
+ else {
+    cat("first", maxattr, "of", ndd, "attributes:\n")
+    show(dd[1:maxattr,,drop=FALSE])
+    }
+ cat("----------\n")
+ cat("use varTable to see values/freqs of all sample attributes\n")
+ cat("----------\n")
+})
+setGeneric("varTable", function(x, full=FALSE, max=Inf) standardGeneric("varTable"))
+setMethod("varTable", c("eSet", "missing", "ANY"), function(x, full=FALSE, max=Inf) varTable(x, FALSE, max))
+setMethod("varTable", c("eSet", "logical", "ANY"), function(x, full=FALSE, max=Inf) {
+   ans = lapply( names(pData(x)), function(z)table(x[[z]]) )
+   tans = lapply(ans, names)
+   kp = 1:min(max,length(tans))
+   if (!full) ans = sapply(tans, selectSome, 3)[kp]
+   else ans = tans[kp]
+   names(ans) = names(pData(x))[kp]
+   ans
+})
+setGeneric("varNames", function(x) standardGeneric("varNames"))
+setMethod("varNames", "eSet", function(x) names(pData(x)))
+@
+
+We use \texttt{peek} to get a concise view:
+<<lka>>=
+peek(ALL)
+@
+
+
+\section{Sample characterization}
+
+Getting a handle on sample characterization requires survey
+of variable names.
+<<lkv>>=
+varNames(ALL)
+@
+
+In addition, we need to know values taken.  This can be very
+cumbersome.  We have a few parameters on how much detail
+is provided.
+<<lkvn>>=
+varTable(ALL, max=4)
+@
+In the above, we are only showing 4 attributes.  By default
+all attributes would be shown.  Note
+that the report on range of values is truncated and is character
+mode.  We can show the full range of values using the
+\texttt{full} parameter.
+<<lkvn>>=
+varTable(ALL, full=TRUE, max=4)
+@
+
+\end{document}
diff --git a/vignettes/esApply.Rnw b/vignettes/esApply.Rnw
new file mode 100644
index 0000000..2f27e35
--- /dev/null
+++ b/vignettes/esApply.Rnw
@@ -0,0 +1,132 @@
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+% \VignetteIndexEntry{esApply Introduction}
+%\VignetteDepends{Biobase}
+%\VignetteKeywords{Expression Analysis}
+%\VignettePackage{Biobase}
+\documentclass[12pt]{article}
+\usepackage{amsmath,fullpage}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\newcommand{\Rfunction}[1]{{\texttt{#1}}}
+\newcommand{\Robject}[1]{{\texttt{#1}}}
+\newcommand{\Rpackage}[1]{{\textit{#1}}}
+\newcommand{\Rmethod}[1]{{\texttt{#1}}}
+\newcommand{\Rfunarg}[1]{{\texttt{#1}}}
+\newcommand{\Rclass}[1]{{\textit{#1}}}
+
+
+\bibliographystyle{plainnat}
+
+\begin{document}
+
+\section*{A note on {\tt esApply}}
+
+{\tt ExpressionSet}s are complex objects.
+\Robject{exprs(ExpressionSet)} produces $G \times N$,
+where $G$ is the number of genes on a chip and $N$ is
+the number of tissues analyzed, and
+\Robject{pData(ExpressionSet)} produces $N \times p$,
+where $p$ is the number of phenotypic or demographic,
+etc., variables collected.
+
+Abstractly, we are often interested in evaluating
+functions $f(y;x)$ where $y$ is an $N$-vector of
+expression results for a specific gene and $x$ is
+an $N$-dimensional structure, coordinated with $y$,
+that distinguishes elements of $y$ for processing in
+the function $f$. A basic problem is to guarantee that
+the $j$th element of $y$ is correctly associated with
+the $j$th component of $x$.
+
+<<R.hide, results=hide, echo=FALSE>>=
+library(Biobase)
+data(sample.ExpressionSet)
+@
+
+As an example, let's consider \Robject{sample.ExpressionSet},
+which is an \Rclass{ExpressionSet} supplied with Biobase.
+We will print a little report, then the first $N$-vector of
+gene expressions and some covariate data:
+
+<<R>>=
+print(sample.ExpressionSet)
+print(exprs(sample.ExpressionSet)[1,])
+print(pData(sample.ExpressionSet)[1:2,1:3])
+@
+
+Now let's see how expressions and a covariate are related:
+
+<<R>>=
+print(rbind(exprs(sample.ExpressionSet[1,]),
+sex <- t(pData(sample.ExpressionSet))[1,]))
+@
+
+A function that evaluates the difference in median expression
+across strata defined using an abstract covariate \Robject{x} is
+
+<<R>>=
+medContr <- function( y, x ) {
+ ys <- split(y,x)
+ median(ys[[1]]) - median(ys[[2]])
+}
+@
+
+We can apply this to a small \Rclass{ExpressionSet} that gives
+back the data listed above:
+
+<<R>>=
+print(apply(exprs(sample.ExpressionSet[1,,drop=F]), 1,
+  medContr, pData(sample.ExpressionSet)[["sex"]]))
+@
+
+That's a bit clumsy.  This is where \Rfunction{esApply} comes
+in.  We pay for some simplicity by following a strict protocol
+for the definition of the statistical function to be applied.
+
+<<R>>=
+medContr1 <- function(y) {
+ ys <- split(y,sex)
+ median(ys[[1]]) - median(ys[[2]])
+}
+
+print(esApply( sample.ExpressionSet, 1, medContr1)[1])
+@
+
+The manual page on \Rfunction{esApply} has a number of
+additional examples that show how applicable functions
+can be constructed and used.  The important thing to
+note is that the applicable functions {\em know} the names of
+the covariates in the \Robject{pData} dataframe.
+
+This is achieved by having an environment populated with all the
+variables in \Rclass{phenoData(ExpressionSet)} put in as the
+environment of the function that will be applied. If that function
+already has an environment we retain that but in the second position.
+Thus, there is some potential for variable shadowing.
+
+\section{Session Information}
+
+The version number of R and packages loaded for generating the vignette were:
+
+\begin{verbatim}
+<<echo=FALSE,results=tex>>=
+sessionInfo()
+@
+\end{verbatim}
+
+
+\end{document}
diff --git a/inst/doc/legacy/Biobase.Rnw b/vignettes/legacy/Biobase.Rnw
similarity index 100%
rename from inst/doc/legacy/Biobase.Rnw
rename to vignettes/legacy/Biobase.Rnw

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-biobase.git



More information about the debian-med-commit mailing list