pcaFun: Create a Principal Component Analysis (PCA) plot

View source: R/functions_imagesQC.R

pcaFunR Documentation

Create a Principal Component Analysis (PCA) plot

Description

This function (from functions_imagesQC.R) creates a Principal Component Analysis (PCA) plot of the arrays in the raw or normalized dataset (depending on the object passed). When the dataset consists of less than three arrays, no PCA plot is generated and a warning is given. Before computing the PCA each probeset’s expression values are centred on zero. If scaled_pca is TRUE, they will also be rescaled to unit variance. When the maximum length of an array (sample)name is ten characters, and there are no more than 16 samples, the array (sample)names are put within the plot, otherwise they are put in the legend. Since computing a PCA (using the prcomp function) can be memory intensive, a try is used. Furthermore, in cases where scaling is not possible due to loss of any variation, a second attempt is done using no scaling (when scaled_pca had been set to TRUE), and a warning is given. When no PCA can be computed the image is not created, and a warning is given.

Usage

pcaFun(
  Data,
  experimentFactor = NULL,
  normMeth = "",
  scaled_pca = TRUE,
  plotColors = NULL,
  legendColors = NULL,
  plotSymbols = NULL,
  legendSymbols = NULL,
  namesInPlot = FALSE,
  WIDTH = 1000,
  HEIGHT = 1414,
  POINTSIZE = 24
)

Arguments

Data

(Status: required) The raw data object (datatype: AffyBatch)

experimentFactor

(Status: required, Default:NULL) The factor of groups. (datatype: factor)

normMeth

(Status: required when Data is a normalized data object, Default:"") String indicating the normalization method used (see normalizeData function for more information on the possible values). (datatype: character)

scaled_pca

(Status: optional, Default:TRUE) Should each probeset’s expression be scaled to unit variance before proceeding? Note that the expression is centred on zero in any case. (datatype: logical)

plotColors

(Status: required, Default:NULL) Vector of colors assigned to each array. (datatype: character)

legendColors

(Status: required, Default:NULL) Vector of colors assigned to each experimental group. (datatype: character)

plotSymbols

(Status: required, Default:NULL) symbol assigned to each array. (datatype: number)

legendSymbols

(Status: required, Default:NULL) symbol assigned to each experimental group. (datatype: number)

namesInPlot

(Status: optional, Default:FALSE) Should the array (sample)names be put within the plot, or in the legend? (datatype: logical)

WIDTH

(Status: optional, Default:1000) png image width (datatype: number)

HEIGHT

(Status: optional, Default:1414) png image height (datatype: number)

POINTSIZE

(Status: optional, Default:24) png image point size (datatype: number)

Value

A PNG image with PCA plot of the arrays. Naming is either ‘Raw’ or the normalization method, followed by "DataPCAanalysis"

Examples

# By default, before the normalization the script will call:
# pcaFun(Data=rawData, experimentFactor=experimentFactor,
# plotColors=plotColors, legendColors=legendColors,
# namesInPlot=((max(nchar(sampleNames(rawData)))<=10)&&
#  (length(sampleNames(rawData))<=16))
# and after normalization:
# pcaFun(Data=normData, experimentFactor=experimentFactor,
# normMeth=normMeth, plotColors=plotColors,
# legendColors=legendColors,
# namesInPlot=((max(nchar(sampleNames(rawData)))<=10)&&
#  (length(sampleNames(rawData))<=16))

ammar257ammar/ArrayAnalysis-Bioconductor documentation built on Jan. 29, 2024, 7:21 a.m.