ASCA-genes ######################################################################################################### Developers : MJosé Nueda (mj.nueda@ua.es) and Ana Conesa (aconesa@ivia.es) 18 February 2007 ######################################################################################################### ASCA-genes is an adaptation of the ASCA method develop by Smilde and co-owrkers to the analysis of multifactorial experiments in transcriptomics. ASCA-genes have been implemented for designed experiments comprising either two (ASCA.2f) or three (ASCA.3f) experimental factors. The steps to follow to apply ASCA are the following: (1) Create desing matrices. These are dataframes containing the assignment of each experimental element (arrays) to experimental conditions and factors. There should be a separate experimental design for each experimental factor. In columns the labels of the experimental factor is given and rows correspond to the different arrays. The assingment of a array to a experimental condition is given by a binary code: 1 is yes, 0 is no. Examples: Time1 Time2 Arrary1 1 0 Array2 1 0 Array3 0 1 Array4 0 1 In ASCA.2f twoo exprerimental design matrices are required: one for the time factor and other for the second experimental factor (e.g. treatmnet) In ASCA.3f three experimental design matrices are required: one for the time factor, one for the second experimental factor (eg. treatment), one for the third experimental factor (e.g. strain), the last one for the individuals (2) Load ASCA-genes functions and the mentiones data frames in a R session (3) Execute either ASCA.2f or ASCA.3f functions Arguments for these functions are: X: Data matrix. Genes should be in rows and conditions in columns Design matrices for each experimetnal group. See ASCA.2f and ASCA.3f for details Fac. Numbers of components to extract in each submodel. See ASCA.2f and ASCA.3f for details Type. Vector indicating whether the analyses of the model of the factors that interact with time (b.ab and c.ac) are studied jointly(1) or separately(2). See ASCA.2f and ASCA.3f for details (4)Values The resulting R object contains as many slots as computed moldels. For each model the following values are given: data : Data matrix used for PCA on that factor, corresponds to the estimated effects for each level of the factor scores: corresponding to the PCA of that factor loadings: corresponding to the PCA of that factor var.exp: exaplined varaibility for each component in the PCA o that factor X: the data matrix associated to each model TP: the reconstructed data matrix corresponding that factor E: residuales for the PCA model of that factor leverage: gene leverages for the computed PCA model SPE: gene SPEs for the computed PCA model Aditionally the variability explained by each experimental factor is displayed on the console. Additional, screeplots for the different models are given, so number of selected PCs for each model can be reconsidered and the analysis can be re-run (5) An example for ASCA-genes execution is given in the R session present in this zip. The code for execution is: > source("ASCA2f.R") > source("ASCA3f.R") > source("ASCAfun1.R") > source("ASCAfun2.R") > source("ASCAfun3.R") > source("ASCAfun12.R") > source("ASCAfun-triple.R") > source("GPCA-GENES.R") > source("sceeplot.R") > source("show.var.R") > source("spe.lims.R") > source("leverage.lims.R") > my.asca <- ASCA.3f (X=t(data.example), Designa=Designa,Designb=Designb,Designc=Designc,Fac=c(1,2,2,2,2,2,2,2),type=c(1,1,2)) (6) Find cutoff values for SPE and leverage There are 2 functions to calculate cutoff values for SPE to select genes. (6.1) SPE limits > SPE.cutoff <- SPE.lims(my.asca, alpha=0.01) (6.2) Leverage limits (appropiate alpha values depends on the data variability, check on a leverage/SPE plots the suitability of cutoff values) > leverage.cutoff <- leverage.lims(data=data.example, R=3, ASCA.3f, Designa=Designa,Designb=Designb,Designc=Designc,Fac=c(1,2,2,2,2,2,2,2),type=c(1,1,2), alpha=0.95, showvar=FALSE, showscree=FALSE) (7) Visualize SPE vs leverage plots > plot(my.asca$Model.a$leverage, my.asca$Model.a$SPE, main="Model.a") > abline(v=leverage.cutoff$Cutoff["Model.a"], col="red") > abline(h=SPE.cutoff$Model.a, col="red")