calcCM: Calculate a binned correlation matrix

Description Usage Arguments Details Value Note References See Also Examples

Description

Calculate the bin-wise averages of the correlations between rows of a matrix. This may be useful for visualizing gross trends in the correlation matrix.

Usage

1
2
3
calcCM(x, n = 50, 
       use = 'all', method = 'pearson', 
       FUN = median, ...) 

Arguments

x

A matrix, or an exprSet.

n

Number of bins.

use, method

Passed directly to cor.

FUN

Function to summarize values in each bin.

...

Additional argments are passed to FUN.

Details

The rows of the input matrix x are split into n bins. For each possible pair of bins, all possible correlation coefficients between rows in the two bins are calculated. The median (or other FUN) correlation for each pair of bins is returned as a matrix.

For the diagonals of the returned matrix, which correspond to the correlation between a bin and itself, only the correlations between non-identical probe sets are included.

Value

A list with the following components:

x, y

Numeric vectors of length n + 1; the breakpoints defining the bins. x and y are equivalent; both are included so the result can be passed directly to plotting functions.

z

n x n numeric matrix; the median (or other FUN) correlation for each bin.

count

n x n numeric matrix; the number of observations in each bin.

call

Character; the function call.

Note

The results will be more informative if the input matrix x is sorted by some criterion first. For example, try sorting by (row-wise) mean, variance, probe sequence composition...

References

Eklund, A.C. and Szallasi, Z. (2008) Correction of technical bias in clinical microarray data improves concordance with known biological information. Genome Biology, 9:R26.

See Also

colorgram in the in the squash package for visualization

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  library(affydata)
  data(Dilution)
  d <- exprs(rma(Dilution))

  ## Sort the rows (probe sets) by mean expression, and calculate correlation matrix
  dsort <- d[order(rowMeans(d)),]
  cm <- calcCM(dsort)
  
  ## Visualize the correlation matrix
  image(cm, col = rainbow(20),
    xlab = 'Expression rank', ylab = 'Expression rank')
  
  ## Maybe use the "squash" package for more control of the plot
  ## Not run: 
  par(mar = c(7, 4, 4, 1) + 0.1)
  map <- makecmap(cm$z, colFn = blueorange, 
            symm = TRUE, n = 20)
  colorgram(cm, map = map, 
        xlab = 'Expression rank', 
        ylab = 'Expression rank',
        zlab = 'Median Pearson correlation')
  
## End(Not run)

aroneklund/bias documentation built on May 10, 2019, 1:46 p.m.