Browse code

13 Dec 2017: limma 3.35.4

- "TestResults" objects now include a 'labels' attribute, defaulting
to c("Down","NotSig","Up").

Gordon Smyth authored on 13/12/2017 06:22:43
Showing 5 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: limma
2
-Version: 3.35.3
3
-Date: 2017-12-03
2
+Version: 3.35.4
3
+Date: 2017-12-13
4 4
 Title: Linear Models for Microarray Data
5 5
 Description: Data analysis, linear models and differential expression for microarray data.
6 6
 Author: Gordon Smyth [cre,aut], Yifang Hu [ctb], Matthew Ritchie [ctb], Jeremy Silver [ctb], James Wettenhall [ctb], Davis McCarthy [ctb], Di Wu [ctb], Wei Shi [ctb], Belinda Phipson [ctb], Aaron Lun [ctb], Natalie Thorne [ctb], Alicia Oshlack [ctb], Carolyn de Graaf [ctb], Yunshun Chen [ctb], Mette Langaas [ctb], Egil Ferkingstad [ctb], Marcus Davy [ctb], Francois Pepin [ctb], Dongseok Choi [ctb]
... ...
@@ -84,6 +84,8 @@ S3method(goana,default)
84 84
 S3method(goana,MArrayLM)
85 85
 S3method(kegga,default)
86 86
 S3method(kegga,MArrayLM)
87
+S3method(labels,TestResults)
88
+S3method(levels,TestResults)
87 89
 S3method(merge,MAList)
88 90
 S3method(merge,RGList)
89 91
 S3method(merge,EList)
... ...
@@ -10,7 +10,9 @@ summary.TestResults <- function(object,...)
10 10
 	if(is.null(Levels)) Levels <- c(-1L,0L,1L)
11 11
 	nlevels <- length(Levels)
12 12
 	tab <- matrix(0L,nlevels,ncol(object))
13
-	dimnames(tab) <- list(as.character(Levels),colnames(object))
13
+	Labels <- attr(object,"labels")
14
+	if(is.null(Labels)) Labels <- as.character(Levels)
15
+	dimnames(tab) <- list(Labels,colnames(object))
14 16
 	for (i in 1:nlevels) tab[i,] <- colSums(object==Levels[i],na.rm=TRUE)
15 17
 	class(tab) <- "table"
16 18
 	tab
... ...
@@ -21,12 +23,18 @@ setMethod("show","TestResults",function(object) {
21 23
 	printHead([email protected])
22 24
 })
23 25
 
26
+levels.TestResults <- function(x) attr(x,"levels")
27
+
28
+labels.TestResults <- function(object,...) attr(object,"labels")
29
+
30
+
24 31
 decideTests <- function(object,...) UseMethod("decideTests")
25 32
 
26 33
 decideTests.default <- function(object,method="separate",adjust.method="BH",p.value=0.05,lfc=0,coefficients=NULL,cor.matrix=NULL,tstat=NULL,df=Inf,genewise.p.value=NULL,...)
27 34
 #	Accept or reject hypothesis tests across genes and contrasts
35
+#	from a matrix of p-values
28 36
 #	Gordon Smyth
29
-#	17 Aug 2004. Last modified 8 Jan 2017.
37
+#	17 Aug 2004. Last modified 13 Dec 2017.
30 38
 {
31 39
 	method <- match.arg(method,c("separate","global","hierarchical","nestedF"))
32 40
 	if(method=="nestedF") stop("nestedF adjust method requires an MArrayLM object",call.=FALSE)
... ...
@@ -82,8 +90,10 @@ decideTests.default <- function(object,method="separate",adjust.method="BH",p.va
82 90
 	if(is.null(coefficients)) coefficients <- tstat
83 91
 	if(is.null(coefficients)) {
84 92
 		attr(isDE,"levels") <- c(0L,1L)
93
+		attr(isDE,"labels") <- c("NotSig","Sig")
85 94
 	} else {
86 95
 		attr(isDE,"levels") <- c(-1L,0L,1L)
96
+		attr(isDE,"labels") <- c("Down","NotSig","Up")
87 97
 		coefficients <- as.matrix(coefficients)
88 98
 		if( !all(dim(coefficients)==dim(p)) ) stop("dim(object) disagrees with dim(coefficients)")
89 99
 		i <- coefficients<0
... ...
@@ -97,7 +107,7 @@ decideTests.default <- function(object,method="separate",adjust.method="BH",p.va
97 107
 decideTests.MArrayLM <- function(object,method="separate",adjust.method="BH",p.value=0.05,lfc=0,...)
98 108
 #	Accept or reject hypothesis tests across genes and contrasts
99 109
 #	Gordon Smyth
100
-#	17 Aug 2004. Last modified 8 Jan 2017.
110
+#	17 Aug 2004. Last modified 13 Dec 2017.
101 111
 {
102 112
 	if(is.null(object$p.value)) object <- eBayes(object)
103 113
 	method <- match.arg(method,c("separate","global","hierarchical","nestedF"))
... ...
@@ -154,6 +164,8 @@ decideTests.MArrayLM <- function(object,method="separate",adjust.method="BH",p.v
154 164
 		else
155 165
 			[email protected] <- [email protected] * (abs(object$coefficients)>lfc)
156 166
 	}
167
+	attr(results,"levels") <- c(-1L,0L,1L)
168
+	attr(results,"labels") <- c("Down","NotSig","Up")
157 169
 	results
158 170
 }
159 171
 
... ...
@@ -1,3 +1,8 @@
1
+13 Dec 2017: limma 3.35.4
2
+
3
+- "TestResults" objects now include a 'labels' attribute, defaulting
4
+  to c("Down","NotSig","Up").
5
+
1 6
  3 Dec 2017: limma 3.35.3
2 7
 
3 8
 - New arguments 'quote' and 'row.names' for write.fit(). Write.fit()
... ...
@@ -3,6 +3,8 @@
3 3
 \alias{TestResults-class}
4 4
 \alias{show,TestResults-method}
5 5
 \alias{summary.TestResults}
6
+\alias{levels.TestResults}
7
+\alias{labels.TestResults}
6 8
 \title{Matrix of Test Results - class}
7 9
 
8 10
 \description{
... ...
@@ -12,10 +14,12 @@ A matrix-based class for storing the results of simultanous tests.
12 14
 
13 15
 \usage{
14 16
 \S3method{summary}{TestResults}(object, \dots)
17
+\S3method{labels}{TestResults}(object, \dots)
18
+\S3method{levels}{TestResults}(x)
15 19
 }
16 20
 
17 21
 \arguments{
18
-\item{object}{object of class \code{TestResults}}
22
+\item{object, x}{object of class \code{TestResults}}
19 23
 \item{\dots}{other arguments are not used}
20 24
 }
21 25
 
... ...
@@ -46,8 +50,8 @@ Functions in LIMMA which operate on \code{TestResults} objects include
46 50
 }
47 51
 
48 52
 \examples{\dontrun{
49
-#  Assume a data object MA and a design matrix
50
-fit <- lmFit(MA, design)
53
+#  Assume a data object y and a design matrix
54
+fit <- lmFit(y, design)
51 55
 fit <- eBayes(fit)
52 56
 results <- decideTests(fit)
53 57
 summary(results)