plotPlate: Plot a well statistic for microtiter plates.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotPlate.R

Description

Plot a well statistic in false color representation or using a self-defined grid plotting function. The plot is supposed to resemble the physical geometry of a microtitre plate.

Usage

1
2
3
4
plotPlate(x,nrow = 8, ncol = 12, col=c("red", "blue"),
ind = 1:(ncol*nrow), xrange=function(y) range(y, na.rm=TRUE), na.action = "zero",
main, char, desc = character(2), add=FALSE, gridFun="default",
funArgs=NULL,...)

Arguments

x

Numeric vector of length ncol*nrow or matrix with ncol*nrow rows (except if argument ind is specified). If of class matrix, the use of argument gridFun is expected.

nrow

Numeric of length 1. The number of rows of the plate.

ncol

Numeric of length 1. The number of columns of the plate.

col

Character vector. Usually the names of two or three colors between which the color map is interpolated, using the function colorRampPalette.

ind

Optional integer vector of equal length as x. It indicates the position of the respective value of x on the plate. Can be used to adress the problem of missing values. Each well that is not allocated a value of x by ind will not be plotted.

xrange

Numeric vector of length two giving thwe range of x that is mapped into the color scale. Alternatively, this can be a function which takes the values of x as input and creates such a vector.

na.action

Character. One of "zero" "omit" or "xout". How should the wells for which x is NA be treated? For "zero", they are plotted as if the value were 0. For "omit", they are omitted. For "xout", they are crossed out. When x is a matrix, na.action is only applied to rows containing nothing but NAs. Further special treatment of NA values in matrices need to be implemented in gridFun.

main

Character of length 1. Plot title.

char

An optional character vector of equal length as x (except if argument ind is specified) to be used for well annotation. Each element of the vector may contain a string to be superimposed on the respective well or NA for no plotting.

desc

Character of length 2. Legend for the two extremes of the colorbar, e.g. 'act' and 'inh'.

add

Logical. If TRUE add plate plot to current plot. May be used when plotting in grid layout panels.

gridFun

Character. The name of the plotting function to create individual graphs for each well. See functions .drawCircle and .drawPie

for examples.

funArgs

Dataframe with argument values to be passed to gridCall. For each argument specified in gridCall there must be one column with the argument name as colname and the argument values for every well.

...

Further graphical parameters that can be used to control the output of plotPlate.

cex.main:

expansion factor for title.

cex.lab:

expansion factor for label.

cex.char:

expansion factor for well annotation.

cex.legend:

expansion factor for well legend labels.

cex.desc:

expansion factor for well legend description.

Details

You may use this function either to create plots showing a single-value per well statistic for microtiter plates, or you can use a self-made plotting function using a combination of any valid grid commands to produce arbitrary plots in a plate array format. These plots may also show multifactorial data. Self-defined plotting functions need to have data as first argument. plotPlate passes all data values for the respective well to the plotting function. Any further arguments may be passed on using argument funArgs. See .drawCircle and .drawPie for examples of valid plotting functions and the vignette for detailed information. Note that using funCall overrides some of the default functionalities, e.g. plotting of legends and alters the treatment of NA values.

Argument ind allows the user to indicate the position (well number) for each element of vector x on the plate. This can be used either to change the order in which elements of x are to be plotted or to deal with the problem of missing data for some of the wells on a plate.

To further increase the amount of information of the platePlot one may decorate wells with short annotations using argument char. Each element of char != NA will be superimposed on the respective well (see examples).

Value

The function produces a plot in the active graphics device.

It returns a list withfour elements. The element which is a vector with the indices of those elements in x that were plotted (see argument na.action). The element coord is a length(which) by 4 matrix in which each row specifies the corners of a rectangle that contains a well. It is intended to be used as an argument to a subsequent call to imageMap. Elements width and height may be used to open a graphic devices that can hold the plate plot with the correct aspect ratio.

Author(s)

Florian Hahne, Wolfgang Huber http://www.ebi.ac.uk/huber

See Also

imageMap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotPlate(runif(96), main="example 1", col=c("#0000e0", "#e00000"), desc=c("act", "inh"))
plotPlate(runif(384), nrow=16, ncol=24, main="example 2", col=c("#0000e0", "white", "#e00000"))
plotPlate(runif(48), main="example 3", col=c("#0000e0", "#e00000"), ind=c(1:24, 73:96))
x <- runif(96)
x[sample(96, 10)] <- NA
plotPlate(x, main="example 4", col=c("#0000e0", "#e00000"),
char=c(rep(NA, 72), LETTERS[1:24]), na.action="xout")
plotPlate(runif(96, min=0.1, max=0.5), gridFun=".drawCircle")
plotPlate(matrix(runif(288), ncol=3), gridFun=".drawPie",
funArgs=as.data.frame(matrix(2:4, ncol=3, nrow=96, byrow=TRUE)))
 

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: RColorBrewer
Loading required package: grid
Loading required package: rrcov
Loading required package: robustbase

Attaching package: 'robustbase'

The following object is masked from 'package:Biobase':

    rowMedians

Scalable Robust Estimators with High Breakdown Point (version 1.4-3)

prada documentation built on April 28, 2020, 7:52 p.m.