# Plot correlation of random pairs of genes

### Description

`plot.corr.sample`

provides the main functionality of package `maCorrPlot`

: it plots the correlation of random pairs of genes against their variability. Systematic deviations of the plot from a constant zero indicate lack of normalization of the underlying expression matrix.

Formally, `plot.corr.sample`

is the plotting method for objects of class `corr.sample`

generated by `CorrSample`

.

`panel.corr.sample`

is the panel function that does the actual plotting work.

### Usage

1 2 3 4 5 6 7 | ```
plot.corr.sample(x, ..., cond, groups, grid = TRUE, refline = TRUE, xlog = TRUE,
scatter = FALSE, curve = FALSE, ci = TRUE, nint = 10,
alpha=0.95, length = 0.1, xlab="Standard Deviation")
panel.corr.sample(x, y, grid = TRUE, refline = TRUE, xlog = TRUE,
scatter = FALSE, curve = FALSE, ci = TRUE, nint = 10,
alpha=0.95, length = 0.1, col.line, col.symbol, ...)
``` |

### Arguments

`x, y` |
for |

`...` |
either more objects of class |

`cond` |
either a vector or a list of vectors describing multiple objects of class |

`groups` |
a vector or a list of vectors giving group membership for the random pairs of genes in the |

`grid` |
logical value indicating whether to draw a reference grid |

`refline` |
logical value indicaitng whether to draw a horizontal reference line a zero. |

`xlog` |
logical value indicating whether to use log-scale on the horizontal axis. |

`scatter` |
logical value indicaitng whether the plot the individual pairwise correlations. |

`curve` |
logical value indicating whether to fit a simple model for lack of fit to the correlations. |

`ci` |
logical value indicating whether to add confidence intervals. |

`nint` |
number of intervals into which to divide the horizontal axis for calculating average correlations. |

`alpha` |
the level of confidence to be plotted. |

`length` |
the length of the horizontal ticks indicating the ends of the confidence intervals (in inches). |

`xlab` |
the label for the horizontal axis. |

`col.line, col.symbol` |
graphical parameters that control the color of the correlation lines and the scatter plotting symbols |

### Details

The underlying plotting engine is `xyplot`

, using `panel.corr.sample`

as panel function, which also interprets most of the graphical parameters. Note that two kinds of arguments can be specified via `...`

: First, an unlimited number of extra `corr.sample`

objects, in case we want to display different expression measures for the same expression matrix, or compare different expression matrices, or both; this is somewhat similar to the behaviour of `boxplot.default`

. Second, everything that does not inherit from `corr.sample`

is passed on to `xyplot`

, so in theory, the full range of lattice control options is available, as long as they do not conflixt with named arguments to `plot.corr.sample`

, like `xlog`

or `xlab`

.

Two mechanisms for comparisons within the same plot are available: First, as mentioned above, multiple `corr.sample`

objects can be shown in the same graph, each within its own panel. If no `cond`

is specified, these panels are just numbered in the order in which the objects appear in the arguments. Alternatively, one or two factors can be associated with each factor: in the first case, `cond`

is just a vector with as many entries as `corr.sample`

objects in the argument list; these entries are used to label the panels of the corresponding `corr.sample`

objects. In the second case, `cond`

is a list with two such vectors, and the objects are cross-classified according to both categories, and the panels are arranged in a row-column pattern reflecting this cross-classification, see Examples.

The other mechanism for graphical comparisons within the same plot is via `groups`

, which draws different correlation curves for different sub-groups of pairs of genes; the standard example is to classify pairs of genes according to their common or average score in regard to a quality control measure like the MAS5 presence calls, see Examples. These sub-groups are specified via `groups`

; if there is only one `corr.sample`

object in the function call (`x`

), `groups`

is just a vector with as many entries as there are random paris of genes in `x`

. If several objects of class `corr.sample`

have been specified in the function call, `groups`

is a list of as many vectors as objects, where each vector has as many entries as the corresponding object has pairs of genes.

### Value

A plot created by `xyplot`

.

### Warning

`cond`

is translated into conditioning variables for `xyplot`

, which will not hesitate to average correlations across different `corr.sample`

objects. It's hard to see when this would be a good idea, therefore `plot.corr.sample`

will generate a warning.

### Author(s)

Alexander Ploner Alexander.Ploner@ki.se

### References

Ploner A, Miller LD, Hall P, Bergh J, Pawitan Y. Correlation test to assess low-level processing of high-density oligonucleotide microarray data. BMC Bioinformatics, 2005, 6(1):80 http://www.pubmedcentral.gov/articlerender.fcgi?tool=pubmed&pubmedid=15799785

### See Also

`CorrSample`

, `xyplot`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ```
# Get small example data
data(oligodata)
dim(datA.rma)
dim(datB.rma)
# Compute the correlations for 500 random pairs,
# Larger numbers are reasonable for larger data sets
cs1.rma = CorrSample(datA.rma, 500, seed=210)
plot(cs1.rma)
# Change the plot
plot(cs1.rma, scatter=TRUE, curve=TRUE, alpha=0.99)
# Compare with MAS5 values for the same data set
cs1.mas5 = CorrSample(datA.mas5, 500, seed=210)
plot(cs1.rma, cs1.mas5, cond=c("RMA","MAS5"))
# We group pairs of gene by their average number of MAS5 present calls
pcntA = rowSums(datA.amp[cs1.mas5$ndx1, ]=="P") +
rowSums(datA.amp[cs1.mas5$ndx2, ]=="P")
hist(pcntA)
pgrpA = cut(pcntA, c(0, 20, 40, 60), include.lowest=TRUE)
table(pgrpA)
# Plot the RMA values according to their MAS5 status
# The artificial correlation is due to gene pairs with few present calls
plot(cs1.rma, groups=pgrpA, nint=5, auto.key=TRUE, ylim=c(-0.3, 0.5))
# Combine grouping and multiple conditions
plot(cs1.rma, cs1.mas5, cond=c("RMA","MAS5"), groups=list(pgrpA, pgrpA),
nint=5, auto.key=TRUE, ylim=c(-0.3, 0.5))
# Compare with second data set
# Specify more than one condition
cs2.rma = CorrSample(datB.rma, 500, seed=391)
cs2.mas5 = CorrSample(datB.mas5, 500, seed=391)
plot(cs1.rma, cs1.mas5, cs2.rma, cs2.mas5,
cond=list(c("RMA","MAS5","RMA","MAS5"), c("A","A","B","B")))
``` |