- plotWithHighlights and plotMD.MArrayLM now gives special treatment
to the case that `status` is a TestResults object.
- new S3 unique() method for TestResults objects.
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
Package: limma |
2 |
-Version: 3.41.4 |
|
3 |
-Date: 2019-06-16 |
|
2 |
+Version: 3.41.5 |
|
3 |
+Date: 2019-06-17 |
|
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] |
... | ... |
@@ -30,7 +30,7 @@ plotMD.MAList <- function(object, column=1, array=NULL, xlab="A", ylab="M", main |
30 | 30 |
plotMD.MArrayLM <- function(object, column=ncol(object), coef=NULL, xlab="Average log-expression", ylab="log-fold-change", main=colnames(object)[column], status=object$genes$Status, zero.weights=FALSE, ...) |
31 | 31 |
# Mean-difference plot with color coding for controls |
32 | 32 |
# Gordon Smyth 7 April 2003, James Wettenhall 27 June 2003. |
33 |
-# Last modified 16 June 2019. |
|
33 |
+# Last modified 17 June 2019. |
|
34 | 34 |
{ |
35 | 35 |
if(!is.null(coef)) column <- coef |
36 | 36 |
if(is.null(object$Amean)) stop("Amean component is absent.") |
... | ... |
@@ -39,19 +39,12 @@ plotMD.MArrayLM <- function(object, column=ncol(object), coef=NULL, xlab="Averag |
39 | 39 |
w <- as.matrix(object$weights)[,column] |
40 | 40 |
logFC[ is.na(w) | (w <= 0) ] <- NA |
41 | 41 |
} |
42 |
- if(is(status,"TestResults")) { |
|
43 |
- if(ncol(status) > 1L) status <- status[,column] |
|
44 |
- Dots <- list(...) |
|
45 |
-# Set values and colors only if 'values' is not already specified as an argument |
|
46 |
- if(is.null(Dots$values)) { |
|
47 |
- f <- factor([email protected],levels=c(-1,0,1)) |
|
48 |
- levels(f) <- attr(status,"labels") |
|
49 |
- f <- as.character(f) |
|
50 |
- attr(f,"values") <- c("Up","Down") |
|
51 |
- attr(f,"col") <- c("red","blue") |
|
52 |
- status <- f |
|
53 |
- } |
|
54 |
- } |
|
42 |
+ if(is(status,"TestResults")) |
|
43 |
+ if(ncol(status) > 1L) |
|
44 |
+ if(ncol(status == ncol(object))) |
|
45 |
+ status <- status[,column] |
|
46 |
+ else |
|
47 |
+ stop("status has multiple columns") |
|
55 | 48 |
plotWithHighlights(x=object$Amean,y=logFC,xlab=xlab,ylab=ylab,main=main,status=status,...) |
56 | 49 |
} |
57 | 50 |
|
... | ... |
@@ -5,7 +5,7 @@ plotWithHighlights <- function(x, y, status=NULL, values=NULL, hl.pch=16, hl.col |
5 | 5 |
# created by Gordon Smyth 7 April 2003 and modified by James Wettenhall 27 June 2003. |
6 | 6 |
|
7 | 7 |
# Gordon Smyth |
8 |
-# Last modified 27 May 2017. |
|
8 |
+# Last modified 17 June 2019. |
|
9 | 9 |
{ |
10 | 10 |
# If no status information, just plot all points normally |
11 | 11 |
if(is.null(status) || all(is.na(status))) { |
... | ... |
@@ -18,10 +18,22 @@ plotWithHighlights <- function(x, y, status=NULL, values=NULL, hl.pch=16, hl.col |
18 | 18 |
# Check values |
19 | 19 |
if(is.null(values)) { |
20 | 20 |
if(is.null(attr(status,"values"))) { |
21 |
-# Default is to set the most frequent status value as background, and to highlight other status values in decreasing order of frequency |
|
22 |
- status.values <- names(sort(table(status),decreasing=TRUE)) |
|
23 |
- status <- as.character(status) |
|
24 |
- values <- status.values[-1] |
|
21 |
+ if(is(status,"TestResults")) { |
|
22 |
+ if(ncol(status) > 1L) stop("status has more than one column") |
|
23 |
+ Values <- c(-1L,0L,1L) |
|
24 |
+ Labels <- c("Down","NotSig","Up") |
|
25 |
+ f <- factor([email protected],levels=Values) |
|
26 |
+ levels(f) <- Labels |
|
27 |
+ status <- as.character(f) |
|
28 |
+ values <- c("Up","Down") |
|
29 |
+ if(is.null(hl.col)) hl.col <- c("red","blue") |
|
30 |
+ } else { |
|
31 |
+# Default is to set the most frequent status value as background, |
|
32 |
+# and to highlight other status values in decreasing order of frequency |
|
33 |
+ status.values <- names(sort(table(status),decreasing=TRUE)) |
|
34 |
+ status <- as.character(status) |
|
35 |
+ values <- status.values[-1] |
|
36 |
+ } |
|
25 | 37 |
} else { |
26 | 38 |
# Use values and graphics parameters set as attributes by controlStatus() |
27 | 39 |
values <- attr(status,"values") |
... | ... |
@@ -1,11 +1,13 @@ |
1 |
-16 June 2019: limma 3.41.5 |
|
1 |
+17 June 2019: limma 3.41.5 |
|
2 | 2 |
|
3 |
-- plotMD.MArrayLM now gives special treatment to the case that |
|
4 |
- `status` is a TestResults object. |
|
3 |
+- plotWithHighlights and plotMD.MArrayLM now gives special treatment |
|
4 |
+ to the case that `status` is a TestResults object. |
|
5 |
+ |
|
6 |
+- new S3 unique() method for TestResults objects. |
|
5 | 7 |
|
6 | 8 |
16 June 2019: limma 3.41.4 |
7 | 9 |
|
8 |
-- New subsetting method for TestResults objects. Previously a |
|
10 |
+- New S3 subsetting method for TestResults objects. Previously a |
|
9 | 11 |
subsetted TestResults object became an ordinary numeric matrix, but |
10 | 12 |
now the TestResults class is preserved. Single index subsetting is |
11 | 13 |
also allowed but produces a numeric vector. |
... | ... |
@@ -14,12 +14,16 @@ plotWithHighlights(x, y, status = NULL, values = NULL, |
14 | 14 |
\arguments{ |
15 | 15 |
\item{x}{numeric vector.} |
16 | 16 |
|
17 |
- \item{y}{numeric vector.} |
|
17 |
+ \item{y}{numeric vector of same length as \code{x}.} |
|
18 | 18 |
|
19 |
- \item{status}{character vector giving the control status of each point, of same length as \code{x} and \code{y}. |
|
20 |
- If \code{NULL}, then all points are plotted in the background color, symbol and size.} |
|
19 |
+ \item{status}{ |
|
20 |
+ character vector giving the control status of each point, of same length as \code{x} and \code{y}, |
|
21 |
+ or else a \code{TestResults} object with one column and number of rows matching the length of \code{x}. |
|
22 |
+ If \code{NULL}, then all points are plotted in the background color, symbol and size. |
|
23 |
+ } |
|
21 | 24 |
|
22 | 25 |
\item{values}{character vector giving values of \code{status} to be highlighted on the plot. |
26 |
+ Set automatically if \code{status} contains \code{TestResults}. |
|
23 | 27 |
Defaults to unique values of \code{status} in decreasing order of frequency, with the most frequent value set as the background value. |
24 | 28 |
Ignored if there is no \code{status} vector.} |
25 | 29 |
|
... | ... |
@@ -27,6 +31,7 @@ plotWithHighlights(x, y, status = NULL, values = NULL, |
27 | 31 |
Ignored is there is no \code{status} vector.} |
28 | 32 |
|
29 | 33 |
\item{hl.col}{vector of colors for highlighted points, either of unit length or of same length as \code{values}. |
34 |
+ Set automatically if \code{status} contains \code{TestResults}. |
|
30 | 35 |
Defaults to \code{1+1:length(values)}. |
31 | 36 |
Ignored if there is no \code{status} vector.} |
32 | 37 |
|