# HG changeset patch # User pieter.lukasse@wur.nl # Date 1418245407 -3600 # Node ID f772a5caa86a97d72c17fcc62bd97023c1e4f14f # Parent 26b93438f30edb20aba76a966f7f97ee3bae9f83 Added more options and better documentation. Added MsClust support for parsing XCMS alignment results. Improved output reports for XCMS wrappers. New tools. diff -r 26b93438f30e -r f772a5caa86a MsClust.jar Binary file MsClust.jar has changed diff -r 26b93438f30e -r f772a5caa86a README.rst --- a/README.rst Wed Nov 19 15:11:45 2014 +0100 +++ b/README.rst Wed Dec 10 22:03:27 2014 +0100 @@ -19,6 +19,8 @@ ============== ====================================================================== Date Changes -------------- ---------------------------------------------------------------------- +December 2014 * Added MsClust support for parsing XCMS alignment results. + * Improved output reports for XCMS wrappers. November 2014 * Added XCMS related tool wrappers (for metaMS and diffreport) September 2014 * Added new membership cutoff option for final clusters in MsClust * Improved MsClust memory usage for large datasets diff -r 26b93438f30e -r f772a5caa86a metaMS_cmd_annotate.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metaMS_cmd_annotate.r Wed Dec 10 22:03:27 2014 +0100 @@ -0,0 +1,83 @@ +## read args: +args <- commandArgs(TRUE) +## the constructed DB, e.g. "E:/Rworkspace/metaMS/data/LCDBtest.RData" +args.constructedDB <- args[1] +## data file in xset format: +args.xsetData <- args[2] +## 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] + +## report files +args.htmlReportFile <- args[5] +args.htmlReportFile.files_path <- args[6] + +if (length(args) == 7) +{ + args.outLogFile <- args[7] + # 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") +} + +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) + xsetData <- readRDS(args.xsetData) + + ## 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(xset=xsetData, settings = tempEnv[["customMetaMSsettings"]], DB = tempEnv[[testDB[1]]]$DB, nSlaves=20, returnXset = TRUE) + + # write out runLC annotation results: + write.table(LC$PeakTable, 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") + if (length(args) == 7) + { + 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) + } + + message("\nGenerating report.........") + # report + dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE, recursive = TRUE) + html <- "

Summary of annotation results:

" + nrTotalFeatures <- nrow(LC$PeakTable) + nrAnnotatedFeatures <- nrow(LC$Annotation$annotation.table) + html <- paste(html,"

Total nr of features: ", nrTotalFeatures,"

", sep="") + html <- paste(html,"

Total nr of annotated features: ", nrAnnotatedFeatures,"

", sep="") + + 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_cmd_interface.r --- a/metaMS_cmd_interface.r Wed Nov 19 15:11:45 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -## 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, type="cairo" ) - 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 26b93438f30e -r f772a5caa86a metaMS_cmd_pick_and_group.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metaMS_cmd_pick_and_group.r Wed Dec 10 22:03:27 2014 +0100 @@ -0,0 +1,89 @@ +## read args: +args <- commandArgs(TRUE) +## 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[1] +args.zipExtrDir <- sub("\\.","_",paste(args[1],"dir", sep="")) +dir.create(file.path(args.zipExtrDir), showWarnings = FALSE, recursive = TRUE) +## settings file, e.g. "E:/Rworkspace/metaMS/data/settings.r", should contain assignment to an object named "customMetaMSsettings" +args.settings <- args[2] + +## output file names, e.g. "E:/Rworkspace/metaMS/data/out.txt" +args.outPeakTable <- args[3] +args.xsetOut <- args[4] + +## report files +args.htmlReportFile <- args[5] +args.htmlReportFile.files_path <- args[6] + + +if (length(args) == 7) +{ + args.outLogFile <- args[7] + # 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") +} + +cat("\nSettings used===============:\n") +cat(readChar(args.settings, 1e5)) + + +tryCatch( + { + library(metaMS) + + ## load the data files from a zip file + files <- unzip(args.dataZip, exdir=args.zipExtrDir) + + ## load settings "script" into "customMetaMSsettings" + tempEnv <- new.env() + source(args.settings, local=tempEnv) + message(paste(" loaded : ", args.settings)) + allSettings <- tempEnv[["customMetaMSsettings"]] + + # trigger runLC: + LC <- runLC(files, settings = allSettings, nSlaves=20, returnXset = TRUE) + + # write out runLC annotation results: + write.table(LC$PeakTable, args.outPeakTable, sep="\t", row.names=FALSE) + + # save xset as rdata: + xsAnnotatePreparedData <- LC$xset + saveRDS(xsAnnotatePreparedData, file=args.xsetOut) + + message("\nGenerating report.........") + # report + dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE, recursive = TRUE) + html <- "

Info on alignment quality

" + # 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 annotation R_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