## Analyze the current MAExplorer array data using PCA creating # PDF and .out files. # Authors: P. Lemkin, S. Sundaram # $Date: 6-14-2003$ $Revision: 1.1$ # # The input file contains the format as genes(rows) x experiments(columns). oclData <- oclTbl$hData condNames <- oclTbl$condNames allCondNames <- oclTbl$allCondNames sampleNames <- oclTbl$sampleNames nConds <- oclTbl$nConds nGenes <- oclTbl$nGenes isVertStacked <- oclTbl$isVertStacked paste("The Ordered Condition List has ",nGenes," genes") paste("The Ordered Condition List has ",nConds," conditions") paste("The Ordered Condition List has ",length(sampleNames)," samples") # -- [1] Compute the PCA both for Arrays and for Genes print("Computing the PCA of the current MAExplorer data by 'arrays'") maePCAarrays <- mae.simplePCAanalysis(data=oclData,plotFile="simplePCAarrays.pdf", mode="arrays", scale.data=TRUE, uniqGroups=allCondNames,group=condNames) # -- [1.1] Write out the data into files cat("Number of Eigen Vectors=",maePCAarrays$nEigenVecs,"\n") summary(maePCAarrays) summary(maePCAarrays$pca) mae.writeEigenData(maePCAarrays$pca, eigenValFile="EigenValuesArrays.out", eigenVecsFile="EigenVectorsArrays.out", points3Dfile="Points3DArrays.out") # --- [1.2] Now do 3D plot of the Array data and of Genes data PC1, PC2, PC3 p3Da <- read.table("Points3DArrays.out", header=TRUE) colnames(p3Da) <- c("PC1","PC2","PC3") # Do 3D plots of loadings of samples pdf("points3Darray.pdf", encoding="ISOLatin1",width=6,height=6) mae.colorBased3dPlotting(allCondNames[-1],condNames,p3Da, xindex=1,yindex=2,zindex=3, xlabel="PC1", ylabel="PC2", zlabel="PC3", mainTitle="3D plot of PC1 vs PC2 vs PC3 of Arrays") ### [TODO] Add legend dev.off() # -- [2] Compute the PCA both for Arrays and for Genes print("Computing the PCA of the current MAExplorer data by 'genes'") maePCAgenes <- mae.simplePCAanalysis(data=oclData,plotFile="simplePCAgenes.pdf", mode="genes", scale.data=TRUE, uniqGroups=allCondNames,group=condNames) # -- [2.1] Write out the data into files cat("Number of Eigen Vectors=",maePCAgenes $nEigenVecs,"\n") summary(maePCAgenes) summary(maePCAgenes$pca) mae.writeEigenData(maePCAgenes$pca, eigenValFile="EigenValuesGenes.out", eigenVecsFile="EigenVectorsGenes.out", points3Dfile="Points3DGenes.out")