The R code given in the file Supplementary_AlignmentFunctions.txt is for the alignment of preprocessed LC/MS spectra. R is freely available statistical software, downloadable from http://cran.r-project.org/ To use the R code in Supplementary_AlignmentFunctions.txt install R on your computer and follow the instructions given below. ####################################################################### #### #### #### workflow for the complete rentention-time alignment procedure #### #### #### ####################################################################### 1. load LC/MS data The preprocessed (peak-picked) data from all LC/MS runs has to be combined to one 'map'. This map has to be loaded into your R workspace as a matrix called "data" with columnnames "RT", "MZ", "Intens", and "Sample". Further columnns are possible but not necessary. - "RT" contains retention time of a peak - "MZ" contains mass-to-charge value of a peak - "Intens" contains intensity of a peak - "Sample" indicates from which LC/MS run the measurement originates. Should be numbers from 1 to n, with n being the number of LC/MS runs. 2. set parameters for alignment functions h = 1/2 * expected mass accuracy (in ppm) of mass spectrometer diff.rt = expected maximal retention-time difference (in minutes) between LC/MS runs nmiss = default should be about 1/3 * n; higher values will result in more 'well-behaved' clusters ndup = default should be 0; higher values will result in more 'well-behaved' clusters al.type = "global" to use linear regression, "local" to use loess regression method = default should be "BIC" ; type of model selection criterion for span selection, i.e., "AIC", "BIC", ... width = default should be 20; can be increased for less complex LC/MS samples max.obs = default should be 400, but can be increased if not enough 'well-behaved' clusters are found over = should be set to 1 (Da) path = path to use for saving results in (within quotation marks); Note that R needs a double backslash "\\" for each backslash "\" Further information on the parameters and their usage within the functions can be found directly in the R code. 3. copy the functions from Supplementary_AlignmentFunctions.txt into the R workspace 4. alignment The alignment can be obtained through the following code (to be typed into the R workspace): data.sort <- data[order(data$MZ),] list.good.data <- good.group.all2(data.sort,width=width,over=over,max.obs=max.obs,nmiss=nmiss,ndup=ndup,h=h,diff.rt=diff.rt) if (al.type=="local") { rtdev.data <- comp.RTcor(list.good.data,data=simu.data, method=method) pdf(paste(path,"RTcurves.pdf",sep="")) plot.rtdev(rtdev.data$rtdev, spans=rtdev.data$opt.span) dev.off() } if (al.type=="global") { rtdev.data <- comp.RTcor.global(list.good.data,data=data.sort) pdf(paste(path,"RTcurves.pdf",sep="")) plot.rtdev.global(rtdev.data$rtdev) dev.off() } data.sort <- cbind(data.sort,"RTcorrected"=rtdev.data$RTcor) data.cor <- data.sort[order(data.sort$Sample),] write.table(data.cor,file=paste(path,"correctedDataset.txt",sep=""),sep="\t",quote=FALSE) 5. results The alignment results are saved as a .txt file where the corrected retention times are given in the last column. Pictures of the derived alignment curves are given in the .pdf file. Katharina Podwojski; 14:59 07.10.2008