"
+ # TODO add (nr and mass error) and group size
+
+ message("\nPlotting figures... ")
+ figureName <- paste(args.htmlReportFile.files_path, "/figure_retcor.png", sep="")
+ html <- paste(html," ", sep="")
+ png( figureName, type="cairo", width=1100,height=600 )
+ retcor(LC$xset@xcmsSet, method="peakgroups", plottype = "mdevden")
+ html <- paste(html,"*NB: retention time correction plot based on 'peakgroups' option with default settings. This is not the plot matching the exact settings used in the run,
+ but just intended to give a rough estimate of the retention time shifts present in the data. A more accurate plot will be available once
+ this option is added in metaMS API. ", sep="")
+ devname = dev.off()
+
+
+ gt <- groups(LC$xset@xcmsSet)
+ groupidx1 <- which(gt[,"rtmed"] > 0 & gt[,"rtmed"] < 3000 & gt[,"npeaks"] > 3)
+
+ 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 26b93438f30e -r f772a5caa86a metams_lcms_annotate.xml
--- a/metams_lcms_annotate.xml Wed Nov 19 15:11:45 2014 +0100
+++ b/metams_lcms_annotate.xml Wed Dec 10 22:03:27 2014 +0100
@@ -1,58 +1,28 @@
-
- Runs metaMS process for LC/MS feature grouping and annotation
+
+ Runs metaMS process for LC/MS feature annotationR_bioc_metams
- metaMS_cmd_interface.r
+ metaMS_cmd_annotate.r
$constructed_db
- $data_files
+ $xsetData
$customMetaMSsettings
$outputFile
- $outputLog
- $xsetOut
$htmlReportFile
$htmlReportFile.files_path
+ $outputLog
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -64,27 +34,7 @@
## 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}))
+ chrom = "LC")
metaSetting(customMetaMSsettings, "match2DB") <- list(
rtdiff = ${rtdiff},
rtval = ${rtval},
@@ -96,8 +46,7 @@
-
-
+
@@ -109,12 +58,17 @@
.. 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.
+Runs metaMS process for LC/MS feature annotation.
+The figure below shows the main parts of the metaMS process.
+This tool related to the last step of this process.
.. image:: $PATH_TO_IMAGES/metaMS.png
+From CAMERA documentation:
+
+.. image:: $PATH_TO_IMAGES/CAMERA_results.png
+
**References**
If you use this Galaxy tool in work leading to a scientific publication please
diff -r 26b93438f30e -r f772a5caa86a metams_lcms_pick_and_group.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metams_lcms_pick_and_group.xml Wed Dec 10 22:03:27 2014 +0100
@@ -0,0 +1,296 @@
+
+ Runs metaMS process for LC/MS feature picking, aligning and grouping
+
+ R_bioc_metams
+
+
+ metaMS_cmd_pick_and_group.r
+ $data_files
+ $customMetaMSsettings
+ $outputFile
+ $xsetOut
+ $htmlReportFile
+ $htmlReportFile.files_path
+ $outputLog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## ====================================
+ ## metaMS process settings
+ customMetaMSsettings <- metaMSsettings(protocolName = "${protocolName}",
+ chrom = "LC",
+ PeakPicking = list(
+ method = "${peakPicking.method}",
+ #if $peakPicking.method == "matchedFilter"
+ fwhm = ${peakPicking.fwhm},
+ sigma = ${peakPicking.fwhm}/${peakPicking.sigma_denom},
+ max = ${peakPicking.max},
+ snthresh = ${peakPicking.snthresh},
+ step = ${peakPicking.step},
+ steps = ${peakPicking.steps},
+ mzdiff = ${peakPicking.mzdiff}),
+ #else
+ ppm = ${peakPicking.ppm},
+ peakwidth = c(${peakPicking.peakwidth}),
+ snthresh = ${peakPicking.snthresh},
+ prefilter = c(${peakPicking.prefilter}),
+ mzCenterFun = "${peakPicking.mzCenterFun}",
+ integrate = ${peakPicking.integrate},
+ mzdiff = ${peakPicking.mzdiff},
+ fitgauss = ${peakPicking.fitgauss},
+ noise = ${peakPicking.noise}),
+ #end if
+ Alignment = list(
+ min.class.fraction = ${min_class_fraction},
+ min.class.size = ${min_class_size},
+ mzwid = ${mzwid},
+ bws = c(${bws}),
+ retcormethod = "${retcor.retcormethod}",
+ #if $retcor.retcormethod == "peakgroups"
+ smooth = "${retcor.smooth}",
+ missingratio = ${retcor.missingratio},
+ extraratio = ${retcor.extraratio},
+ retcorfamily = "${retcor.retcorfamily}",
+ #else
+ ##repeating the method as workaround/ backwards compatibility (can remove this one after fix from metaMS):
+ method = "${retcor.retcormethod}",
+ profStep = ${retcor.profStep},
+ #end if
+ fillPeaks = ${fillPeaks}),
+ CAMERA = list(
+ perfwhm = ${perfwhm},
+ cor_eic_th = ${cor_eic_th},
+ ppm= ${ppm},
+ graphMethod= "${groupCorr_graphMethod}",
+ pval= ${groupCorr_pval},
+ calcCiS= ${groupCorr_calcCiS},
+ calcIso= ${groupCorr_calcIso},
+ calcCaS= ${groupCorr_calcCaS},
+ maxcharge= ${findIsotopes_maxcharge},
+ maxiso= ${findIsotopes_maxiso},
+ minfrac= ${findIsotopes_minfrac},
+ polarity= "${findAdducts_polarity}",
+ multiplier= ${findAdducts_multiplier}
+ ))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+Runs metaMS process for LC/MS feature feature picking, aligning and grouping.
+This part of the metaMS process makes use of the XCMS and CAMERA tools and algorithms.
+CAMERA is used for automatic deconvolution/annotation of LC/ESI-MS data.
+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
+
+Wrapper by Pieter Lukasse.
+
+
+
+
+ 10.1016/j.jchromb.2014.02.051
+
+
\ No newline at end of file
diff -r 26b93438f30e -r f772a5caa86a msclust.xml
--- a/msclust.xml Wed Nov 19 15:11:45 2014 +0100
+++ b/msclust.xml Wed Dec 10 22:03:27 2014 +0100
@@ -1,4 +1,4 @@
-
+Extracts fragmentation spectra from aligned data
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+This tool finds the alignments in the specified RT window and extracts alignment EICs from feature alignment data using XCMS's getEIC method.
+It produces a HTML report showing the EIC plots and the mass list of each alignment. The figure below shows an example of such an EIC plot, showing also the difference between
+two classes, with extra alignment information beneath it.
+
+.. image:: $PATH_TO_IMAGES/diffreport.png
+
+Alignment id: 1709. m/z list of peaks in alignment:
+614.002922098482,613.998019830021,614.000382307519,613.998229980469,613.998229980469
+
+
+
+
+ 10.1021/ac051437y
+
+
\ No newline at end of file
diff -r 26b93438f30e -r f772a5caa86a xcms_get_mass_eic.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_get_mass_eic.r Wed Dec 10 22:03:27 2014 +0100
@@ -0,0 +1,162 @@
+## read args:
+args <- commandArgs(TRUE)
+# xset data:
+args.xsetData <- args[1]
+
+args.rtStart <- strtoi(args[2])
+args.rtEnd <- strtoi(args[3])
+
+args.mzStart <- as.double(args[4])
+args.mzEnd <- as.double(args[5])
+# there are 2 options: specify a mz range or a mz list:
+if (args.mzStart < 0)
+{
+ args.mzList <- as.double(strsplit(args[6], ",")[[1]])
+ cat(typeof(as.double(strsplit(args[6], ",")[[1]])))
+ args.mzTolPpm <- as.double(args[7])
+ # calculate mzends based on ppm tol:
+ mzListEnd <- c()
+ mzListStart <- c()
+ for (i in 1:length(args.mzList))
+ {
+ mzEnd <- args.mzList[i] + args.mzList[i]*args.mzTolPpm/1000000.0
+ mzStart <- args.mzList[i] - args.mzList[i]*args.mzTolPpm/1000000.0
+ mzListEnd <- c(mzListEnd, mzEnd)
+ mzListStart <- c(mzListStart, mzStart)
+ }
+ str(mzListStart)
+ str(mzListEnd)
+} else {
+ mzListEnd <- c(args.mzEnd)
+ mzListStart <- c(args.mzStart)
+}
+
+args.sampleNames <- strsplit(args[8], ",")[[1]]
+# trim leading and trailing spaces:
+args.sampleNames <- gsub("^\\s+|\\s+$", "", args.sampleNames)
+
+args.combineSamples <- args[9]
+args.rtPlotMode <- args[10]
+
+## report files
+args.htmlReportFile <- args[11]
+args.htmlReportFile.files_path <- args[12]
+
+
+if (length(args) == 13)
+{
+ args.outLogFile <- args[13]
+ # suppress messages:
+ # 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")
+}
+
+# TODO - add option to do masses in same plot (if given in same line oid) or in separate plots
+# TODO2 - let it run in parallel
+
+tryCatch(
+ {
+ library(metaMS)
+
+ # load the xset data :
+ xsetData <- readRDS(args.xsetData)
+ # if here to support both scenarios:
+ if ("xcmsSet" %in% slotNames(xsetData) )
+ {
+ xsetData <- xsetData@xcmsSet
+ }
+
+ # report
+ dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE, recursive = TRUE)
+ message(paste("\nGenerating report.........in ", args.htmlReportFile.files_path))
+
+ html <- "
Extracted Ion Chromatograms (EIC) matching criteria
"
+
+ if (args.combineSamples == "No")
+ {
+ if (length(args.sampleNames) > 1 && length(mzListStart) > 1 && length(args.sampleNames) != length(mzListStart))
+ stop(paste("The number of sample names should match the number of m/z values in the list. Found ", length(mzListStart),
+ " masses while ", length(args.sampleNames), " sample names were given."))
+
+ iterSize <- length(args.sampleNames)
+ # these can be set to 1 or 0 just as a trick to iterate OR not over the items. If the respective list is of length 1, only the first item should be used
+ fixSampleIdx <- 1
+ fixMzListIdx <- 1
+ if (length(args.sampleNames) == 1)
+ {
+ fixSampleIdx <- 0
+ iterSize <- length(mzListStart)
+ }
+ if (length(mzListStart) == 1)
+ {
+ fixMzListIdx <- 0
+ }
+ lineColors <- rainbow(iterSize)
+ for (i in 0:(iterSize-1))
+ {
+ message("\nGetting EIC... ")
+ eiccor <- getEIC(xsetData,
+ mzrange=matrix(c(mzListStart[i*fixMzListIdx+1],mzListEnd[i*fixMzListIdx+1]),nrow=1,ncol=2,byrow=TRUE),
+ rtrange=matrix(c(args.rtStart,args.rtEnd),nrow=1,ncol=2,byrow=TRUE),
+ sampleidx=c(args.sampleNames[i*fixSampleIdx+1]), rt=args.rtPlotMode)
+
+ message("\nPlotting figures... ")
+ figureName <- paste(args.htmlReportFile.files_path, "/figure", i,".png", sep="")
+ html <- paste(html," ", sep="")
+ png( figureName, type="cairo", width=1100,height=250 )
+ #plot(eiccor, col=lineColors[i+1])
+ # black is better in this case:
+ plot(eiccor)
+ legend('topright', # places a legend at the appropriate place
+ legend=c(args.sampleNames[i*fixSampleIdx+1]), # puts text in the legend
+ lty=c(1,1), # gives the legend appropriate symbols (lines)
+ lwd=c(2.5,2.5))
+
+ devname = dev.off()
+ }
+
+ } else {
+ for (i in 1:length(mzListStart))
+ {
+ message("\nGetting EIC... ")
+ eiccor <- getEIC(xsetData,
+ mzrange=matrix(c(mzListStart[i],mzListEnd[i]),nrow=1,ncol=2,byrow=TRUE),
+ rtrange=matrix(c(args.rtStart,args.rtEnd),nrow=1,ncol=2,byrow=TRUE),
+ sampleidx=args.sampleNames, rt = args.rtPlotMode)
+
+ #set size, set option (plot per sample, plot per mass)
+
+ message("\nPlotting figures... ")
+ figureName <- paste(args.htmlReportFile.files_path, "/figure", i,".png", sep="")
+ html <- paste(html,"", sep="")
+ png( figureName, type="cairo", width=1100,height=450 )
+ lineColors <- rainbow(length(args.sampleNames))
+ plot(eiccor, col=lineColors)
+ legend('topright', # places a legend at the appropriate place
+ legend=args.sampleNames, # puts text in the legend
+ lty=c(1,1), # gives the legend appropriate symbols (lines)
+ lwd=c(2.5,2.5),
+ col=lineColors)
+ devname = dev.off()
+ }
+ }
+ if (args.rtPlotMode == "corrected")
+ {
+ html <- paste(html,"
*rt values are corrected ones
")
+ }
+ 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 26b93438f30e -r f772a5caa86a xcms_get_mass_eic.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_get_mass_eic.xml Wed Dec 10 22:03:27 2014 +0100
@@ -0,0 +1,114 @@
+
+ Extracts EICs for a given list of masses
+
+ R_bioc_metams
+
+
+ xcms_get_mass_eic.r
+ $xsetData
+ $rtStart
+ $rtEnd
+ #if $massParameters.massParametersType == "window"
+ $massParameters.mzStart
+ $massParameters.mzEnd
+ -1
+ "."
+ #else
+ -1
+ -1
+ $massParameters.mzList
+ $massParameters.mzTolPpm
+ #end if
+ "$sampleNames"
+ $combineSamples
+ $rtPlotMode
+ $htmlReportFile
+ $htmlReportFile.files_path
+ $outLogFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+This tool will plot EICs for a given list of masses (or a mass window) using XCMS's getEIC method.
+It produces a HTML report showing the EIC plots, one for each given mass. The figure below shows an example of such an EIC plot.
+
+.. image:: $PATH_TO_IMAGES/massEIC.png
+
+
+
+
+ 10.1021/ac051437y
+
+
\ No newline at end of file