Mercurial > repos > cs76 > isotopologue_parameter_optimization
view ipo.R @ 5:16b69e94e08e draft default tip
Uploaded
author | cs76 |
---|---|
date | Mon, 07 Dec 2015 06:27:48 -0500 |
parents | c403de9adce7 |
children |
line wrap: on
line source
args<-commandArgs(TRUE) workingDirectory<-args[3] logFile<-paste(workingDirectory,'/run.log', sep='') graphsDirectory<-paste(workingDirectory,'/graphs', sep='') outputCSV<-paste(workingDirectory,'/IPO_PP.csv', sep='') dir.create(workingDirectory) zz <- file(logFile, open="wt") sink(zz) sink(zz, type="message") library("xtable") library(IPO) #print(args) peakpickingParameters <- getDefaultXcmsSetStartingParams('centWave') #setting levels for min_peakwidth to 10 and 20 (hence 15 is the center point) peakpickingParameters$min_peakwidth <- c(10,20) peakpickingParameters$max_peakwidth <- c(26,42) #setting only one value for ppm therefore this parameter is not optimized peakpickingParameters$ppm <- 20 peakpickingParameters$nSlaves <- 4 # as.numeric(args[3]) type <- "centWave" resultPP <- optimizeXcmsSet(files=args[1], params=peakpickingParameters, nSlaves=4, subdir=graphsDirectory) print (resultPP) graphs<-"" for(i in 1:(length(resultPP)-1)) { graphs<-paste(graphs,"<img width='100%' src='graphs/rsm_", i ,".jpg'><hr>",sep='') } list <- c(resultPP$best_settings$parameters, as.list(resultPP$best_settings$result), list(type=type)) table <- print(xtable(t(data.frame(list))), type = "html") write.csv(c(resultPP$best_settings$parameters, as.list(resultPP$best_settings$result), list(type=type)),file=outputCSV) html<-paste('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Galaxy %s tool output - see http://g2.trac.bx.psu.edu/" /> <title></title> </head> <body> <div class="container-fluid"><h1 class="text-center">IPO optimization - Output</h1><hr>',table,'<br><span class="label label-primary"><a href="IPO_PP.csv">Output</a></span><br><span class="label label-danger"><a href="run.log">Job log</a></span><hr>',graphs,'</div>', sep='') fileConn<-file(args[2]) writeLines(html, fileConn) close(fileConn) sink(type = "message") sink()