eigencorplot: Correlate principal components to continuous variable...

Description Usage Arguments Details Value Author(s) Examples

View source: R/eigencorplot.R

Description

Correlate principal components to continuous variable metadata and test significancies of these.

Usage

 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
39
40
41
42
43
44
eigencorplot(
  pcaobj,
  components = getComponents(pcaobj, seq_len(10)),
  metavars,
  titleX = "",
  cexTitleX = 1,
  rotTitleX = 0,
  colTitleX = "black",
  fontTitleX = 2,
  titleY = "",
  cexTitleY = 1,
  rotTitleY = 0,
  colTitleY = "black",
  fontTitleY = 2,
  cexLabX = 1,
  rotLabX = 0,
  colLabX = "black",
  fontLabX = 2,
  cexLabY = 1,
  rotLabY = 0,
  colLabY = "black",
  fontLabY = 2,
  posLab = "bottomleft",
  col = c("blue4", "blue3", "blue2", "blue1", "white", "red1", "red2", "red3", "red4"),
  posColKey = "right",
  cexLabColKey = 1,
  cexCorval = 1,
  colCorval = "black",
  fontCorval = 1,
  scale = TRUE,
  main = "",
  cexMain = 2,
  rotMain = 0,
  colMain = "black",
  fontMain = 2,
  corFUN = "pearson",
  corUSE = "pairwise.complete.obs",
  corMultipleTestCorrection = "none",
  signifSymbols = c("***", "**", "*", ""),
  signifCutpoints = c(0, 0.001, 0.01, 0.05, 1),
  colFrame = "white",
  plotRsquared = FALSE,
  returnPlot = TRUE
)

Arguments

pcaobj

Object of class 'pca' created by pca().

components

The principal components to be included in the plot.

metavars

A vector of column names in metadata representing continuos variables.

titleX

X-axis title.

cexTitleX

X-axis title cex.

rotTitleX

X-axis title rotation in degrees.

colTitleX

X-axis title colour.

fontTitleX

X-axis title font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

titleY

Y-axis title.

cexTitleY

Y-axis title cex.

rotTitleY

Y-axis title rotation in degrees.

colTitleY

Y-axis title colour.

fontTitleY

Y-axis title font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

cexLabX

X-axis labels cex.

rotLabX

X-axis labels rotation in degrees.

colLabX

X-axis labels colour.

fontLabX

X-axis labels font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

cexLabY

Y-axis labels cex.

rotLabY

Y-axis labels rotation in degrees.

colLabY

Y-axis labels colour.

fontLabY

Y-axis labels font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

posLab

Positioning of the X- and Y-axis labels. 'bottomleft', bottom and left; 'topright', top and right; 'all', bottom / top and left /right; 'none', no labels.

col

Colour shade gradient for RColorBrewer.

posColKey

Position of colour key. 'bottom', 'left', 'top', 'right'.

cexLabColKey

Colour key labels cex.

cexCorval

Correlation values cex.

colCorval

Correlation values colour.

fontCorval

Correlation values font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

scale

Logical, indicating whether or not to scale the colour range to max and min cor values.

main

Plot title.

cexMain

Plot title cex.

rotMain

Plot title rotation in degrees.

colMain

Plot title colour.

fontMain

Plot title font style. 1, plain; 2, bold; 3, italic; 4, bold-italic.

corFUN

Correlation method: 'pearson', 'spearman', or 'kendall'.

corUSE

Method for handling missing values (see documentation for cor function via ?cor). 'everything', 'all.obs', 'complete.obs', 'na.or.complete', or 'pairwise.complete.obs'.

corMultipleTestCorrection

Multiple testing p-value adjustment method. Any method from stats::p.adjust() can be used. Activating this function means that signifSymbols and signifCutpoints then relate to adjusted (not nominal) p-values.

signifSymbols

Statistical significance symbols to display beside correlation values.

signifCutpoints

Cut-points for statistical significance.

colFrame

Frame colour.

plotRsquared

Logical, indicating whether or not to plot R-squared values.

returnPlot

Logical, indicating whether or not to return the plot object.

Details

Correlate principal components to continuous variable metadata and test significancies of these.

Value

A lattice object.

Author(s)

Kevin Blighe <kevin@clinicalbioinformatics.co.uk>

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
  options(scipen=10)
  options(digits=6)

  col <- 20
  row <- 20000
  mat1 <- matrix(
    rexp(col*row, rate = 0.1),
    ncol = col)
  rownames(mat1) <- paste0('gene', 1:nrow(mat1))
  colnames(mat1) <- paste0('sample', 1:ncol(mat1))

  mat2 <- matrix(
    rexp(col*row, rate = 0.1),
    ncol = col)
  rownames(mat2) <- paste0('gene', 1:nrow(mat2))
  colnames(mat2) <- paste0('sample', (ncol(mat1)+1):(ncol(mat1)+ncol(mat2)))

  mat <- cbind(mat1, mat2)

  metadata <- data.frame(row.names = colnames(mat))
  metadata$Group <- rep(NA, ncol(mat))
  metadata$Group[seq(1,40,2)] <- 'A'
  metadata$Group[seq(2,40,2)] <- 'B'
  metadata$CRP <- sample.int(100, size=ncol(mat), replace=TRUE)
  metadata$ESR <- sample.int(100, size=ncol(mat), replace=TRUE)

  p <- pca(mat, metadata = metadata, removeVar = 0.1)

  eigencorplot(p, components = getComponents(p, 1:10),
    metavars = c('ESR', 'CRP'))

PCAtools documentation built on Nov. 8, 2020, 8:17 p.m.