makePCA: 3D Plot with Principal Component Analysis (PCA)

Description Usage Arguments Details Value

View source: R/makePCA.R


This function performs a principal component analysis with the prcomp function and uses the prcomp class object to plot the three first principal components.


makePCA(est_noctrls, picname, conditions = NULL, colors = NULL, dist = 2, resDir = NULL)



Numeric matrix where columns are samples and rows genes. est_noctrls corresponds to a matrix without controls.


Character with the output file name.


Optional. Vector with sample conditions to colour sample names in the plot. conditions vector has to have the same order as the order of samples in the columns of the input expression matrix. IMPORTANT Sample columns in the expression matrix and sample conditions have to be in order mixedsort(labels).


Optional. Vector with colors corresponding to each sample in mixedsort(samplename) order. If this parameter is not defined, default colors will be used.


Distance where the name of the sample is located with respect to the corresponing point in the plot. Optimal distance is different deppending on the sample number and PC distances. Default is 2.


Output results directory. Default is ResultsDir.


The first three principal components obtained with the prcomp function capture part of the variability explaining the sample distribution. Each PC is represented in an axis of the plot, x.axis=PC1, y.axis=PC2 and z.axis=PC3. This plot is useful to check the overall similarity among samples. Column names in the expression matrix are used as sample names.


Output is a .png file with the results in resDir.

machalen/QualityGraphs documentation built on Oct. 22, 2019, 8:29 p.m.