[med-svn] [r-bioc-biobase] 05/07: New upstream version 2.34.0

Andreas Tille tille at debian.org
Tue Oct 25 19:51:30 UTC 2016


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 beead2ceb8a2ee06b48b3b1c8e30a787cc121f4a
Author: Andreas Tille <tille at debian.org>
Date:   Tue Oct 25 21:49:27 2016 +0200

    New upstream version 2.34.0
---
 DESCRIPTION                            |   4 ++--
 NAMESPACE                              |   3 ++-
 NEWS                                   |   7 ++++++
 R/methods-ExpressionSet.R              |   2 +-
 R/methods-eSet.R                       |  38 +++++++++++++++++++++++++++++++--
 build/vignette.rds                     | Bin 342 -> 344 bytes
 inst/doc/BiobaseDevelopment.pdf        | Bin 246470 -> 209348 bytes
 inst/doc/ExpressionSetIntroduction.pdf | Bin 174947 -> 157722 bytes
 inst/doc/esApply.pdf                   | Bin 93110 -> 86569 bytes
 inst/unitTests/test_EsetSubclasses.R   |   7 +++---
 inst/unitTests/test_ExpressionSet.R    |  14 ++++++++++++
 man/class.AssayData.Rd                 |   7 ++++--
 man/class.eSet.Rd                      |  13 +++++++----
 13 files changed, 79 insertions(+), 16 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index db8ae2a..ad9f560 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: Biobase
 Title: Biobase: Base functions for Bioconductor
-Version: 2.32.0
+Version: 2.34.0
 Author: R. Gentleman, V. Carey, M. Morgan, S. Falcon
 Description: Functions that are needed by many other packages or which
         replace R functions.
@@ -22,4 +22,4 @@ Collate: tools.R strings.R environment.R vignettes.R packages.R
 LazyLoad: yes
 biocViews: Infrastructure
 NeedsCompilation: yes
-Packaged: 2016-05-04 02:37:20 UTC; biocbuild
+Packaged: 2016-10-17 22:07:44 UTC; biocbuild
diff --git a/NAMESPACE b/NAMESPACE
index 24b739e..7438d16 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -8,7 +8,8 @@ importFrom(BiocGenerics,
     annotation, "annotation<-"
 )
 
-importFrom(utils, head, tail)
+importFrom(utils, head, tail, menu, packageDescription, read.table,
+           write.table)
 
 exportClasses(aggregator, container, eSet,
               MIAxE, MIAME, characterORMIAME,
diff --git a/NEWS b/NEWS
index 439f1e5..fd38adc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+CHANGES IN VERSION 2.33
+-----------------------
+
+BUG FIXES
+
+    o exprs<- enforces value with correct dim, dimnames.
+
 CHANGES IN VERSION 2.31
 -----------------------
 
diff --git a/R/methods-ExpressionSet.R b/R/methods-ExpressionSet.R
index 91644e8..4394c22 100644
--- a/R/methods-ExpressionSet.R
+++ b/R/methods-ExpressionSet.R
@@ -37,7 +37,7 @@ setMethod("initialize", "ExpressionSet",
     dimConflict <- function(dimNames, okNames, dim) {
         nm <- lapply(dimNames, "[[", dim)
         isConflict <- !sapply(nm, function(x, y) {
-            is.null(x) || all.equal(x, y, check.attr=FALSE)
+            is.null(x) || isTRUE(all.equal(x, y, check.attr=FALSE))
         }, okNames[[dim]])
         isNamed <- sapply(lapply(nm, names), length) > 0
         isNull <- sapply(nm, is.null)
diff --git a/R/methods-eSet.R b/R/methods-eSet.R
index 1e580ae..2ef3923 100644
--- a/R/methods-eSet.R
+++ b/R/methods-eSet.R
@@ -442,7 +442,38 @@ assayDataElementNames <- function(object) {
 
 assayDataElement <- function(object, elt) assayData(object)[[elt]]
 
-assayDataElementReplace <- function(obj, elt, value) {
+.validate_assayDataElementReplace <- function(obj, value) {
+    if (!is.null(value)) {
+        dimvalue <- dim(value)
+        dimobj <- dim(obj)[seq_along(dimvalue)]
+        if (!isTRUE(all.equal(unname(dimvalue), unname(dimobj))))
+            stop("object and replacement value have different dimensions")
+    }
+    
+    if (!is.null(value)) {
+        if (!is.null(dimnames(value))) {
+            ## validate and harmonize dimnames
+            vd <- Map(function(od, vd) {
+                if (is.null(vd))
+                    ## update vd to contain indexes into matrix
+                    od <- seq_along(od)
+                else if (!setequal(od, vd))
+                    stop("object and replacement value dimnames differ")
+                od
+            }, dimnames(obj), dimnames(value))
+            ## re-arrange value to have dimnames in same order as obj
+            value <- do.call(`[`, c(list(value), vd, drop=FALSE))
+        }
+        dimnames(value) <- dimnames(obj)
+    }
+    value
+}
+
+assayDataElementReplace <- function(obj, elt, value, validate=TRUE) {
+    ## 'validate' added later, needs to be last for position matching
+    if (validate)
+        value <- .validate_assayDataElementReplace(obj, value)
+
     storage.mode <- storageMode(obj)
     switch(storageMode(obj),
            "lockedEnvironment" = {
@@ -460,7 +491,10 @@ assayDataElementReplace <- function(obj, elt, value) {
     obj
 }
 
-`assayDataElement<-` <- assayDataElementReplace
+`assayDataElement<-` <- function(obj, elt, ..., value)
+    ## 'value' is always the last argument, but needs to be 3rd for
+    ## assayDataElementReplace
+    assayDataElementReplace(obj, elt, value, ...)
 
 setMethod("phenoData", "eSet", function(object) object at phenoData)
 
diff --git a/build/vignette.rds b/build/vignette.rds
index f7632d6..28c637f 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/BiobaseDevelopment.pdf b/inst/doc/BiobaseDevelopment.pdf
index 7bd21db..677c6cd 100644
Binary files a/inst/doc/BiobaseDevelopment.pdf and b/inst/doc/BiobaseDevelopment.pdf differ
diff --git a/inst/doc/ExpressionSetIntroduction.pdf b/inst/doc/ExpressionSetIntroduction.pdf
index ff875c6..56fdf71 100644
Binary files a/inst/doc/ExpressionSetIntroduction.pdf and b/inst/doc/ExpressionSetIntroduction.pdf differ
diff --git a/inst/doc/esApply.pdf b/inst/doc/esApply.pdf
index 4c79bb9..0b9f5ed 100644
Binary files a/inst/doc/esApply.pdf and b/inst/doc/esApply.pdf differ
diff --git a/inst/unitTests/test_EsetSubclasses.R b/inst/unitTests/test_EsetSubclasses.R
index 06542f7..c060083 100644
--- a/inst/unitTests/test_EsetSubclasses.R
+++ b/inst/unitTests/test_EsetSubclasses.R
@@ -209,10 +209,9 @@ testAssayDataReplacement <- function() {
 
 testAssayDataElement <- function() {
     checkObj <- function(obj) {
+        m <- new("matrix",0, nr=0, nc=0, dimnames=list(list(),list()))
         checkTrue(identical(assayDataElementNames(obj), "exprs"))
-        checkTrue(identical(assayDataElement(obj, "exprs"),
-                            new("matrix",0,dimnames=list(list(),list()))[FALSE,FALSE,drop=FALSE]))
-        m <- matrix(1:10, nrow=2)
+        checkTrue(identical(assayDataElement(obj, "exprs"), m))
         obj <- assayDataElementReplace(obj, "exprs", m)
         checkTrue(identical(assayDataElement(obj, "exprs"), m))
     }
@@ -295,7 +294,7 @@ testExprs <- function() {
     sNames <- sampleNames(obj)
     oldExprs <- exprs(obj)
     exprs(obj) <- newExprs
-    checkTrue( identical(exprs(obj), newExprs))
+    checkTrue( identical(unname(exprs(obj)), newExprs))
     if (storageMode(obj)!="environment")
       checkTrue(!identical(exprs(obj), oldExprs))
     sampleNames(assayData(obj)) <- sNames
diff --git a/inst/unitTests/test_ExpressionSet.R b/inst/unitTests/test_ExpressionSet.R
index 9584172..1be576e 100644
--- a/inst/unitTests/test_ExpressionSet.R
+++ b/inst/unitTests/test_ExpressionSet.R
@@ -173,3 +173,17 @@ testHarmonizeAssayDataDimnames <- function() {
     dimnames(se.exprs) <- list(letters[1:5], LETTERS[1:2])
     checkException(checkCreation(exprs, se.exprs), silent=TRUE)
 }
+
+testExprsReplacement <- function() {
+    exprs <- se.exprs <- matrix(1:50, 10, 5)
+    eset <- ExpressionSet(list2env(list(exprs=exprs, se.exprs=se.exprs)))
+    exprs(eset) <- exprs(eset)
+    checkTrue(validObject(eset))
+
+    ## shuffled names ok
+    exprs(eset) <- exprs(eset)[sample(rownames(eset)), sample(colnames(eset))]
+    checkTrue(validObject(eset))
+
+    checkException({ exprs(eset) <- exprs(eset)[, 1:3] }, silent=TRUE)
+    checkException({ exprs(eset) <- exprs(eset)[, c(1:4, 1)] }, silent=TRUE)
+}
diff --git a/man/class.AssayData.Rd b/man/class.AssayData.Rd
index 1c6f7c3..0171efb 100644
--- a/man/class.AssayData.Rd
+++ b/man/class.AssayData.Rd
@@ -71,8 +71,11 @@
       \code{assayData}, ensuring that the named elements \code{required}
       are present, matrices are of the same dimension, and \code{featureNames} (rownames) are
       consistent (identical or \code{NULL}) across entries.}
-    \item{assayDataElement(object, element)}{See \code{\link{eSet-class}}}
-    \item{assayDataElementReplace(object, element, value)}{See \code{\link{eSet-class}}}
+    \item{assayDataElement(object, element)}{See
+      \code{\link{eSet-class}}} 
+    \item{assayDataElementReplace(object, element, value,
+      validate=TRUE)}{
+      See \code{\link{eSet-class}}}
     \item{assayDataElementNames(object)}{See \code{\link{eSet-class}}}
   }
 }
diff --git a/man/class.eSet.Rd b/man/class.eSet.Rd
index bb990ea..4f0d1cf 100644
--- a/man/class.eSet.Rd
+++ b/man/class.eSet.Rd
@@ -240,10 +240,15 @@
    \describe{
     \item{assayDataElement(object, element)}{Return matrix
       \code{element} from \code{assayData} slot of \code{object}.}
-    \item{assayDataElement(object, element) <- value)}{Set element
-      \code{element} in \code{assayData} slot of \code{object} to matrix \code{value}}
-    \item{assayDataElementReplace(object, element, value)}{Set element
-      \code{element} in \code{assayData} slot of \code{object} to matrix \code{value}}
+    \item{assayDataElement(object, element, validate=TRUE) <-
+       value)}{Set element \code{element} in \code{assayData} slot of
+       \code{object} to matrix \code{value}. If \code{validate=TRUE},
+       check that value row and column names of conform to object.}
+    \item{assayDataElementReplace(object, element, value,
+      validate=TRUE)}{Set element \code{element} in \code{assayData}
+      slot of \code{object} to matrix \code{value}. If
+      \code{validate=TRUE}, check that row and column names of value
+      conform to object.}
     \item{assayDataElementNames(object)}{Return element names in
       \code{assayData} slot of \code{object}}
      \item{\code{updateOldESet}}{Update versions of \code{eSet}

-- 
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