# HG changeset patch # User pieter.lukasse@wur.nl # Date 1415286884 -3600 # Node ID e67149fbff20871d3949c2dcc4ab78d035f674d5 # Parent a7b609941846ecd2a29cd462443797fcab4fa887 small changes/improvements; new metams and xcms tools diff -r a7b609941846 -r e67149fbff20 combine_output.xml --- a/combine_output.xml Fri Sep 19 16:14:58 2014 +0200 +++ b/combine_output.xml Thu Nov 06 16:14:44 2014 +0100 @@ -4,10 +4,11 @@ combine_output.py $rankfilter_in $caslookup_in $out_single $out_multi - + - + diff -r a7b609941846 -r e67149fbff20 library_lookup.xml --- a/library_lookup.xml Fri Sep 19 16:14:58 2014 +0200 +++ b/library_lookup.xml Thu Nov 06 16:14:44 2014 +0100 @@ -13,16 +13,23 @@ $regression.model + + + - + /" + dir_name : galaxy_output = [("Configuration error: expected file not found in /" + dir_name, "", False)] diff -r a7b609941846 -r e67149fbff20 metaMS_cmd_interface.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metaMS_cmd_interface.r Thu Nov 06 16:14:44 2014 +0100 @@ -0,0 +1,99 @@ +## read args: +args <- commandArgs(TRUE) +## the constructed DB, e.g. "E:/Rworkspace/metaMS/data/LCDBtest.RData" +args.constructedDB <- args[1] +## data files, e.g. "E:/Rworkspace/metaMS/data/data.zip" (with e.g. .CDF files) and unzip output dir, e.g. "E:/" +args.dataZip <- args[2] +args.zipExtrDir <- paste(args[2],"dir/") +## settings file, e.g. "E:/Rworkspace/metaMS/data/settings.r", should contain assignment to an object named "customMetaMSsettings" +args.settings <- args[3] + +## output file names, e.g. "E:/Rworkspace/metaMS/data/out.txt" +args.outAnnotationTable <- args[4] +args.outLogFile <- args[5] +args.xsetOut <- args[6] + +## report files +args.htmlReportFile <- args[7] +args.htmlReportFile.files_path <- args[8] + +# Send all STDERR to STDOUT using sink() see http://mazamascience.com/WorkingWithData/?p=888 +msg <- file(args.outLogFile, open="wt") +sink(msg, type="message") +sink(msg, type="output") + +cat("\nSettings used===============:\n") +cat(readChar(args.settings, 1e5)) + + +tryCatch( + { + library(metaMS) + + ## load the constructed DB : + tempEnv <- new.env() + testDB <- load(args.constructedDB, envir=tempEnv) + + ## load the data files from a zip file + files <- unzip(args.dataZip, exdir=args.zipExtrDir) + + ## load settings "script" into "customMetaMSsettings" + source(args.settings, local=tempEnv) + message(paste(" loaded : ", args.settings)) + + # Just to highlight: if you want to use more than one + # trigger runLC: + LC <- runLC(files, settings = tempEnv[["customMetaMSsettings"]], DB = tempEnv[[testDB[1]]]$DB, nSlaves=20, returnXset = TRUE) + + # write out runLC annotation results: + write.table(LC$Annotation$annotation.table, args.outAnnotationTable, sep="\t", row.names=FALSE) + + # the used constructed DB (write to log): + cat("\nConstructed DB info===============:\n") + str(tempEnv[[testDB[1]]]$Info) + cat("\nConstructed DB table===============:\n") + write.table(tempEnv[[testDB[1]]]$DB, args.outLogFile, append=TRUE, row.names=FALSE) + write.table(tempEnv[[testDB[1]]]$Reftable, args.outLogFile, sep="\t", append=TRUE, row.names=FALSE) + # save xset as rdata: + xsetData <- LC$xset@xcmsSet + saveRDS(xsetData, file=args.xsetOut) + + message("\nGenerating report.........") + # report + dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE) + setwd(file.path(args.htmlReportFile.files_path)) + html <- "

Extracted Ion Chromatograms of groups with more than 3 peaks

" + + LC$xset@xcmsSet + gt <- groups(LC$xset@xcmsSet) + colnames(gt) + groupidx1 <- which(gt[,"rtmed"] > 0 & gt[,"rtmed"] < 3000 & gt[,"npeaks"] > 3) + if (length(groupidx1) > 0) + { + eiccor <- getEIC(LC$xset@xcmsSet, groupidx = c(groupidx1)) + eicraw <- getEIC(LC$xset@xcmsSet, groupidx = c(groupidx1), rt = "raw") + for (i in 1:length(groupidx1)) + { + figureName <- paste(args.htmlReportFile.files_path, "/figure", i,".png", sep="") + html <- paste(html,"", sep="") + png( figureName ) + plot(eiccor, LC$xset@xcmsSet, groupidx = i) + devname = dev.off() + } + } + + + html <- paste(html,"") + message("finished generating report") + write(html,file=args.htmlReportFile) + # unlink(args.htmlReportFile) + cat("\nWarnings================:\n") + str( warnings() ) + }, + error=function(cond) { + sink(NULL, type="message") # default setting + sink(stderr(), type="output") + message("\nERROR: ===========\n") + print(cond) + } + ) diff -r a7b609941846 -r e67149fbff20 metams_lcms_annotate.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metams_lcms_annotate.xml Thu Nov 06 16:14:44 2014 +0100 @@ -0,0 +1,136 @@ + + Runs metaMS process for LC/MS feature grouping and annotation + + R_bioc_metams + + + metaMS_cmd_interface.r + $constructed_db + $data_files + $customMetaMSsettings + $outputFile + $outputLog + $xsetOut + $htmlReportFile + $htmlReportFile.files_path + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## start comment + ## metaMS process settings + customMetaMSsettings <- metaMSsettings(protocolName = "${protocolName}", + chrom = "LC", + PeakPicking = list( + method = "${method}", + step = ${step}, + fwhm = ${fwhm}, + snthresh = ${snthresh}, + max = ${max}), + Alignment = list( + min.class.fraction = ${min_class_fraction}, + min.class.size = ${min_class_size}, + mzwid = ${mzwid}, + bws = c(${bws}), + missingratio = ${missingratio}, + extraratio = ${extraratio}, + retcormethod = "${retcormethod}", + retcorfamily = "${retcorfamily}", + fillPeaks = ${fillPeaks}), + CAMERA = list( + perfwhm = ${perfwhm}, + cor_eic_th = ${cor_eic_th}, + ppm= ${ppm})) +metaSetting(customMetaMSsettings, "match2DB") <- list( + rtdiff = ${rtdiff}, + rtval = ${rtval}, + mzdiff = ${mzdiff}, + ppm = ${match2DB_ppm}, + minfeat = ${minfeat}) + + + + + + + + + + + + + + + + +.. class:: infomark + +Runs metaMS process for LC/MS feature grouping and annotation. Parts of the metaMS process also make use of the XCMS and CAMERA tools and algorithms. +The figure below shows the main parts of the metaMS process. + +.. image:: $PATH_TO_IMAGES/metaMS.png + + +**References** + +If you use this Galaxy tool in work leading to a scientific publication please +cite the following papers: + +Wehrens, R.; Weingart, G.; Mattivi, F. (2014). +metaMS: an open-source pipeline for GC-MS-based untargeted metabolomics. +Journal of chromatography B: biomedical sciences and applications, 996 (1): 109-116. +doi: 10.1016/j.jchromb.2014.02.051 +handle: http://hdl.handle.net/10449/24012 + + + + + 10.1016/j.jchromb.2014.02.051 + + \ No newline at end of file diff -r a7b609941846 -r e67149fbff20 msclust.xml --- a/msclust.xml Fri Sep 19 16:14:58 2014 +0200 +++ b/msclust.xml Thu Nov 06 16:14:44 2014 +0100 @@ -327,6 +327,15 @@ .. _Click here for more details on the SIM output file: javascript:window.open('.. image:: sample_SIM.png'.replace('.. image:: ', ''),'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') +**References** + +If you use this Galaxy tool in work leading to a scientific publication please +cite the following papers: + +Y. M. Tikunov, S. Laptenok, R. D. Hall, A. Bovy, and R. C. H. de Vos (2012). +MSClust: a tool for unsupervised mass spectra extraction of +chromatography-mass spectrometry ion-wise aligned data +http://dx.doi.org/10.1007%2Fs11306-011-0368-2 diff -r a7b609941846 -r e67149fbff20 static/images/diffreport.png Binary file static/images/diffreport.png has changed diff -r a7b609941846 -r e67149fbff20 static/images/metaMS.png Binary file static/images/metaMS.png has changed diff -r a7b609941846 -r e67149fbff20 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Thu Nov 06 16:14:44 2014 +0100 @@ -0,0 +1,13 @@ + + + + + + + + This dependency: + Ensures R 3.1.1 installation is triggered (via dependency). + Ensures Bioconductor 3.0 and package metaMS, multtest and snow are installed. + + \ No newline at end of file diff -r a7b609941846 -r e67149fbff20 xcms_differential_analysis.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xcms_differential_analysis.r Thu Nov 06 16:14:44 2014 +0100 @@ -0,0 +1,72 @@ +## read args: +args <- commandArgs(TRUE) +#cat("args <- \"\"\n") +## a xcms xset saved as .RData +args.xsetData <- args[1] +#cat(paste("args.xsetData <- \"", args[1], "\"\n", sep="")) + +args.class1 <- args[2] +args.class2 <- args[3] +#cat(paste("args.class1 <- \"", args[2], "\"\n", sep="")) +#cat(paste("args.class2 <- \"", args[3], "\"\n", sep="")) + +args.topcount <- strtoi(args[4]) +#cat(paste("args.topcount <- ", args[4], "\n", sep="")) + +args.outTable <- args[5] +args.outLogFile <- args[6] +#cat(paste("args.outLogFile <- \"", args[6], "\"\n", sep="")) + +## report files +args.htmlReportFile <- args[7] +args.htmlReportFile.files_path <- args[8] +#cat(paste("args.htmlReportFile <- \"", args[7], "\"\n", sep="")) +#cat(paste("args.htmlReportFile.files_path <- \"", args[8], "\"\n", sep="")) + +# Send all STDERR to STDOUT using sink() see http://mazamascience.com/WorkingWithData/?p=888 +msg <- file(args.outLogFile, open="wt") +sink(msg, type="message") +sink(msg, type="output") + +tryCatch( + { + library(metaMS) + library(xcms) + #library("R2HTML") + + ## load the constructed DB : + xcmsSet <- readRDS(args.xsetData) + + # info: levels(xcmsSet@phenoData$class) also gives access to the class names + dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE) + reporttab <- diffreport(xcmsSet, args.class1, args.class2, paste(args.htmlReportFile.files_path,"/fig", sep=""), args.topcount, metlin = 0.15, h=480, w=640) + + # write out tsv table: + write.table(reporttab, args.outTable, sep="\t", row.names=FALSE) + + message("\nGenerating report.........") + + cat("

Differential analysis report

", file= args.htmlReportFile) + #HTML(reporttab[1:args.topcount,], file= args.htmlReportFile) + figuresPath <- paste(args.htmlReportFile.files_path, "/fig_eic", sep="") + message(figuresPath) + listOfFiles <- list.files(path = figuresPath) + for (i in 1:length(listOfFiles)) + { + figureName <- listOfFiles[i] + # maybe we still need to copy the figures to the args.htmlReportFile.files_path + cat(paste("", sep=""), file= args.htmlReportFile, append=TRUE) + cat(paste("", sep=""), file= args.htmlReportFile, append=TRUE) + } + + message("finished generating report") + cat("\nWarnings================:\n") + str( warnings() ) + }, + error=function(cond) { + sink(NULL, type="message") # default setting + sink(stderr(), type="output") + message("\nERROR: ===========\n") + print(cond) + } + ) \ No newline at end of file diff -r a7b609941846 -r e67149fbff20 xcms_differential_analysis.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xcms_differential_analysis.xml Thu Nov 06 16:14:44 2014 +0100 @@ -0,0 +1,55 @@ + + Runs xcms diffreport function for differential Analsysis + + R_bioc_metams + + + xcms_differential_analysis.r + $xsetData + $class1 + $class2 + $topcount + $outTable + $outLogFile + $htmlReportFile + $htmlReportFile.files_path + + + + + + + + + + + + + + + + + + + + + + + +.. class:: infomark + +Runs xcms diffreport for showing the most significant differences between two sets/classes of samples. This tool also creates extracted ion chromatograms (EICs) for +the most significant differences. The figure below shows an example of such an EIC. + +.. image:: $PATH_TO_IMAGES/diffreport.png + + + + + + + 10.1021/ac051437y + + \ No newline at end of file