Last data update: 2014.03.03

R: Plot principle component analysis for gene expression data.
PCAPlotR Documentation

Plot principle component analysis for gene expression data.

Description

PCAPlot generates principle component plots for with the possibility to color arrays according to a known factor.

Usage

PCAPlot(Y, comp = c(1, 2), anno = NULL, Factor = NULL, numeric = FALSE,
  new.legend = NULL, title)

Arguments

Y

A matrix of gene expression values or an object of class prcomp.

comp

A vector of length 2 specifying which principle components to be used.

anno

A dataframe or a matrix containing the annotation of the arrays.

Factor

A character string describing the column name of anno used for coloring.

numeric

A logical scalar indicating whether Factor is numerical.

new.legend

A vector describing the names used for labelling; if NULL labels in Factor are used.

title

A character string giving the title.

Value

PCAPlot returns a plot.

Author(s)

Saskia Freytag

See Also

prcomp

Examples

Y<-simulateGEdata(500, 500, 10, 2, 5, g=NULL, Sigma.eps=0.1,
250, 100, intercept=FALSE, check.input=FALSE)
PCAPlot(Y$Y, title="")

## Create random annotation file
anno<-as.matrix(sample(1:4, dim(Y$Y)[1], replace=TRUE))
colnames(anno)<-"Factor"
try(dev.off(), silent=TRUE)
par(mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0, mfrow=c(1, 1))
PCAPlot(Y$Y, anno=anno, Factor="Factor", numeric=TRUE, title="")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RUVcorr)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/RUVcorr/PCAPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PCAPlot
> ### Title: Plot principle component analysis for gene expression data.
> ### Aliases: PCAPlot
> 
> ### ** Examples
> 
> Y<-simulateGEdata(500, 500, 10, 2, 5, g=NULL, Sigma.eps=0.1,
+ 250, 100, intercept=FALSE, check.input=FALSE)
> PCAPlot(Y$Y, title="")
[1] "Calculation of principle components finished. Start plotting..."
> 
> ## Create random annotation file
> anno<-as.matrix(sample(1:4, dim(Y$Y)[1], replace=TRUE))
> colnames(anno)<-"Factor"
> try(dev.off(), silent=TRUE)
null device 
          1 
> par(mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0, mfrow=c(1, 1))
> PCAPlot(Y$Y, anno=anno, Factor="Factor", numeric=TRUE, title="")
[1] "Calculation of principle components finished. Start plotting..."
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>