Last data update: 2014.03.03

R: Scatter plot of 3 specified principal components
pca3DPlotR Documentation

Scatter plot of 3 specified principal components

Description

Scatter plot of 3 specified principal components.

Usage

pca3DPlot(pcaObj, 
          plot.dim = c(1,2, 3),
          labelVariable = "subjID", 
           hybName = "Hybridization_Name",
          outFileName = "test_pca_raw.pdf", 
          title = "Scatter plot of pcas", 
          plotOutPutFlag = FALSE, 
          mar = c(5, 4, 4, 2) + 0.1, 
          lwd = 1.5, 
          equalRange = TRUE, 
          xlab = NULL, 
          ylab = NULL, 
          zlab = NULL, 
          xlim = NULL, 
          ylim = NULL, 
          zlim = NULL, 
          cex.legend = 1.5, 
          cex = 1.5, 
          cex.lab = 1.5, 
          cex.axis = 1.5, 
          legendPosition = "topright", 
          ...)

Arguments

pcaObj

An object returned by the function pca of the R package pcaMethods.

plot.dim

A vector of 3 positive-integer-value integer specifying which 3 pcas will be plot.

labelVariable

The name of a column of the phenotype data matrix. The elements of the column will replace the column names of the expression data matrix.

hybName

character string. indicating the phenotype variable Hybridization_Name.

outFileName

Name of the figure file to be created.

title

Title of the scatter plot.

plotOutPutFlag

logical. plotOutPutFlag=TRUE indicates the plots will be output to pdf format files. Otherwise, the plots will not be output to external files.

mar

A numerical vector of the form 'c(bottom, left, top, right)' which gives the number of lines of margin to be specified on the four sides of the plot. The default is 'c(5, 4, 4, 2) + 0.1'. see par.

lwd

The line width, a _positive_ number, defaulting to '1'. see par.

equalRange

logical. Indicating if the x-axis and y-axis have the same range.

xlab

Label of x axis.

ylab

Label of y axis.

zlab

Label of z axis.

xlim

Range of x axis.

ylim

Range of y axis.

zlim

Range of z axis.

cex.legend

Font size for legend.

cex

numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. see par.

cex.lab

The magnification to be used for x and y labels relative to the current setting of cex.

cex.axis

The magnification to be used for axis annotation relative to the current setting of cex.

see par.

legendPosition

Position of legend. Possible values are “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right” and “center”.

...

Arguments to be passed to plot.

Value

A matrix of PCA scores. Each column corresponds to a principal component.

Author(s)

Weiliang Qiu <stwxq@channing.harvard.edu>, Brandon Guo <brandowonder@gmail.com>, Christopher Anderson <christopheranderson84@gmail.com>, Barbara Klanderman <BKLANDERMAN@partners.org>, Vincent Carey <stvjc@channing.harvard.edu>, Benjamin Raby <rebar@channing.harvard.edu>

Examples

    # generate simulated data set from conditional normal distribution
    set.seed(1234567)
    es.sim = genSimData.BayesNormal(nCpGs = 100, 
      nCases = 20, nControls = 20,
      mu.n = -2, mu.c = 2,
      d0 = 20, s02 = 0.64, s02.c = 1.5, testPara = "var",
      outlierFlag = FALSE, 
      eps = 1.0e-3, applier = lapply) 
    print(es.sim)

    pca.obj = getPCAFunc(es = es.sim, 
                     labelVariable = "subjID", 
                     hybName = "memSubj",
                     requireLog2 = FALSE,
                     corFlag = FALSE
)


pca3DPlot(pcaObj = pca.obj, 
          plot.dim = c(1,2,3),
          labelVariable = "subjID", 
          hybName = "memSubj",
          plotOutPutFlag = FALSE, 
          cex.legend = 0.5, 
          legendPosition = "topright") 
    

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(iCheck)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: lumi
Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)
Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:stats':

    lowess

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/iCheck/pca3DPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: pca3DPlot
> ### Title: Scatter plot of 3 specified principal components
> ### Aliases: pca3DPlot
> ### Keywords: methods
> 
> ### ** Examples
> 
>     # generate simulated data set from conditional normal distribution
>     set.seed(1234567)
>     es.sim = genSimData.BayesNormal(nCpGs = 100, 
+       nCases = 20, nControls = 20,
+       mu.n = -2, mu.c = 2,
+       d0 = 20, s02 = 0.64, s02.c = 1.5, testPara = "var",
+       outlierFlag = FALSE, 
+       eps = 1.0e-3, applier = lapply) 
>     print(es.sim)
ExpressionSet (storageMode: lockedEnvironment)
assayData: 100 features, 40 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: subj1 subj2 ... subj40 (40 total)
  varLabels: arrayID memSubj
  varMetadata: labelDescription
featureData
  featureNames: probe1 probe2 ... probe100 (100 total)
  fvarLabels: probe gene chr memGenes
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation:  
> 
>     pca.obj = getPCAFunc(es = es.sim, 
+                      labelVariable = "subjID", 
+                      hybName = "memSubj",
+                      requireLog2 = FALSE,
+                      corFlag = FALSE
+ )
Warning message:
In prcomp.default(t(dat2), cor = corFlag) :
 extra argument 'cor' will be disregarded 
> 
> 
> pca3DPlot(pcaObj = pca.obj, 
+           plot.dim = c(1,2,3),
+           labelVariable = "subjID", 
+           hybName = "memSubj",
+           plotOutPutFlag = FALSE, 
+           cex.legend = 0.5, 
+           legendPosition = "topright") 
>     
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>