├── .BBSoptions ├── .Rbuildignore ├── .editorconfig ├── .github ├── .gitignore └── workflows │ └── check-bioc.yml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS.md ├── R ├── AllGenerics.R ├── DataClasses.R ├── Deprecated.R ├── MPI.R ├── MsExperiment-functions.R ├── MsExperiment.R ├── XcmsExperiment-functions.R ├── XcmsExperiment-plotting.R ├── XcmsExperiment.R ├── XcmsExperimentHdf5-functions.R ├── XcmsExperimentHdf5.R ├── c.R ├── cwTools.R ├── databases.R ├── do_adjustRtime-functions.R ├── do_findChromPeaks-functions.R ├── do_groupChromPeaks-functions.R ├── fastMatch.R ├── functions-Chromatogram.R ├── functions-IO.R ├── functions-MsFeatureData.R ├── functions-OnDiskMSnExp.R ├── functions-Params.R ├── functions-ProcessHistory.R ├── functions-XCMSnExp.R ├── functions-XChromatogram.R ├── functions-XChromatograms.R ├── functions-binning.R ├── functions-imputation.R ├── functions-utils.R ├── functions-xcmsEIC.R ├── functions-xcmsFragments.R ├── functions-xcmsRaw.R ├── functions-xcmsSet.R ├── functions-xcmsSwath.R ├── hidden_aliases.R ├── init.R ├── loadXcmsData.R ├── matchpeaks.R ├── method-filterFeatures.R ├── methods-Chromatogram.R ├── methods-IO.R ├── methods-MChromatograms.R ├── methods-MsFeatureData.R ├── methods-OnDiskMSnExp.R ├── methods-Params.R ├── methods-ProcessHistory.R ├── methods-XCMSnExp.R ├── methods-XChromatogram.R ├── methods-XChromatograms.R ├── methods-group-features.R ├── methods-xcmsEIC.R ├── methods-xcmsFileSource.R ├── methods-xcmsFragments.R ├── methods-xcmsPeaks.R ├── methods-xcmsRaw.R ├── methods-xcmsSet.R ├── models.R ├── mzClust.R ├── plotQC.R ├── specDist.R ├── write.mzquantML.R ├── writemzdata.R ├── writemztab.R ├── xcmsSource.R └── zzz.R ├── README.md ├── _pkgdown.yml ├── data ├── faahko_sub.RData ├── faahko_sub2.RData ├── xdata.RData └── xmse.RData ├── inst ├── CHANGELOG ├── CITATION ├── mgf │ ├── metlin-2724.mgf │ ├── metlin-68898.mgf │ └── metlin-72445.mgf └── xsd │ └── mzQuantML_1_0_0.xsd ├── logo.png ├── longtests ├── testthat.R └── testthat │ ├── test_do_adjustRtime-functions.R │ ├── test_do_findChromPeaks-functions.R │ ├── test_do_groupChromPeaks-functions.R │ ├── test_functions-OnDiskMSnExp.R │ ├── test_methods-OnDiskMSnExp.R │ ├── test_methods-XCMSnExp.R │ ├── test_old_BiocParallel.R │ ├── test_old_absentPresent.R │ ├── test_old_functions-IO.R │ ├── test_old_functions-xcmsRaw.R │ ├── test_old_functions-xcmsSet.R │ ├── test_old_methods-IO.R │ ├── test_old_methods-xcmsRaw.R │ ├── test_old_methods-xcmsSet.R │ ├── test_old_xcmsSource.R │ └── test_specDist.R ├── man ├── AutoLockMass-methods.Rd ├── BlankFlag.Rd ├── DratioFilter.Rd ├── GenericParam.Rd ├── LamaParama.Rd ├── PercentMissingFilter.Rd ├── ProcessHistory-class.Rd ├── RsdFilter.Rd ├── SSgauss.Rd ├── XCMSnExp-class.Rd ├── XCMSnExp-filter-methods.Rd ├── XCMSnExp-inherited-methods.Rd ├── XCMSnExp-peak-grouping-results.Rd ├── XChromatogram.Rd ├── XcmsExperiment.Rd ├── XcmsExperimentHdf5.Rd ├── absent-methods.Rd ├── adjustRtime.Rd ├── applyAdjustedRtime.Rd ├── binYonX.Rd ├── breaks_on_binSize.Rd ├── breaks_on_nBins.Rd ├── c.xcmsSet.Rd ├── calibrate-calibrant-mass.Rd ├── calibrate.Rd ├── chromPeakChromatograms.Rd ├── chromPeakSpectra.Rd ├── chromPeakSummary.Rd ├── chromatogram-method.Rd ├── colMax.Rd ├── collect-methods.Rd ├── correlate-Chromatogram.Rd ├── descendZero.Rd ├── diffreport-methods.Rd ├── dirname.Rd ├── do_adjustRtime_peakGroups.Rd ├── do_findChromPeaks_centWave.Rd ├── do_findChromPeaks_centWaveWithPredIsoROIs.Rd ├── do_findChromPeaks_massifquant.Rd ├── do_findChromPeaks_matchedFilter.Rd ├── do_findPeaks_MSW.Rd ├── do_groupChromPeaks_density.Rd ├── do_groupChromPeaks_nearest.Rd ├── do_groupPeaks_mzClust.Rd ├── doubleMatrix.Rd ├── estimatePrecursorIntensity.Rd ├── etg.Rd ├── exportMetaboAnalyst.Rd ├── extractMsData-method.Rd ├── feature-grouping.Rd ├── featureChromatograms.Rd ├── featureSpectra.Rd ├── featureSummary.Rd ├── figures │ └── logo.png ├── fillChromPeaks.Rd ├── fillPeaks-methods.Rd ├── fillPeaks.MSW-methods.Rd ├── fillPeaks.chrom-methods.Rd ├── filter-MChromatograms.Rd ├── filterFeatures.Rd ├── filtfft.Rd ├── findChromPeaks-Chromatogram-CentWaveParam.Rd ├── findChromPeaks-Chromatogram-MatchedFilter.Rd ├── findChromPeaks-centWave.Rd ├── findChromPeaks-centWaveWithPredIsoROIs.Rd ├── findChromPeaks-massifquant.Rd ├── findChromPeaks-matchedFilter.Rd ├── findChromPeaks.Rd ├── findChromPeaksIsolationWindow.Rd ├── findEqualGreater.Rd ├── findMZ.Rd ├── findPeaks-MSW.Rd ├── findPeaks-methods.Rd ├── findPeaks.MS1-methods.Rd ├── findPeaks.MSW-xcmsRaw-method.Rd ├── findPeaks.addPredictedIsotopeFeatures-methods.Rd ├── findPeaks.centWave-methods.Rd ├── findPeaks.centWaveWithPredictedIsotopeROIs-methods.Rd ├── findPeaks.massifquant-methods.Rd ├── findPeaks.matchedFilter-xcmsRaw-method.Rd ├── findneutral.Rd ├── getEIC-methods.Rd ├── getPeaks-methods.Rd ├── getScan-methods.Rd ├── getSpec-methods.Rd ├── getXcmsRaw-methods.Rd ├── group-methods.Rd ├── group.density.Rd ├── group.mzClust.Rd ├── group.nearest.Rd ├── groupChromPeaks.Rd ├── groupFeatures-abundance-correlation.Rd ├── groupFeatures-eic-similarity.Rd ├── groupFeatures-similar-rtime.Rd ├── groupOverlaps.Rd ├── groupnames-XCMSnExp.Rd ├── groupnames-methods.Rd ├── groupval-methods.Rd ├── hidden_aliases.Rd ├── highlightChromPeaks.Rd ├── image.xcmsRaw.Rd ├── imputeLinInterpol.Rd ├── imputeRowMin.Rd ├── imputeRowMinRand.Rd ├── isolationWindowTargetMz-OnDiskMSnExp-method.Rd ├── levelplot.xcmsRaw.Rd ├── loadRaw-methods.Rd ├── loadXcmsData.Rd ├── manualChromPeaks.Rd ├── medianFilter.Rd ├── msn2xcmsRaw.Rd ├── na.flatfill.Rd ├── overlappingFeatures.Rd ├── panel.cor.Rd ├── peakPlots-methods.Rd ├── peakTable-methods.Rd ├── peaksWithCentWave.Rd ├── peaksWithMatchedFilter.Rd ├── phenoDataFromPaths.Rd ├── plot.xcmsEIC.Rd ├── plotAdjustedRtime.Rd ├── plotChrom-methods.Rd ├── plotChromPeakDensity.Rd ├── plotChromPeaks.Rd ├── plotChromatogramsOverlay.Rd ├── plotEIC-methods.Rd ├── plotFeatureGroups.Rd ├── plotMsData.Rd ├── plotPeaks-methods.Rd ├── plotPrecursorIons.Rd ├── plotQC.Rd ├── plotRaw-methods.Rd ├── plotScan-methods.Rd ├── plotSpec-methods.Rd ├── plotSurf-methods.Rd ├── plotTIC-methods.Rd ├── plotrt-methods.Rd ├── profGenerate.Rd ├── profMat-xcmsSet.Rd ├── profMedFilt-methods.Rd ├── profMethod-methods.Rd ├── profRange-methods.Rd ├── profStep-methods.Rd ├── pval.Rd ├── rawEIC-methods.Rd ├── rawMat-methods.Rd ├── reconstructChromPeakSpectra.Rd ├── rectUnique.Rd ├── refineChromPeaks.Rd ├── removeIntensity-Chromatogram.Rd ├── retcor-methods.Rd ├── retcor.obiwarp-methods.Rd ├── retcor.peakgroups-methods.Rd ├── retexp.Rd ├── rla.Rd ├── sampnames-methods.Rd ├── showError-xcmsSet-method.Rd ├── specDist-methods.Rd ├── specDist.cosine-methods.Rd ├── specDist.meanMZmatch-methods.Rd ├── specDist.peakCount-methods.Rd ├── specNoise.Rd ├── specPeaks.Rd ├── split.xcmsRaw.Rd ├── split.xcmsSet.Rd ├── stitch-methods.Rd ├── sub-xcmsRaw-logicalOrNumeric-missing-missing-method.Rd ├── updateObject-xcmsSet-method.Rd ├── useOriginalCode.Rd ├── verify.mzQuantML.Rd ├── write.cdf-methods.Rd ├── write.mzQuantML.Rd ├── write.mzdata-methods.Rd ├── writeMSData-XCMSnExp-character-method.Rd ├── writeMzTab.Rd ├── xcms-deprecated.Rd ├── xcmsEIC-class.Rd ├── xcmsFileSource-class.Rd ├── xcmsFragments-class.Rd ├── xcmsFragments.Rd ├── xcmsPeaks-class.Rd ├── xcmsRaw-class.Rd ├── xcmsRaw.Rd ├── xcmsSet-class.Rd ├── xcmsSet.Rd ├── xcmsSource-class.Rd └── xcmsSource-methods.Rd ├── src ├── Makevars ├── Makevars.win ├── binarySearch.h ├── binners.c ├── binners.h ├── fastMatch.c ├── massifquant │ ├── DataKeeper.cpp │ ├── DataKeeper.h │ ├── OpOverload.cpp │ ├── OpOverload.h │ ├── SegProc.cpp │ ├── SegProc.h │ ├── TrMgr.cpp │ ├── TrMgr.h │ ├── Tracker.cpp │ ├── Tracker.h │ ├── dpq.h │ ├── nmath.h │ └── xcms_massifquant.cpp ├── mzClust_hclust.c ├── mzROI.c ├── obiwarp │ ├── lmat.h │ ├── mat.cpp │ ├── mat.h │ ├── vec.cpp │ ├── vec.h │ ├── xcms_dynprog.cpp │ ├── xcms_dynprog.h │ └── xcms_lmat.cpp ├── util.c ├── util.h ├── xcms.c ├── xcms.h └── xcms_obiwarp.cpp ├── tests ├── testthat.R └── testthat │ ├── test_Chromatogram.R │ ├── test_MsExperiment-functions.R │ ├── test_MsExperiment.R │ ├── test_MsFeatureData.R │ ├── test_Param_classes.R │ ├── test_XcmsExperiment-functions.R │ ├── test_XcmsExperiment-plotting.R │ ├── test_XcmsExperiment.R │ ├── test_XcmsExperimentHdf5-functions.R │ ├── test_XcmsExperimentHdf5.R │ ├── test_do_adjustRtime-functions.R │ ├── test_do_findChromPeaks-functions.R │ ├── test_do_groupChromPeaks-functions.R │ ├── test_function-filtering.R │ ├── test_functions-Chromatogram.R │ ├── test_functions-OnDiskMSnExp.R │ ├── test_functions-ProcessHistory.R │ ├── test_functions-XCMSnExp.R │ ├── test_functions-XChromatogram.R │ ├── test_functions-XChromatograms.R │ ├── test_functions-binning.R │ ├── test_functions-imputation.R │ ├── test_functions-utils.R │ ├── test_functions-xcmsSwath.R │ ├── test_loadXcmsData.R │ ├── test_matchpeaks.R │ ├── test_methods-Chromatogram.R │ ├── test_methods-MChromatograms.R │ ├── test_methods-OnDiskMSnExp.R │ ├── test_methods-XCMSnExp.R │ ├── test_methods-XChromatogram.R │ ├── test_methods-XChromatograms.R │ └── test_methods-group-features.R └── vignettes ├── LC-MS-feature-grouping.Rmd ├── benchmarking.Rmd-notrun ├── biomed-central.csl ├── new_functionality.Rmd-notrun ├── references.bib ├── swath_tomato.Rmd_notrun ├── xcms-direct-injection.Rmd ├── xcms-lcms-ms.Rmd ├── xcms-lcms-ms.bioschemas.html ├── xcms.Rmd └── xcms.bioschemas.html /.BBSoptions: -------------------------------------------------------------------------------- 1 | RunLongTests: TRUE 2 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | .editorconfig 2 | local_data 3 | .git 4 | .travis.yml 5 | .org 6 | ^.*\.Rproj$ 7 | ^\.Rproj\.user$ 8 | README.md 9 | Rplots.pdf 10 | .DS_Store 11 | ^\.github$ 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.R] 12 | indent_style = space 13 | indent_size = 4 14 | max_line_length = 80 15 | 16 | [Makefile] 17 | indent_style = tab 18 | 19 | [.travis.yml] 20 | indent_style = space 21 | indent_size = 2 -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | \#*\# 3 | 4 | inst/doc/example_box/ 5 | inst/doc/example_eic/ 6 | inst/doc/example_spec/ 7 | inst/doc/xcmsDirect.pdf 8 | inst/doc/xcmsInstall.pdf 9 | inst/doc/xcmsMSn.pdf 10 | inst/doc/xcmsPreprocess.pdf 11 | 12 | *.o 13 | src/xcms.so 14 | src/boost/ 15 | src/boost_aux/ 16 | src/pwiz/ 17 | 18 | readme.org 19 | local_data/ 20 | .Rproj.user 21 | 22 | .Rhistory 23 | xcms.Rproj 24 | 25 | Rplots.pdf 26 | .DS_Store 27 | 28 | *.dll -------------------------------------------------------------------------------- /R/databases.R: -------------------------------------------------------------------------------- 1 | 2 | .ppm<-function(Mr, Mm){ ## Mr Mz real Mm Mz Measured 3 | ppm<-abs((10^6)*(Mr-Mm)/Mm) ##abs for positive number 4 | return(ppm) 5 | } 6 | 7 | ppmDev<-function(Mr, ppmE=5){ 8 | error<-(ppmE/10^6)*Mr ## just take the ppm as a percentage 9 | deviation<-c(Mr+error, Mr-error)## 1 is high 2 is low 10 | return(deviation) 11 | } 12 | 13 | read.mascot<-function(file, type="csv"){ 14 | ## Experimental 15 | if(!file.exists(file)) 16 | stop("File doesnt exist") 17 | if(type=="csv"){ 18 | lines<-readLines(file) ##check to see if file is ~ normal 19 | if (grep("Protein hit", lines)) { 20 | x<-lines[-seq(grep("Protein hit", lines)+1)] 21 | myDF <-read.csv(textConnection(x), header=T) 22 | } else { 23 | stop("Noncompatable csv file\n") 24 | } 25 | } else if (type=="xml"){ 26 | stop("XML files are currently not supported, support comming soon") 27 | } 28 | return(myDF) 29 | } 30 | 31 | # KeggSearch <- function(object, DBsearchMS) { 32 | # 33 | # libname <- 'KEGGSOAP' 34 | # KEGG.status <- try(require(libname, character.only = TRUE, quietly=TRUE)) 35 | # 36 | # if (class(KEGG.status) == "try-error") 37 | # stop("Couldn't load KEGGSOAP\n") 38 | # 39 | # if(class(object)=="xcmsSet"){ 40 | # groupmat<-groups(object) 41 | # neutralmass <- groupmat[,"mzmed"] + ifelse(DBsearchMS < 0, 1, -1) 42 | # 43 | # KEGGcmpd<-array(0, dim=length(neutralmass)) 44 | # for(i in 1:length(neutralmass)){ 45 | # KEGGcmpd[i]<-search.compounds.by.mass(neutralmass, range(ppmDev(neutralmass[i], DBsearchMS)))[1] 46 | # } 47 | # return(KEGGcmpd) 48 | # } 49 | # } 50 | -------------------------------------------------------------------------------- /R/fastMatch.R: -------------------------------------------------------------------------------- 1 | 2 | fastMatch <- function(x,y,tol=0.001, symmetric=FALSE) { 3 | 4 | if (any(is.na(y))) 5 | stop("NA's are not allowed in y !\n") 6 | ok <- !(is.na(x)) 7 | ans <- order(x) 8 | keep <- seq_along(ok)[ok] 9 | xidx <- ans[ans %in% keep] 10 | xs <- x[xidx] 11 | yidx <- order(y) 12 | ys <- y[yidx] 13 | if (!is.double(xs)) 14 | xs <- as.double(xs) 15 | if (!is.double(ys)) 16 | ys<- as.double(ys) 17 | if (!is.integer(xidx)) 18 | xidx <- as.integer(xidx) 19 | if (!is.integer(yidx)) 20 | yidx <- as.integer(yidx) 21 | 22 | fm <- .Call("fastMatch", xs, ys, xidx, yidx, as.integer(length(x)), as.double(tol) , PACKAGE ='xcms' ) 23 | fm2 <- vector("list", length=length(fm)) 24 | ##stop("!") 25 | if (symmetric){ 26 | for (a in 1:length(fm)) { 27 | if (!is.null(fm[[a]][1])){ 28 | tmp<-NULL 29 | for (b in 1:length(fm[[a]])){ 30 | if ((abs(x[a]-y[fm[[a]]][b]) == min(abs(x[a]-y[fm[[a]][b]]), 31 | abs(x[a] -y[fm[[a]][b]-1]), 32 | abs(x[a] -y[fm[[a]][b]+1]), 33 | abs(x[a-1]-y[fm[[a]][b]]), 34 | abs(x[a+1]-y[fm[[a]][b]]), na.rm=T) 35 | )) { 36 | tmp<-c(tmp, fm[[a]][b]) 37 | } 38 | } 39 | fm2[[a]]<-tmp 40 | } 41 | } 42 | }else { 43 | fm2 <- fm} 44 | fm2 45 | } 46 | -------------------------------------------------------------------------------- /R/hidden_aliases.R: -------------------------------------------------------------------------------- 1 | #' @title Internal page for hidden aliases 2 | #' 3 | #' @aliases class:Param Param-class 4 | #' 5 | #' @description 6 | #' 7 | #' For S4 methods that require a documentation entry but only clutter the index. 8 | #' 9 | #' @usage NULL 10 | #' @format NULL 11 | #' @keywords internal 12 | #' @return Not applicable 13 | #' @docType methods 14 | hidden_aliases <- NULL 15 | -------------------------------------------------------------------------------- /R/methods-xcmsEIC.R: -------------------------------------------------------------------------------- 1 | ## Methods for xcmsEIC 2 | #' @include functions-xcmsEIC.R 3 | 4 | ############################################################ 5 | #' @rdname hidden_aliases 6 | setMethod("show", "xcmsEIC", function(object) { 7 | 8 | cat("An \"xcmsEIC\" object with", length(object@eic), "samples\n\n") 9 | 10 | cat("Time range: ", paste(round(range(object@rtrange), 1), collapse = "-"), 11 | " seconds (", paste(round(range(object@rtrange)/60, 1), collapse = "-"), 12 | " minutes)\n", sep = "") 13 | cat("Mass range:", paste(round(range(object@mzrange, na.rm = TRUE), 4), collapse = "-"), 14 | "m/z\n") 15 | cat("EICs per sample:", nrow(object@mzrange), "\n") 16 | cat("Retention times:", object@rt, "\n") 17 | cat("xcmsSet group names: ") 18 | if (length(object@groupnames)) 19 | cat("present") 20 | else 21 | cat("absent") 22 | cat("\n\n") 23 | memsize <- object.size(object) 24 | cat("Memory usage:", signif(memsize/2^20, 3), "MB\n") 25 | }) 26 | 27 | ############################################################ 28 | ## groupnames 29 | setMethod("groupnames", "xcmsEIC", function(object) { 30 | 31 | object@groupnames 32 | }) 33 | 34 | ############################################################ 35 | ## sampnames 36 | setMethod("sampnames", "xcmsEIC", function(object) { 37 | 38 | names(object@eic) 39 | }) 40 | 41 | ############################################################ 42 | ## mzrange 43 | setMethod("mzrange", "xcmsEIC", function(object) { 44 | 45 | object@mzrange 46 | }) 47 | 48 | ############################################################ 49 | ## rtrange 50 | setMethod("rtrange", "xcmsEIC", function(object) { 51 | 52 | object@rtrange 53 | }) 54 | -------------------------------------------------------------------------------- /R/methods-xcmsFileSource.R: -------------------------------------------------------------------------------- 1 | ##' @description Return the file name from an xcmsFileSource object. 2 | ##' @param object The xcmsFileSource object from which the file name 3 | ##' should be returned. 4 | ##' @param ... Not used. 5 | ##' @return A character representing the file name. 6 | ##' @noRd 7 | setMethod("fileName", "xcmsFileSource", function(object, ...) { 8 | return(as.character(object)) 9 | }) 10 | 11 | ##' Reads the MS1 and/or MSn data from an netCDF or mzML file. 12 | ##' @param object The xcmsFileSource object representing the file name. 13 | ##' @param includeMSn Whether MSn data should be imported too. 14 | ##' @return Returns a list with rt, tic, scanindex, mz and intensity. 15 | ##' @noRd 16 | setMethod("loadRaw", "xcmsFileSource", function(object, includeMSn = FALSE) { 17 | return(readRawData(fileName(object), includeMSn = includeMSn)) 18 | }) 19 | -------------------------------------------------------------------------------- /R/methods-xcmsPeaks.R: -------------------------------------------------------------------------------- 1 | ## Methods for xcmsPeaks 2 | #' @include DataClasses.R 3 | 4 | #' @rdname hidden_aliases 5 | setMethod("show", "xcmsPeaks", function(object) { 6 | cat("A matrix of", nrow(object), "peaks\n") 7 | cat("Column names:\n") 8 | print(colnames(object)) 9 | }) 10 | -------------------------------------------------------------------------------- /R/models.R: -------------------------------------------------------------------------------- 1 | SSgauss <- selfStart(~ h*exp(-(x-mu)^2/(2*sigma^2)), function(mCall, data, LHS, ...) { 2 | 3 | xy <- sortedXyData(mCall[["x"]], LHS, data) 4 | 5 | len <- dim(xy)[1] 6 | xyarea <- sum((xy[2:len,2]+xy[1:(len-1),2])*(xy[2:len,1]-xy[1:(len-1),1]))/2 7 | maxpos <- which.max(xy[,2]) 8 | 9 | mu <- xy[maxpos,1] 10 | h <- xy[maxpos,2] 11 | sigma <- xyarea/(h*sqrt(2*pi)) 12 | 13 | value <- c(mu, sigma, h) 14 | names(value) <- mCall[c("mu", "sigma", "h")] 15 | value 16 | 17 | }, c("mu", "sigma", "h")) 18 | 19 | etg <- function(x, H, t1, tt, k1, kt, lambda1, lambdat, alpha, beta) 20 | 2*H*exp(0.5)/((1+lambda1*exp(k1*(t1-x)))^alpha + (1+lambdat*exp(kt*(x-tt)))^beta - 1) 21 | -------------------------------------------------------------------------------- /R/xcmsSource.R: -------------------------------------------------------------------------------- 1 | ## Methods related to xcmsSource 2 | #' @include AllGenerics.R DataClasses.R 3 | 4 | setMethod("xcmsSource", "character", function(object, filetype = character()) { 5 | if (!file.exists(object)) 6 | stop("xcmsSource: file not found: ", object) 7 | return(new("xcmsFileSource", object)) 8 | }) 9 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(libname, pkgname) { 2 | packageStartupMessage( 3 | paste("\nThis is xcms version", packageVersion("xcms"), "\n")) 4 | } 5 | 6 | .onLoad <- function(libname, pkgname) { 7 | # require(methods) 8 | .setXCMSOptions(pkgname) 9 | } 10 | 11 | .onUnload <- function(libpath) { 12 | ## mzR:::rampCloseAll() # Makes only sense if we used ramp. 13 | library.dynam.unload("xcms", libpath) 14 | } 15 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://sneumann.github.io/xcms 2 | 3 | template: 4 | bootstrap: 5 5 | bootswatch: flatly 6 | -------------------------------------------------------------------------------- /data/faahko_sub.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/data/faahko_sub.RData -------------------------------------------------------------------------------- /data/faahko_sub2.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/data/faahko_sub2.RData -------------------------------------------------------------------------------- /data/xdata.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/data/xdata.RData -------------------------------------------------------------------------------- /data/xmse.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/data/xmse.RData -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite the XCMS package in publications use:") 2 | 3 | citEntry(entry="article", 4 | author="Smith, C.A. and Want, E.J. and O'Maille, G. and Abagyan,R. and Siuzdak, G.", 5 | title="XCMS: Processing mass spectrometry data for metabolite profiling using nonlinear peak alignment, matching and identification", 6 | journal="Analytical Chemistry", 7 | year="2006", 8 | volume="78", 9 | pages="779--787", 10 | textVersion = paste("Smith, C.A. and Want, E.J. and O'Maille, G. and Abagyan,R. and Siuzdak, G.:", 11 | "XCMS: Processing mass spectrometry data for metabolite profiling", 12 | "using nonlinear peak alignment, matching and identification,", 13 | "Analytical Chemistry, 78:779-787 (2006)")) 14 | 15 | citEntry(entry="article", 16 | author="Ralf Tautenhahn, Christoph Boettcher, Steffen Neumann", 17 | title="Highly sensitive feature detection for high resolution LC/MS", 18 | journal="BMC Bioinformatics", 19 | year="2008", 20 | volume="9", 21 | pages="504", 22 | textVersion = paste("Ralf Tautenhahn, Christoph Boettcher, Steffen Neumann:", 23 | "Highly sensitive feature detection for high resolution LC/MS", 24 | "BMC Bioinformatics, 9:504 (2008)")) 25 | 26 | citEntry(entry="article", 27 | author="H. Paul Benton, Elizabeth J. Want and Timothy M. D. Ebbels", 28 | title="Correction of mass calibration gaps in liquid chromatography-mass spectrometry metabolomics data", 29 | journal="BIOINFORMATICS", 30 | year="2010", 31 | volume="26", 32 | pages="2488", 33 | textVersion = paste("H. Paul Benton, Elizabeth J. Want and Timothy M. D. Ebbels", 34 | "Correction of mass calibration gaps in liquid chromatography-mass spectrometry metabolomics data", 35 | "Bioinformatics, 26:2488 (2010)")) 36 | 37 | citFooter(paste("Some functions (e.g. group.mzClust, findPeaks.MSW() or retcor.obiwarp() use 3rd", 38 | "party algorithms, see manpages and related packages", 39 | "for respective citations.")) 40 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/logo.png -------------------------------------------------------------------------------- /longtests/testthat/test_do_groupChromPeaks-functions.R: -------------------------------------------------------------------------------- 1 | test_that("do_groupPeaks_mzClust works", { 2 | fts <- peaks(fticr_xs) 3 | res <- do_groupPeaks_mzClust(peaks = fts, 4 | sampleGroups = sampclass(fticr_xs)) 5 | res_2 <- do_groupPeaks_mzClust(peaks = fts, 6 | sampleGroups = sampclass(fticr_xs), 7 | minFraction = 0, absMz = 2) 8 | expect_true(nrow(res$featureDefinitions) > nrow(res_2$featureDefinitions)) 9 | 10 | res_x <- group(fticr_xs, method = "mzClust") 11 | expect_equal(res_x@groups, res$featureDefinitions) 12 | expect_equal(res_x@groupidx, res$peakIndex) 13 | }) 14 | 15 | test_that("do_groupChromPeaks_nearest works", { 16 | xs <- faahko_xs 17 | features <- peaks(xs) 18 | sampleGroups <- sampclass(xs) 19 | mzVsRtBalance <- 10 20 | mzCheck <- 0.2 21 | rtCheck <- 15 22 | kNN <- 10 23 | 24 | res <- do_groupChromPeaks_nearest(features, sampleGroups) 25 | res_2 <- do_groupChromPeaks_nearest(features, sampleGroups, absRt = 3) 26 | expect_true(nrow(res$featureDefinitions) < nrow(res_2$featureDefinitions)) 27 | res_x <- group(xs, method = "nearest") 28 | expect_equal(res_x@groups, res$featureDefinitions) 29 | }) 30 | -------------------------------------------------------------------------------- /longtests/testthat/test_functions-OnDiskMSnExp.R: -------------------------------------------------------------------------------- 1 | test_that(".obiwarp works", { 2 | 3 | xs <- faahko_xs 4 | od <- faahko_od 5 | xod <- faahko_xod 6 | ## Feature alignment on those: 7 | ## object <- findChromPeaks(faahko_od, param = CentWaveParam(noise = 10000, 8 | ## snthresh = 40)) 9 | prm <- ObiwarpParam(binSize = 1) 10 | xs_2 <- retcor.obiwarp(xs, profStep = binSize(prm)) 11 | expect_equal(xs_2@rt$raw[[2]], xs_2@rt$corrected[[2]]) 12 | expect_true(sum(xs_2@rt$raw[[1]] != xs_2@rt$corrected[[1]]) > 500) 13 | expect_true(sum(xs_2@rt$raw[[3]] != xs_2@rt$corrected[[3]]) > 500) 14 | 15 | ## Manually specify center Sample 16 | centerSample(prm) <- 3 17 | xs_2 <- retcor.obiwarp(xs, profStep = binSize(prm), center = centerSample(prm)) 18 | expect_equal(xs_2@rt$raw[[centerSample(prm)]], 19 | xs_2@rt$corrected[[centerSample(prm)]]) 20 | res <- .obiwarp(od, param = prm) 21 | expect_equal(res[[3]], unname(rtime(xod, bySample = TRUE)[[3]])) 22 | expect_equal(xs_2@rt$corrected, res) 23 | ## change some settings 24 | gapInit(prm) <- 3.1 25 | gapExtend(prm) <- 0.9 26 | xs_2 <- retcor.obiwarp(xs, profStep = binSize(prm), gapInit = gapInit(prm), 27 | center = centerSample(prm), gapExtend = gapExtend(prm)) 28 | expect_equal(xs_2@rt$raw[[centerSample(prm)]], 29 | xs_2@rt$corrected[[centerSample(prm)]]) 30 | res <- .obiwarp(od, param = prm) 31 | expect_equal(xs_2@rt$corrected, res) 32 | }) 33 | -------------------------------------------------------------------------------- /longtests/testthat/test_old_BiocParallel.R: -------------------------------------------------------------------------------- 1 | test_that("BiocParallel works with xcmsSet", { 2 | fs <- c(system.file('cdf/KO/ko15.CDF', package = "faahKO"), 3 | system.file('cdf/KO/ko19.CDF', package = "faahKO")) 4 | 5 | ## Default. 6 | bpp <- bpparam() 7 | ## bpprogressbar(bpp) <- TRUE 8 | xs2 <- xcmsSet(fs, BPPARAM=bpp, method = "centWave", noise = 10000, 9 | snthresh = 50, profparam = list(profstep = 0)) 10 | expect_equal(filepaths(xs2), fs) 11 | bpp <- SerialParam() 12 | xs3 <- xcmsSet(fs, BPPARAM=bpp, method = "centWave", noise = 10000, 13 | snthresh = 50, profparam = list(profstep = 0)) 14 | expect_equal(filepaths(xs3), fs) 15 | ## Drop the processHistory 16 | xs2@.processHistory <- list() 17 | xs3@.processHistory <- list() 18 | expect_equal(xs2, xs3) 19 | }) 20 | -------------------------------------------------------------------------------- /longtests/testthat/test_old_functions-IO.R: -------------------------------------------------------------------------------- 1 | test_that("readRawData works", { 2 | cdf_file <- system.file('cdf/KO/ko15.CDF', package = "faahKO") 3 | 4 | ## loadRaw 5 | lr_res <- loadRaw(xcmsSource(cdf_file)) 6 | rr_res <- readRawData(cdf_file) 7 | expect_equal(lr_res, rr_res[names(lr_res)]) 8 | 9 | mz_file <- system.file("microtofq/MM8.mzML", package = "msdata") 10 | lr_res <- loadRaw(xcmsSource(mz_file)) 11 | rr_res <- readRawData(mz_file) 12 | expect_equal(lr_res, rr_res[names(lr_res)]) 13 | 14 | ## Check readRawData with and without dropEmptyScans: 15 | msnfile <- system.file("microtofq/MSMSpos20_6.mzML", package = "msdata") 16 | res <- loadRaw(xcmsSource(msnfile), includeMSn = TRUE) 17 | res_2 <- readRawData(msnfile, includeMSn = TRUE) 18 | expect_equal(res, res_2) 19 | res_2 <- readRawData(msnfile, includeMSn = TRUE, 20 | dropEmptyScans = FALSE) 21 | ## Now I expect to have more data: 22 | expect_true(length(res_2$MSn$precursorIntensity) > 23 | length(res$MSn$precursorIntensity)) 24 | expect_true(length(res_2$MSn$precursorIntensity) == 1612) 25 | expect_true(length(res$MSn$precursorIntensity) == 1121) 26 | ## Now, the difference is supposed to represent spectra without peaks: 27 | empties <- res_2$MSn$peaksCount == 0 28 | expect_true(sum(empties) == (1612 - 1121)) 29 | 30 | ## ## Check also MSn level import. Note: this can not be run automatically 31 | ## ## because the mzML file is gzipped; xcmsSource does not support gz 32 | ## ## input! The test was performed by manually unzipping the file and 33 | ## ## running on the mzML file. 34 | ## msn <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia") 35 | ## lr_res <- loadRaw(xcmsSource(msn)) ## Can not read .gz files!!! 36 | ## rr_res <- xcms:::readRawData(msn) 37 | ## expect_equal(lr_res, rr_res[names(lr_res)]) 38 | ## ## Include MSn 39 | ## lr_res <- loadRaw(xcmsSource(msn), includeMSn = TRUE) 40 | ## rr_res <- xcms:::readRawData(msn, includeMSn = TRUE) 41 | ## expect_equal(lr_res, rr_res[names(lr_res)]) 42 | ## ## Rocks! 43 | }) 44 | -------------------------------------------------------------------------------- /longtests/testthat/test_old_methods-IO.R: -------------------------------------------------------------------------------- 1 | test_that("write.cdf,xcmsRaw works", { 2 | file <- system.file('cdf/KO/ko15.CDF', package = "faahKO") 3 | xraw <- xcmsRaw(file, profstep = 0) 4 | cdffile <- paste(tempdir(), "ko15.cdf", sep="/") 5 | write.cdf(xraw, cdffile) 6 | xrawCopy <- xcmsRaw(cdffile) 7 | expect_true(all(xraw@env$mz == xrawCopy@env$mz)) 8 | expect_true(all(xraw@env$intensity == xrawCopy@env$intensity)) 9 | }) 10 | 11 | test_that("write.mzQuantML,xcmsSet works", { 12 | xsg <- group(faahko) 13 | mzqFile <- paste(tempdir(), "faahKO.mzq.xml", sep="/") 14 | write.mzQuantML(xsg, mzqFile) 15 | v <- verify.mzQuantML(filename=mzqFile) 16 | expect_true(v$status == "0") 17 | }) 18 | 19 | -------------------------------------------------------------------------------- /longtests/testthat/test_old_xcmsSource.R: -------------------------------------------------------------------------------- 1 | test_that("xcmsSource works", { 2 | mz_file <- system.file("microtofq/MM8.mzML", package = "msdata") 3 | src <- xcms:::xcmsSource(mz_file) 4 | expect_true(is(src, "xcmsFileSource")) 5 | tmp <- loadRaw(src) 6 | expect_equal(names(tmp), c("rt", "acquisitionNum", "tic", "scanindex", 7 | "mz", "intensity", "polarity")) 8 | 9 | cdf_file <- system.file('cdf/KO/ko15.CDF', package = "faahKO") 10 | src <- xcms:::xcmsSource(cdf_file) 11 | expect_true(is(src, "xcmsFileSource")) 12 | tmp <- loadRaw(src) 13 | expect_equal(names(tmp), c("rt", "acquisitionNum", "tic", "scanindex", 14 | "mz", "intensity", "polarity")) 15 | 16 | ## MSn: 17 | mzmlpath <- system.file("iontrap", package = "msdata") 18 | mzmlfiles <- list.files(mzmlpath, pattern="extracted.mzML", 19 | recursive = TRUE, full.names = TRUE) 20 | src <- xcms:::xcmsSource(mzmlfiles[1]) 21 | tmp <- loadRaw(src, includeMSn = TRUE) 22 | 23 | }) 24 | -------------------------------------------------------------------------------- /longtests/testthat/test_specDist.R: -------------------------------------------------------------------------------- 1 | test_that("specDist works", { 2 | data(faahko, package="faahKO") 3 | dist1 <- specDist(faahko, which(faahko@peaks[,"sample"] == 1), 4 | which(faahko@peaks[,"sample"] == 2), 5 | method = "meanMZmatch") 6 | dist2 <- specDist(faahko, which(faahko@peaks[,"sample"] == 3), 7 | which(faahko@peaks[,"sample"] == 4), 8 | method = "cosine") 9 | dist3 <- specDist(faahko, which(faahko@peaks[,"sample"] == 5), 10 | which(faahko@peaks[,"sample"] == 6), 11 | method = "peakCount") 12 | expect_equal(round(dist1, 3), 3.159) 13 | expect_equal(round(dist2, 3), 3.183) 14 | expect_equal(dist3, 129) 15 | }) 16 | 17 | -------------------------------------------------------------------------------- /man/AutoLockMass-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{AutoLockMass-methods} 2 | \docType{methods} 3 | \alias{AutoLockMass} 4 | \alias{AutoLockMass-methods} 5 | \alias{AutoLockMass,xcmsRaw-method} 6 | \title{ Automatic parameter for Lock mass fixing \code{AutoLockMass} ~~} 7 | \description{ 8 | \code{AutoLockMass} - This function decides where the lock mass scans are 9 | in the xcmsRaw object. This is done by using the scan time differences. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{signature(object = "xcmsRaw")}} 15 | } 16 | } 17 | \arguments{ 18 | \item{object}{An \code{\link{xcmsRaw-class}} object} 19 | } 20 | 21 | \value{ 22 | \code{AutoLockMass} A numeric vector of scan locations corresponding to lock Mass scans 23 | } 24 | \author{Paul Benton, \email{hpaul.benton08@imperial.ac.uk}} 25 | \examples{ 26 | \dontrun{library(xcms) 27 | library(faahKO) 28 | ## These files do not have this problem 29 | ## to correct for but just for an example 30 | cdfpath <- system.file("cdf", package = "faahKO") 31 | cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE) 32 | xr<-xcmsRaw(cdffiles[1]) 33 | xr 34 | ##Lets assume that the lockmass starts at 1 and is every 100 scans 35 | lockMass<-xcms:::makeacqNum(xr, freq=100, start=1) 36 | ## these are equalvent 37 | lockmass2<-AutoLockMass(xr) 38 | all((lockmass == lockmass2) == TRUE) 39 | 40 | ob<-stitch(xr, lockMass) 41 | } 42 | } 43 | 44 | \keyword{methods} 45 | \keyword{manip} 46 | \keyword{lockmass} 47 | -------------------------------------------------------------------------------- /man/GenericParam.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DataClasses.R, R/functions-Params.R 3 | \docType{class} 4 | \name{GenericParam-class} 5 | \alias{GenericParam-class} 6 | \alias{GenericParam} 7 | \alias{Param} 8 | \title{Generic parameter class} 9 | \usage{ 10 | GenericParam(fun = character(), args = list()) 11 | } 12 | \arguments{ 13 | \item{fun}{\code{character} representing the name of the function.} 14 | 15 | \item{args}{\code{list} (ideally named) with the arguments to the function.} 16 | } 17 | \value{ 18 | The \code{GenericParam()} function returns a \code{GenericParam} 19 | object. 20 | } 21 | \description{ 22 | The \code{GenericParam} class allows to store generic parameter 23 | information such as the name of the function that was/has to be called 24 | (slot \code{fun}) and its arguments (slot \code{args}). This object is 25 | used to track the process history of the data processings of an 26 | \link{XCMSnExp} object. This is in contrast to e.g. the 27 | \code{\link[=CentWaveParam]{CentWaveParam()}} object that is passed to the actual 28 | processing method. 29 | } 30 | \section{Slots}{ 31 | 32 | \describe{ 33 | \item{\code{fun}}{\code{character} specifying the function name.} 34 | 35 | \item{\code{args}}{\code{list} (ideally named) with the arguments to the 36 | function.} 37 | }} 38 | 39 | \examples{ 40 | prm <- GenericParam(fun = "mean") 41 | 42 | prm <- GenericParam(fun = "mean", args = list(na.rm = TRUE)) 43 | } 44 | \seealso{ 45 | \code{\link[=processHistory]{processHistory()}} for how to access the process history 46 | of an \link{XCMSnExp} object. 47 | } 48 | \author{ 49 | Johannes Rainer 50 | } 51 | -------------------------------------------------------------------------------- /man/SSgauss.Rd: -------------------------------------------------------------------------------- 1 | \name{SSgauss} 2 | \alias{SSgauss} 3 | \title{Gaussian Model} 4 | \description{ 5 | This \code{selfStart} model evalueates the Gaussian model and its 6 | gradient. It has an \code{initial} attribute that will evalueate 7 | the inital estimates of the parameters \code{mu}, \code{sigma}, 8 | and \code{h}. 9 | } 10 | \usage{ 11 | SSgauss(x, mu, sigma, h) 12 | } 13 | \arguments{ 14 | \item{x}{a numeric vector of values at which to evaluate the model} 15 | \item{mu}{mean of the distribution function} 16 | \item{sigma}{standard deviation of the distribution fuction} 17 | \item{h}{height of the distribution function} 18 | } 19 | \details{ 20 | Initial values for \code{mu} and \code{h} are chosen from the 21 | maximal value of \code{x}. The initial value for \code{sigma} is 22 | determined from the area under \code{x} divided by \code{h*sqrt(2*pi)}. 23 | } 24 | \value{ 25 | A numeric vector of the same length as \code{x}. It is the value 26 | of the expression \code{h*exp(-(x-mu)^2/(2*sigma^2)}, which is a 27 | modified gaussian function where the maximum height is treated 28 | as a separate parameter not dependent on \code{sigma}. If arguments 29 | \code{mu}, \code{sigma}, and \code{h} are names of objects, the 30 | gradient matrix with respect to these names is attached as an 31 | attribute named \code{gradient}. 32 | } 33 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 34 | \seealso{ 35 | \code{\link{nls}}, 36 | \code{\link{selfStart}} 37 | } 38 | \keyword{nonlinear} 39 | -------------------------------------------------------------------------------- /man/absent-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{absent-methods} 2 | \docType{methods} 3 | \alias{absent} 4 | \alias{absent,xcmsSet-method} 5 | \alias{present} 6 | \alias{present,xcmsSet-method} 7 | \title{Determine which peaks are absent / present in a sample class} 8 | \description{ 9 | Determine which peaks are absent / present in a sample class 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{ 15 | absent(object, ...) 16 | present(object, ...) 17 | } 18 | } 19 | }} 20 | \arguments{ 21 | \item{object}{\code{\link{xcmsSet-class}} object} 22 | \item{class}{Name of a sample class from \code{\link{sampclass}}} 23 | \item{minfrac}{ 24 | minimum fraction of samples necessary in the class to be absent/present 25 | } 26 | } 27 | \details{ 28 | Determine which peaks are absent / present in a sample class 29 | The functions treat peaks that are only present because 30 | of \code{\link{fillPeaks}} correctly, i.e. does not count them as present. 31 | } 32 | 33 | \value{ 34 | An logical vector with the same length as \code{nrow(groups(object))}. 35 | } 36 | \seealso{ 37 | \code{\link{group}} 38 | \code{\link{diffreport}} 39 | } 40 | \keyword{methods} 41 | -------------------------------------------------------------------------------- /man/applyAdjustedRtime.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-XCMSnExp.R 3 | \name{applyAdjustedRtime} 4 | \alias{applyAdjustedRtime} 5 | \title{Replace raw with adjusted retention times} 6 | \usage{ 7 | applyAdjustedRtime(object) 8 | } 9 | \arguments{ 10 | \item{object}{An \link{XCMSnExp} or \link{XcmsExperiment} object.} 11 | } 12 | \value{ 13 | An \code{XCMSnExp} or \code{XcmsExperiment} object with the raw (original) retention 14 | times being replaced with the adjusted retention time. 15 | } 16 | \description{ 17 | Replaces the raw retention times with the adjusted retention 18 | time or returns the object unchanged if none are present. 19 | } 20 | \details{ 21 | Adjusted retention times are stored \emph{in parallel} to the adjusted 22 | retention times in \code{XCMSnExp} or \code{XcmsExperiment} objects. The 23 | \code{applyAdjustedRtime} replaces the raw (original) retention times with the 24 | adjusted retention times. 25 | } 26 | \note{ 27 | Replacing the raw retention times with adjusted retention times 28 | disables the possibility to restore raw retention times using the 29 | \code{\link[=dropAdjustedRtime]{dropAdjustedRtime()}} method. This function does \strong{not} remove the 30 | retention time processing step with the settings of the alignment from 31 | the \code{\link[=processHistory]{processHistory()}} of the \code{object} to ensure that the processing 32 | history is preserved. 33 | } 34 | \examples{ 35 | 36 | ## Load a test data set with detected peaks 37 | library(MSnbase) 38 | data(faahko_sub) 39 | ## Update the path to the files for the local system 40 | dirname(faahko_sub) <- system.file("cdf/KO", package = "faahKO") 41 | 42 | ## Disable parallel processing for this example 43 | register(SerialParam()) 44 | 45 | xod <- adjustRtime(faahko_sub, param = ObiwarpParam()) 46 | 47 | hasAdjustedRtime(xod) 48 | 49 | ## Replace raw retention times with adjusted retention times. 50 | xod <- applyAdjustedRtime(xod) 51 | 52 | ## No adjusted retention times present 53 | hasAdjustedRtime(xod) 54 | 55 | ## Raw retention times have been replaced with adjusted retention times 56 | plot(split(rtime(faahko_sub), fromFile(faahko_sub))[[1]] - 57 | split(rtime(xod), fromFile(xod))[[1]], type = "l") 58 | 59 | ## And the process history still contains the settings for the alignment 60 | processHistory(xod) 61 | } 62 | \seealso{ 63 | \code{\link[=adjustRtime]{adjustRtime()}} for the function to perform the alignment (retention 64 | time correction). 65 | 66 | \if{html}{\out{
}}\preformatted{[adjustedRtime()] for the method to extract adjusted retention times from 67 | an [XCMSnExp] object. 68 | 69 | [dropAdjustedRtime] for the method to delete alignment results and to 70 | restore the raw retention times. 71 | }\if{html}{\out{
}} 72 | } 73 | \author{ 74 | Johannes Rainer 75 | } 76 | -------------------------------------------------------------------------------- /man/breaks_on_binSize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-binning.R 3 | \name{breaks_on_binSize} 4 | \alias{breaks_on_binSize} 5 | \title{Generate breaks for binning using a defined bin size.} 6 | \usage{ 7 | breaks_on_binSize(fromX, toX, binSize) 8 | } 9 | \arguments{ 10 | \item{fromX}{\code{numeric(1)} specifying the lowest value for the bins.} 11 | 12 | \item{toX}{\code{numeric(1)} specifying the largest value for the bins.} 13 | 14 | \item{binSize}{\code{numeric(1)} defining the size of a bin.} 15 | } 16 | \value{ 17 | A numeric vector defining the lower and upper bounds of the bins. 18 | } 19 | \description{ 20 | Defines breaks for \code{binSize} sized bins for values ranging 21 | from \code{fromX} to \code{toX}. 22 | } 23 | \details{ 24 | This function creates breaks for bins of size \code{binSize}. The 25 | function ensures that the full data range is included in the bins, i.e. the 26 | last value (upper boundary of the last bin) is always equal \code{toX}. This 27 | however means that the size of the last bin will not always be equal to the 28 | desired bin size. 29 | 30 | See examples for more details and a comparisom to R's \code{seq()} function. 31 | } 32 | \examples{ 33 | ## Define breaks with a size of 0.13 for a data range from 1 to 10: 34 | breaks_on_binSize(1, 10, 0.13) 35 | ## The size of the last bin is however larger than 0.13: 36 | diff(breaks_on_binSize(1, 10, 0.13)) 37 | ## If we would use seq, the max value would not be included: 38 | seq(1, 10, by = 0.13) 39 | 40 | ## In the next example we use binSize that leads to an additional last bin with 41 | ## a smaller binSize: 42 | breaks_on_binSize(1, 10, 0.51) 43 | ## Again, the max value is included, but the size of the last bin is < 0.51. 44 | diff(breaks_on_binSize(1, 10, 0.51)) 45 | ## Using just seq would result in the following bin definition: 46 | seq(1, 10, by = 0.51) 47 | ## Thus it defines one bin (break) less. 48 | } 49 | \seealso{ 50 | \code{\link[=binYonX]{binYonX()}} for a binning function. 51 | 52 | Other functions to define bins: 53 | \code{\link{breaks_on_nBins}()} 54 | } 55 | \author{ 56 | Johannes Rainer 57 | } 58 | \concept{functions to define bins} 59 | -------------------------------------------------------------------------------- /man/breaks_on_nBins.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-binning.R 3 | \name{breaks_on_nBins} 4 | \alias{breaks_on_nBins} 5 | \title{Generate breaks for binning} 6 | \usage{ 7 | breaks_on_nBins(fromX, toX, nBins, shiftByHalfBinSize = FALSE) 8 | } 9 | \arguments{ 10 | \item{fromX}{\code{numeric(1)} specifying the lowest value for the bins.} 11 | 12 | \item{toX}{\code{numeric(1)} specifying the largest value for the bins.} 13 | 14 | \item{nBins}{\code{numeric(1)} defining the number of bins.} 15 | 16 | \item{shiftByHalfBinSize}{Logical indicating whether the bins should be 17 | shifted left by half bin size. This results centered bins, i.e. the 18 | first bin being centered at \code{fromX} and the last around \code{toX}.} 19 | } 20 | \value{ 21 | A numeric vector of length \code{nBins + 1} defining the lower and 22 | upper bounds of the bins. 23 | } 24 | \description{ 25 | Calculate breaks for same-sized bins for data values 26 | from \code{fromX} to \code{toX}. 27 | } 28 | \details{ 29 | This generates bins such as a call to 30 | \code{seq(fromX, toX, length.out = nBins)} would. The first and second element 31 | in the result vector thus defines the lower and upper boundary for the first 32 | bin, the second and third value for the second bin and so on. 33 | } 34 | \examples{ 35 | ## Create breaks to bin values from 3 to 20 into 20 bins 36 | breaks_on_nBins(3, 20, nBins = 20) 37 | ## The same call but using shiftByHalfBinSize 38 | breaks_on_nBins(3, 20, nBins = 20, shiftByHalfBinSize = TRUE) 39 | } 40 | \seealso{ 41 | \code{\link[=binYonX]{binYonX()}} for a binning function. 42 | 43 | Other functions to define bins: 44 | \code{\link{breaks_on_binSize}()} 45 | } 46 | \author{ 47 | Johannes Rainer 48 | } 49 | \concept{functions to define bins} 50 | -------------------------------------------------------------------------------- /man/c.xcmsSet.Rd: -------------------------------------------------------------------------------- 1 | \name{c-methods} 2 | \docType{methods} 3 | \alias{c.xcmsSet} 4 | \alias{c, c-methods} 5 | \title{Combine xcmsSet objects} 6 | \description{ 7 | Combines the samples and peaks from multiple \code{xcmsSet} objects 8 | into a single object. Group and retention time correction data 9 | are discarded. The \code{profinfo} list is set to be equal to the 10 | first object. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{xs1 = "xcmsRaw"}{ 15 | \code{ 16 | c(xs1, ...) 17 | } 18 | } 19 | }} 20 | \arguments{ 21 | \item{xs1}{\code{xcmsSet} object} 22 | \item{\dots}{\code{xcmsSet} objects} 23 | } 24 | \value{ 25 | A \code{xcmsSet} object. 26 | } 27 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 28 | \seealso{ 29 | \code{\link{xcmsSet-class}} 30 | } 31 | \keyword{manip} 32 | -------------------------------------------------------------------------------- /man/calibrate.Rd: -------------------------------------------------------------------------------- 1 | \name{calibrate-methods} 2 | \docType{methods} 3 | \alias{calibrate} 4 | \alias{calibrate,xcmsSet-method} 5 | \title{Calibrate peaks for correcting unprecise m/z values} 6 | \description{ 7 | Calibrate peaks of a xcmsSet via a set of known masses 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsSet"}{ 12 | \code{ 13 | calibrate(object, calibrants,method="linear", 14 | mzabs=0.0001, mzppm=5, 15 | neighbours=3, plotres=FALSE) 16 | } 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{a \code{xcmsSet} object with uncalibrated mz} 21 | \item{calibrants}{a vector or a list of vectors with reference m/z-values} 22 | \item{method}{the used calibrating-method, see below} 23 | \item{mzppm}{the relative error used for matching peaks in ppm (parts per million)} 24 | \item{mzabs}{the absolute error used for matching peaks in Da} 25 | \item{neighbours}{the number of neighbours from wich the one with the highest intensity is used (instead of the nearest)} 26 | \item{plotres}{can be set to TRUE if wanted a result-plot showing the found m/z with the distances and the regression} 27 | } 28 | \value{ 29 | \item{object}{a \code{xcmsSet} with one ore more samples} 30 | \item{calibrants}{for each sample different calibrants can be used, if a list of m/z-vectors is given. The length of the list must be the same as the number of samples, alternatively a single vector of masses can be given which is used for all samples.} 31 | \item{method}{ "shift" for shifting each m/z, "linear" does a linear regression and adds a linear term to each m/z. "edgeshift" does a linear regression within the range of the mz-calibrants and a shift outside.} 32 | } 33 | \seealso{ 34 | \code{\link{xcmsSet-class}}, 35 | } 36 | \keyword{methods} 37 | \keyword{file} 38 | -------------------------------------------------------------------------------- /man/colMax.Rd: -------------------------------------------------------------------------------- 1 | \name{colMax} 2 | \alias{colMax} 3 | \alias{rowMax} 4 | \alias{which.colMax} 5 | \alias{which.rowMax} 6 | \title{Find row and column maximum values} 7 | \description{ 8 | Find row and column maximum values for numeric arrays. 9 | } 10 | \usage{ 11 | colMax(x, na.rm = FALSE, dims = 1) 12 | rowMax(x, na.rm = FALSE, dims = 1) 13 | which.colMax(x, na.rm = FALSE, dims = 1) 14 | which.rowMax(x, na.rm = FALSE, dims = 1) 15 | } 16 | \arguments{ 17 | \item{x}{ 18 | an array of two or more dimensions, containing numeric values 19 | } 20 | \item{na.rm}{ 21 | logical. Should missing values (including 'NaN') be omitted 22 | from the calculations? (not currently implemented) 23 | } 24 | \item{dims}{ 25 | Which dimensions are regarded as "rows" or "columns" to maximize. 26 | For \code{rowMax}, the maximum is over dimensions \code{dims+1, 27 | ...}; for \code{colMax} it is over dimensions \code{1:dims}. 28 | } 29 | } 30 | \details{ 31 | These functions are designed to act like the \code{colSums} series 32 | of functions except that they only currently handle real arrays 33 | and will not remove \code{NA} values. 34 | } 35 | \value{ 36 | A numeric array of suitable size, or a vector if the result is 37 | one-dimensional. The \code{dimnames} (or \code{names} for a 38 | vector result) are taken from the original array. 39 | 40 | For the \code{which.*} functions, an integer array of suitable 41 | size, or a vector if the result is one-dimensional. The indecies 42 | returned are for accessing \code{x} one-dimensionally (i.e. 43 | \code{x[index]}). For \code{which.colMax()}, the actual row 44 | indecies my be determined using \code{(which.colMax(x)-1) \%\% 45 | nrow(x) + 1}. For \code{which.rowMax()}, the actual column indecies 46 | may be determined using \code{ceiling(rowMax(x)/nrow(x))}. 47 | } 48 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 49 | \seealso{ 50 | \code{\link{colSums}} 51 | } 52 | \keyword{array} 53 | \keyword{manip} 54 | \keyword{internal} 55 | -------------------------------------------------------------------------------- /man/collect-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{collect-methods} 2 | \docType{methods} 3 | \alias{collect-methods} 4 | \alias{collect} 5 | \alias{collect,xcmsRaw-method} 6 | \alias{collect,xcmsFragments-method} 7 | \title{Collect MS^n peaks into xcmsFragments} 8 | \description{ 9 | Collecting Peaks into \code{\linkS4class{xcmsFragments}}s from several 10 | MS-runs using \code{\linkS4class{xcmsSet}} and 11 | \code{\linkS4class{xcmsRaw}}. 12 | } 13 | \section{Methods}{ 14 | \describe{ 15 | \item{object = "xcmsFragments"}{ 16 | \code{ 17 | collect(object, ...) 18 | } 19 | } 20 | }} 21 | \arguments{ 22 | \item{object}{(empty) \code{\link{xcmsFragments-class}} object} 23 | \item{xs}{A \code{\link{xcmsSet-class}} object which contains 24 | picked ms1-peaks from several experiments} 25 | \item{compMethod}{("floor", "round", "none"): compare-method which is 26 | used to find the parent peak of a MSnpeak through comparing the 27 | MZ-values of the MS1peaks with the MSnParentPeaks.} 28 | \item{snthresh, mzgap, uniq}{these are the parameters for the 29 | getspec-peakpicker included in xcmsRaw.} 30 | } 31 | \details{ 32 | After running collect(xFragments,xSet) The peak table of the 33 | xcmsFragments includes the ms1Peaks from all experiments stored in a 34 | xcmsSet-object. Further it contains the relevant msN-peaks from the 35 | xcmsRaw-objects, which were created temporarily with the paths in 36 | xcmsSet. 37 | } 38 | 39 | \value{ 40 | A matrix with columns: 41 | \item{peakID}{ 42 | unique identifier of every peak 43 | } 44 | \item{MSnParentPeakID}{ 45 | PeakID of the parent peak of a msLevel>1 - peak, it is 0 if the peak is msLevel 1. 46 | } 47 | \item{msLevel}{ 48 | The msLevel of the peak. 49 | } 50 | \item{rt}{ 51 | retention time of the peak midpoint 52 | } 53 | \item{mz}{ 54 | the mz-Value of the peak 55 | } 56 | \item{intensity}{ 57 | the intensity of the peak 58 | } 59 | \item{sample}{ 60 | the number of the sample from the xcmsSet 61 | } 62 | \item{GroupPeakMSn}{Used for grouped xcmsSet groups} 63 | \item{CollisionEnergy}{The collision energy of the fragment} 64 | } 65 | \keyword{methods} 66 | -------------------------------------------------------------------------------- /man/descendZero.Rd: -------------------------------------------------------------------------------- 1 | \name{descendZero} 2 | \alias{descendZero} 3 | \alias{descendMin} 4 | \alias{descendValue} 5 | \title{Find start and end points of a peak} 6 | \description{ 7 | Decends down the sides of a data peak and finds either the points 8 | greater than or equal to the zero intercept, the intercept with 9 | a given value, or the bottom of the first valley on each side. 10 | } 11 | \usage{ 12 | descendZero(y, istart = which.max(y)) 13 | descendValue(y, value, istart = which.max(y)) 14 | descendMin(y, istart = which.max(y)) 15 | } 16 | \arguments{ 17 | \item{y}{numeric vector with values} 18 | \item{istart}{starting point for descent} 19 | \item{value}{numeric value to descend to} 20 | } 21 | \value{ 22 | An integer vector of length 2 with the starting and ending indicies 23 | of the peak start and end points. 24 | } 25 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 26 | \seealso{ 27 | \code{\link{descendValue}} 28 | } 29 | \examples{ 30 | normdist <- dnorm(seq(-4, 4, .1)) - .1 31 | xcms:::descendZero(normdist) 32 | normdist[xcms:::descendZero(normdist)] 33 | xcms:::descendValue(normdist, .15) 34 | normdist[xcms:::descendValue(normdist, .15)] 35 | xcms:::descendMin(normdist) 36 | } 37 | \keyword{iteration} 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/dirname.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-OnDiskMSnExp.R 3 | \name{dirname} 4 | \alias{dirname} 5 | \alias{dirname,OnDiskMSnExp-method} 6 | \alias{dirname<-,OnDiskMSnExp-method} 7 | \title{Change the file path of an \code{OnDiskMSnExp} object} 8 | \usage{ 9 | \S4method{dirname}{OnDiskMSnExp}(path) 10 | 11 | \S4method{dirname}{OnDiskMSnExp}(path) <- value 12 | } 13 | \arguments{ 14 | \item{path}{\code{OnDiskMSnExp}.} 15 | 16 | \item{value}{\code{character} of length 1 or length equal to the number of files 17 | defining the new path to the files.} 18 | } 19 | \description{ 20 | \code{dirname} allows to get and set the path to the directory containing the 21 | source files of the \code{OnDiskMSnExp} (or \linkS4class{XCMSnExp}) object. 22 | } 23 | \author{ 24 | Johannes Rainer 25 | } 26 | -------------------------------------------------------------------------------- /man/do_findPeaks_MSW.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/do_findChromPeaks-functions.R 3 | \name{do_findPeaks_MSW} 4 | \alias{do_findPeaks_MSW} 5 | \title{Core API function for single-spectrum non-chromatography MS data 6 | peak detection} 7 | \usage{ 8 | do_findPeaks_MSW( 9 | mz, 10 | int, 11 | snthresh = 3, 12 | verboseColumns = FALSE, 13 | scantime = numeric(), 14 | valsPerSpect = integer(), 15 | ... 16 | ) 17 | } 18 | \arguments{ 19 | \item{mz}{Numeric vector with the individual m/z values from all scans/ 20 | spectra of one file/sample.} 21 | 22 | \item{int}{Numeric vector with the individual intensity values from all 23 | scans/spectra of one file/sample.} 24 | 25 | \item{snthresh}{\code{numeric(1)} defining the signal to noise ratio cutoff.} 26 | 27 | \item{verboseColumns}{\code{logical(1)} whether additional peak meta data 28 | columns should be returned.} 29 | 30 | \item{scantime}{ignored.} 31 | 32 | \item{valsPerSpect}{ignored.} 33 | 34 | \item{...}{Additional parameters to be passed to the 35 | \code{peakDetectionCWT} function.} 36 | } 37 | \value{ 38 | A matrix, each row representing an identified peak, with columns: 39 | \itemize{ 40 | \item \code{"mz"}: m/z value of the peak at the centroid position. 41 | \item \code{"mzmin"}: Minimum m/z of the peak. 42 | \item \code{"mzmax"}: Maximum m/z of the peak. 43 | \item \code{"rt"}: Always \code{-1}. 44 | \item \code{"rtmin"}: Always \code{-1}. 45 | \item \code{"rtmax"}: Always \code{-1}. 46 | \item \code{"into"}: Integrated (original) intensity of the peak. 47 | \item \code{"maxo"}: Maximum intensity of the peak. 48 | \item \code{"intf"}: Always \code{NA}. 49 | \item \code{"maxf"}: Maximum MSW-filter response of the peak. 50 | \item \code{"sn"}: Signal to noise ratio. 51 | } 52 | } 53 | \description{ 54 | This function performs peak detection in mass spectrometry 55 | direct injection spectrum using a wavelet based algorithm. 56 | } 57 | \details{ 58 | This is a wrapper around the peak picker in Bioconductor's 59 | \emph{MassSpecWavelet} package calling 60 | \code{peakDetectionCWT()} and \code{tuneInPeakInfo()} functions. See the 61 | \emph{xcmsDirect} vignette for more information. 62 | } 63 | \seealso{ 64 | Other core peak detection functions: 65 | \code{\link{do_findChromPeaks_centWave}()}, 66 | \code{\link{do_findChromPeaks_centWaveWithPredIsoROIs}()}, 67 | \code{\link{do_findChromPeaks_massifquant}()}, 68 | \code{\link{do_findChromPeaks_matchedFilter}()} 69 | } 70 | \author{ 71 | Joachim Kutzera, Steffen Neumann, Johannes Rainer 72 | } 73 | \concept{core peak detection functions} 74 | -------------------------------------------------------------------------------- /man/doubleMatrix.Rd: -------------------------------------------------------------------------------- 1 | \name{doubleMatrix} 2 | \alias{doubleMatrix} 3 | \alias{integerMatrix} 4 | \alias{logicalMatrix} 5 | \title{Allocate double, integer, or logical matricies} 6 | \description{ 7 | Allocate double, integer, or logical matricies in one step without 8 | copying memory around. 9 | } 10 | \usage{ 11 | doubleMatrix(nrow = 0, ncol = 0) 12 | integerMatrix(nrow = 0, ncol = 0) 13 | logicalMatrix(nrow = 0, ncol = 0) 14 | } 15 | \arguments{ 16 | \item{nrow}{number of matrix rows} 17 | \item{ncol}{number of matrix columns} 18 | } 19 | \value{ 20 | Matrix of double, integer, or logical values. Memory is not zeroed. 21 | } 22 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 23 | \keyword{programming} 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/estimatePrecursorIntensity.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MsExperiment.R, R/methods-OnDiskMSnExp.R 3 | \name{estimatePrecursorIntensity,MsExperiment-method} 4 | \alias{estimatePrecursorIntensity,MsExperiment-method} 5 | \alias{estimatePrecursorIntensity,OnDiskMSnExp-method} 6 | \title{Estimate precursor intensity for MS level 2 spectra} 7 | \usage{ 8 | \S4method{estimatePrecursorIntensity}{MsExperiment}( 9 | object, 10 | ppm = 10, 11 | tolerance = 0, 12 | method = c("previous", "interpolation"), 13 | BPPARAM = bpparam() 14 | ) 15 | 16 | \S4method{estimatePrecursorIntensity}{OnDiskMSnExp}( 17 | object, 18 | ppm = 10, 19 | tolerance = 0, 20 | method = c("previous", "interpolation"), 21 | BPPARAM = bpparam() 22 | ) 23 | } 24 | \arguments{ 25 | \item{object}{\code{MsExperiment}, \code{XcmsExperiment}, \code{OnDiskMSnExp} or 26 | \code{XCMSnExp} object.} 27 | 28 | \item{ppm}{\code{numeric(1)} defining the maximal acceptable difference (in ppm) 29 | of the precursor m/z and the m/z of the corresponding peak in the MS 1 30 | scan.} 31 | 32 | \item{tolerance}{\code{numeric(1)} with the maximal allowed difference of m/z 33 | values between the precursor m/z of a spectrum and the m/z of the 34 | respective ion on the MS1 scan.} 35 | 36 | \item{method}{\code{character(1)} defining the method how the precursor intensity 37 | should be determined (see description above for details). Defaults to 38 | \code{method = "previous"}.} 39 | 40 | \item{BPPARAM}{parallel processing setup. See \code{\link[BiocParallel:register]{BiocParallel::bpparam()}} for 41 | details.} 42 | } 43 | \value{ 44 | \code{numeric} with length equal to the number of spectra in \code{x}. \code{NA} is 45 | returned for MS 1 spectra or if no matching peak in a MS 1 scan can be 46 | found for an MS 2 spectrum 47 | } 48 | \description{ 49 | \code{estimatePrecursorIntensity()} determines the precursor intensity for a MS 2 50 | spectrum based on the intensity of the respective signal from the 51 | neighboring MS 1 spectra (i.e. based on the peak with the m/z matching the 52 | precursor m/z of the MS 2 spectrum). Based on parameter \code{method} either the 53 | intensity of the peak from the previous MS 1 scan is used 54 | (\code{method = "previous"}) or an interpolation between the intensity from the 55 | previous and subsequent MS1 scan is used (\code{method = "interpolation"}, which 56 | considers also the retention times of the two MS1 scans and the retention 57 | time of the MS2 spectrum). 58 | } 59 | \author{ 60 | Johannes Rainer with feedback and suggestions from Corey Broeckling 61 | } 62 | -------------------------------------------------------------------------------- /man/etg.Rd: -------------------------------------------------------------------------------- 1 | \name{etg} 2 | \alias{etg} 3 | \title{Empirically Transformed Gaussian function} 4 | \description{ 5 | A general function for asymmetric chromatographic peaks. 6 | } 7 | \usage{ 8 | etg(x, H, t1, tt, k1, kt, lambda1, lambdat, alpha, beta) 9 | } 10 | \arguments{ 11 | \item{x}{times to evaluate function at} 12 | \item{H}{peak height} 13 | \item{t1}{time of leading edge inflection point} 14 | \item{tt}{time of trailing edge inflection point} 15 | \item{k1}{leading edge parameter} 16 | \item{kt}{trailing edge parameter} 17 | \item{lambda1}{leading edge parameter} 18 | \item{lambdat}{trailing edge parameter} 19 | \item{alpha}{leading edge parameter} 20 | \item{beta}{trailing edge parameter} 21 | } 22 | \value{ 23 | The function evaluated at times \code{x}. 24 | } 25 | \references{ 26 | Jianwei Li. Development and Evaluation of Flexible Empirical Peak 27 | Functions for Processing Chromatographic Peaks. Anal. Chem., 69 28 | (21), 4452-4462, 1997. 29 | \url{http://dx.doi.org/10.1021/ac970481d} 30 | } 31 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 32 | \keyword{models} 33 | -------------------------------------------------------------------------------- /man/exportMetaboAnalyst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-XCMSnExp.R 3 | \name{exportMetaboAnalyst} 4 | \alias{exportMetaboAnalyst} 5 | \title{Export data for use in MetaboAnalyst} 6 | \usage{ 7 | exportMetaboAnalyst( 8 | x, 9 | file = NULL, 10 | label, 11 | value = "into", 12 | digits = NULL, 13 | groupnames = FALSE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{\link{XCMSnExp} object with identified chromatographic peaks grouped 19 | across samples.} 20 | 21 | \item{file}{\code{character(1)} defining the file name. If not specified, the 22 | \code{matrix} with the content is returned.} 23 | 24 | \item{label}{either \code{character(1)} specifying the phenodata column in \code{x} 25 | defining the sample grouping or a vector with the same length than 26 | samples in \code{x} defining the group assignment of the samples.} 27 | 28 | \item{value}{\code{character(1)} specifying the value to be returned for each 29 | feature. See \code{\link[=featureValues]{featureValues()}} for more details.} 30 | 31 | \item{digits}{\code{integer(1)} defining the number of significant digits to be 32 | used for numeric. The default \code{NULL} uses \code{getOption("digits")}. See 33 | \code{\link[=format]{format()}} for more information.} 34 | 35 | \item{groupnames}{\code{logical(1)} whether row names of the resulting matrix 36 | should be the feature IDs (\code{groupnames = FALSE}; default) or IDs that 37 | are composed of the m/z and retention time of the features (in the 38 | format \verb{MT} (\code{groupnames = TRUE}). See help of the \link{groupnames} 39 | function for details.} 40 | 41 | \item{...}{additional parameters to be passed to the \code{\link[=featureValues]{featureValues()}} 42 | function.} 43 | } 44 | \value{ 45 | If \code{file} is not specified, the function returns the \code{matrix} in 46 | the format supported by MetaboAnalyst. 47 | } 48 | \description{ 49 | Export the feature table for further analysis in the MetaboAnalyst 50 | software (or the \code{MetaboAnalystR} R package). 51 | } 52 | \author{ 53 | Johannes Rainer 54 | } 55 | -------------------------------------------------------------------------------- /man/feature-grouping.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-group-features.R 3 | \name{feature-grouping} 4 | \alias{feature-grouping} 5 | \alias{featureGroups,XcmsResult-method} 6 | \alias{featureGroups<-,XcmsResult-method} 7 | \title{Compounding of LC-MS features} 8 | \usage{ 9 | \S4method{featureGroups}{XcmsResult}(object) 10 | 11 | \S4method{featureGroups}{XcmsResult}(object) <- value 12 | } 13 | \arguments{ 14 | \item{object}{an \code{\link[=XcmsExperiment]{XcmsExperiment()}} or \code{\link[=XCMSnExp]{XCMSnExp()}} object with LC-MS 15 | pre-processing results.} 16 | 17 | \item{value}{for \verb{featureGroups<-}: replacement for the feature groups in 18 | \code{object}. Has to be of length 1 or length equal to the number of features 19 | in \code{object}.} 20 | } 21 | \description{ 22 | Feature \emph{compounding} aims at identifying and grouping LC-MS features 23 | representing different ions or adducts (including isotopes) of the same 24 | originating compound. 25 | The \href{https://bioconductor.org/packages/MsFeatures}{MsFeatures} package 26 | provides a general framework and functionality to group features based on 27 | different properties. The \code{groupFeatures} methods for \code{\link[=XcmsExperiment]{XcmsExperiment()}} or 28 | \linkS4class{XCMSnExp} objects implemented in \code{xcms} extend these to enable 29 | the \emph{compounding} of LC-MS data considering also e.g. feature peak shaped. 30 | Note that these functions simply define feature groups but don't 31 | actually \emph{aggregate} or combine the features. 32 | 33 | See \code{\link[MsFeatures:groupFeatures]{MsFeatures::groupFeatures()}} for an overview on the general feature 34 | grouping concept as well as details on the individual settings and 35 | parameters. 36 | 37 | The available options for \code{groupFeatures} on \code{xcms} preprocessing results 38 | (i.e. on \code{XcmsExperiment} or \code{XCMSnExp} objects after correspondence 39 | analysis with \code{\link[=groupChromPeaks]{groupChromPeaks()}}) are: 40 | \itemize{ 41 | \item Grouping by similar retention times: \code{\link[=groupFeatures-similar-rtime]{groupFeatures-similar-rtime()}}. 42 | \item Grouping by similar feature values across samples: 43 | \code{\link[MsFeatures:groupFeatures-similar-abundance]{MsFeatures::AbundanceSimilarityParam()}}. 44 | \item Grouping by similar peak shape of extracted ion chromatograms: 45 | \code{\link[=EicSimilarityParam]{EicSimilarityParam()}}. 46 | } 47 | 48 | An ideal workflow grouping features should sequentially perform the above 49 | methods (in the listed order). 50 | 51 | Compounded feature groups can be accessed with the \code{featureGroups} function. 52 | } 53 | \seealso{ 54 | \code{\link[=plotFeatureGroups]{plotFeatureGroups()}} for visualization of grouped features. 55 | } 56 | \author{ 57 | Johannes Rainer, Mar Garcia-Aloy, Vinicius Veri Hernandes 58 | } 59 | -------------------------------------------------------------------------------- /man/featureSummary.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-XCMSnExp.R 3 | \name{featureSummary} 4 | \alias{featureSummary} 5 | \title{Simple feature summaries} 6 | \usage{ 7 | featureSummary( 8 | x, 9 | group, 10 | perSampleCounts = FALSE, 11 | method = "maxint", 12 | skipFilled = TRUE 13 | ) 14 | } 15 | \arguments{ 16 | \item{x}{\code{\link[=XcmsExperiment]{XcmsExperiment()}} or \code{\link[=XCMSnExp]{XCMSnExp()}} object with correspondence 17 | results.} 18 | 19 | \item{group}{\code{numeric}, \code{logical}, \code{character} or \code{factor} with the same 20 | length than \code{x} has samples to aggregate counts by the groups defined 21 | in \code{group}.} 22 | 23 | \item{perSampleCounts}{\code{logical(1)} whether feature wise individual peak 24 | counts per sample should be returned too.} 25 | 26 | \item{method}{\code{character} passed to the \code{\link[=featureValues]{featureValues()}} function. See 27 | respective help page for more information.} 28 | 29 | \item{skipFilled}{\code{logical(1)} whether filled-in peaks should be excluded 30 | (default) or included in the summary calculation.} 31 | } 32 | \value{ 33 | \code{matrix} with one row per feature and columns: 34 | \itemize{ 35 | \item \code{"count"}: the total number of samples in which a peak was found. 36 | \item \code{"perc"}: the percentage of samples in which a peak was found. 37 | \item \code{"multi_count"}: the total number of samples in which more than one peak 38 | was assigned to the feature. 39 | \item \code{"multi_perc"}: the percentage of those samples in which a peak was found, 40 | that have also multiple peaks annotated to the feature. Example: for a 41 | feature, at least one peak was detected in 50 samples. In 5 of them 2 peaks 42 | were assigned to the feature. \code{"multi_perc"} is in this case 10\%. 43 | \item \code{"rsd"}: relative standard deviation (coefficient of variation) of the 44 | integrated peak area of the feature's peaks. 45 | \item The same 4 columns are repeated for each unique element (level) in \code{group} 46 | if \code{group} was provided. 47 | } 48 | 49 | If \code{perSampleCounts = TRUE} also one column for each sample is returned 50 | with the peak counts per sample. 51 | } 52 | \description{ 53 | Simple function to calculate feature summaries. These include counts and 54 | percentages of samples in which a chromatographic peak is present for each 55 | feature and counts and percentages of samples in which more than one 56 | chromatographic peak was annotated to the feature. Also relative standard 57 | deviations (RSD) are calculated for the integrated peak areas per feature 58 | across samples. For \code{perSampleCounts = TRUE} also the individual 59 | chromatographic peak counts per sample are returned. 60 | } 61 | \author{ 62 | Johannes Rainer 63 | } 64 | -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sneumann/xcms/f8fa7f307ff53b17e9b9731f3a0923718e8abd86/man/figures/logo.png -------------------------------------------------------------------------------- /man/fillPeaks-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{fillPeaks-methods} 2 | \docType{methods} 3 | %\alias{fillPeaks-methods} 4 | \alias{fillPeaks} 5 | \alias{fillPeaks,xcmsSet-method} 6 | \title{Integrate areas of missing peaks} 7 | \description{ 8 | For each sample, identify peak groups where that sample is not 9 | represented. For each of those peak groups, integrate the signal 10 | in the region of that peak group and create a new peak. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsSet"}{ 15 | \code{fillPeaks(object, method="")} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsSet} object} 20 | \item{method}{the filling method} 21 | } 22 | \details{ 23 | After peak grouping, there will always be peak groups that do not 24 | include peaks from every sample. This method produces intensity 25 | values for those missing samples by integrating raw data in peak 26 | group region. According to the type of raw-data there are 2 different 27 | methods available. for filling gcms/lcms data the method "chrom" integrates 28 | raw-data in the chromatographic domain, whereas "MSW" is used for 29 | peaklists without retention-time information like those from 30 | direct-infusion spectra. 31 | } 32 | 33 | \value{ 34 | A \code{xcmsSet} objects with filled in peak groups. 35 | } 36 | 37 | \seealso{ 38 | \code{\link{xcmsSet-class}}, 39 | \code{\link{getPeaks}} 40 | } 41 | \keyword{methods} 42 | \keyword{file} 43 | -------------------------------------------------------------------------------- /man/fillPeaks.MSW-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{fillPeaks.MSW-methods} 2 | \docType{methods} 3 | %\alias{fillPeaks.MSW-methods} 4 | \alias{fillPeaks.MSW} 5 | \alias{fillPeaks.MSW,xcmsSet-method} 6 | \title{Integrate areas of missing peaks in FTICR-MS data} 7 | \description{ 8 | For each sample, identify peak groups where that sample is not 9 | represented. For each of those peak groups, integrate the signal 10 | in the region of that peak group and create a new peak. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsSet"}{ 15 | \code{fillPeaks.MSW(object)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsSet} object} 20 | } 21 | \details{ 22 | After peak grouping, there will always be peak groups that do not 23 | include peaks from every sample. This method produces intensity 24 | values for those missing samples by integrating raw data in peak 25 | group region. In a given group, the start and ending m/z values for 26 | integration are defined by the median start and 27 | end points of the other detected peaks. 28 | 29 | } 30 | \note{ 31 | In contrast to the \code{\link{fillPeaks.chrom}} method the maximum 32 | intensity reported in column \code{"maxo"} is not the maximum 33 | intensity measured in the expected peak area (defined by columns 34 | \code{"mzmin"} and \code{"mzmax"}), but the largest intensity of mz 35 | value(s) closest to the \code{"mzmed"} of the feature. 36 | } 37 | \value{ 38 | A \code{xcmsSet} objects with filled in peak groups. 39 | } 40 | \seealso{ 41 | \code{\link{xcmsSet-class}}, 42 | \code{\link{getPeaks}} 43 | \code{\link{fillPeaks}} 44 | } 45 | \keyword{methods} 46 | \keyword{file} 47 | -------------------------------------------------------------------------------- /man/filtfft.Rd: -------------------------------------------------------------------------------- 1 | \name{filtfft} 2 | \alias{filtfft} 3 | \title{Apply an convolution filter using an FFT} 4 | \description{ 5 | Expands a vector to the length of the filter and then convolutes 6 | it using two successive FFTs. 7 | } 8 | \usage{ 9 | filtfft(y, filt) 10 | } 11 | \arguments{ 12 | \item{y}{numeric vector of data to be filtered} 13 | \item{filt}{filter with length \code{nextn(length(y))}} 14 | } 15 | \value{ 16 | A numeric vector the same length as y. 17 | } 18 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 19 | \keyword{math} 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/findChromPeaks-Chromatogram-MatchedFilter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-Chromatogram.R 3 | \name{findChromPeaks,Chromatogram,MatchedFilterParam-method} 4 | \alias{findChromPeaks,Chromatogram,MatchedFilterParam-method} 5 | \title{matchedFilter-based peak detection in purely chromatographic data} 6 | \usage{ 7 | \S4method{findChromPeaks}{Chromatogram,MatchedFilterParam}(object, param, ...) 8 | } 9 | \arguments{ 10 | \item{object}{a \code{\link[MSnbase:Chromatogram-class]{MSnbase::Chromatogram()}} or \code{\link[MSnbase:MChromatograms-class]{MSnbase::MChromatograms()}} 11 | object.} 12 | 13 | \item{param}{a \link{MatchedFilterParam} object specifying the settings for the 14 | peak detection. See \code{\link[=peaksWithMatchedFilter]{peaksWithMatchedFilter()}} for the description of 15 | arguments used for peak detection.} 16 | 17 | \item{...}{currently ignored.} 18 | } 19 | \value{ 20 | If called on a \code{Chromatogram} object, the method returns a \code{matrix} with 21 | the identified peaks. Columns \code{"mz"}, \code{"mzmin"} and \code{"mzmax"} in 22 | the \code{chromPeaks()} peak matrix provide the mean m/z and the maximum and 23 | minimum m/z value of the \code{Chromatogram} object. See 24 | \code{\link[=peaksWithMatchedFilter]{peaksWithMatchedFilter()}} for details on the remaining columns. 25 | } 26 | \description{ 27 | \code{findChromPeaks} on a \code{\link[MSnbase:Chromatogram-class]{MSnbase::Chromatogram()}} or 28 | \code{\link[MSnbase:MChromatograms-class]{MSnbase::MChromatograms()}} object with a 29 | \link{MatchedFilterParam} parameter object performs matchedFilter-based peak 30 | detection on purely chromatographic data. See \link{matchedFilter} for details 31 | on the method and \link{MatchedFilterParam} for details on the parameter class. 32 | Note that not all settings from the \code{MatchedFilterParam} will be used. 33 | See \code{\link[=peaksWithMatchedFilter]{peaksWithMatchedFilter()}} for the arguments used for peak detection 34 | on purely chromatographic data. 35 | } 36 | \examples{ 37 | 38 | ## Loading a test data set with identified chromatographic peaks 39 | faahko_sub <- loadXcmsData("faahko_sub2") 40 | faahko_sub <- filterRt(faahko_sub, c(2500, 3700)) 41 | 42 | ## 43 | od <- as(filterFile(faahko_sub, 1L), "MsExperiment") 44 | 45 | ## Extract chromatographic data for a small m/z range 46 | chr <- chromatogram(od, mz = c(272.1, 272.3))[1, 1] 47 | 48 | ## Identify peaks with default settings 49 | xchr <- findChromPeaks(chr, MatchedFilterParam()) 50 | 51 | ## Plot the identified peaks 52 | plot(xchr) 53 | } 54 | \seealso{ 55 | \code{\link[=peaksWithMatchedFilter]{peaksWithMatchedFilter()}} for the downstream function and 56 | \link{matchedFilter} for details on the method. 57 | } 58 | \author{ 59 | Johannes Rainer 60 | } 61 | -------------------------------------------------------------------------------- /man/findEqualGreater.Rd: -------------------------------------------------------------------------------- 1 | \name{findEqualGreater} 2 | \alias{findEqualGreater} 3 | \alias{findEqualLess} 4 | \alias{findEqualGreaterM} 5 | \alias{findRange} 6 | \title{Find values in sorted vectors} 7 | \description{ 8 | Find values in sorted vectors. 9 | } 10 | \usage{ 11 | findEqualGreater(x, value) 12 | findEqualLess(x, value) 13 | findEqualGreaterM(x, values) 14 | findRange(x, values, NAOK = FALSE) 15 | } 16 | \arguments{ 17 | \item{x}{numeric vector sorted in increasing order} 18 | \item{value}{value to find in \code{x}} 19 | \item{values}{numeric values to find in \code{x}} 20 | \item{NAOK}{don't check for NA values in \code{x}} 21 | } 22 | \details{ 23 | \code{findEqualGreater} finds the index of the first value in 24 | \code{x} that is equal or greater than \code{value}. \code{findEqualLess} 25 | does same except that it finds equal or less. \code{findEqualGreaterM} 26 | creates an index of a vector by finding specified values. 27 | \code{findRange} locates the start and stop indicides of a range 28 | of two \code{x} values. 29 | 30 | The only things that save time at this point are 31 | \code{findeEqualGreaterM} (when the length of values approaches 32 | the lenght of x) and \code{findRange} (when \code{NAOK} is set 33 | to TRUE). They run in log(N) and N time, respectively. 34 | } 35 | \value{ 36 | An integer vector with the position(s) of the values(s). 37 | } 38 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 39 | \keyword{utilities} 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/findMZ.Rd: -------------------------------------------------------------------------------- 1 | \name{findMZ} 2 | \alias{findMZ} 3 | \alias{findMZ,xcmsFragments-method} 4 | \title{Find fragment ions in xcmsFragment objects} 5 | \description{ 6 | This is a method to find a fragment mass with a ppm window in a xcmsFragment object 7 | } 8 | \usage{ 9 | findMZ(object, find, ppmE=25, print=TRUE) 10 | } 11 | \arguments{ 12 | \item{object}{xcmsFragment object type} 13 | \item{find}{The fragment ion to be found} 14 | \item{ppmE}{the ppm error window for searching} 15 | \item{print}{If we should print a nice little report} 16 | } 17 | \details{ 18 | The method simply searches for a given fragment ion in an xcmsFragment object type given a certain ppm error window 19 | } 20 | \value{ 21 | A data frame with the following columns: 22 | 23 | \item{PrecursorMz}{The precursor m/z of the fragment} 24 | \item{MSnParentPeakID}{An index ID of the location of the precursor peak in the xcmsFragment object} 25 | \item{msLevel}{The level of the found fragment ion} 26 | \item{rt}{the Retention time of the found ion} 27 | \item{mz}{the actual m/z of the found fragment ion} 28 | \item{intensity}{The intensity of the fragment ion} 29 | \item{sample}{Which sample the fragment ion came from} 30 | \item{GroupPeakMSn}{an ID if the peaks were grouped by an xcmsSet grouping} 31 | \item{CollisionEnergy}{The collision energy of the precursor scan} 32 | 33 | } 34 | \references{ 35 | H. Paul Benton, D.M. Wong, S.A.Strauger, G. Siuzdak "XC\eqn{MS^2}" 36 | Analytical Chemistry 2008 37 | } 38 | \seealso{ 39 | \code{\link{findneutral}}, 40 | } 41 | \examples{ 42 | \dontrun{ 43 | library(msdata) 44 | mzMLpath <- system.file("iontrap", package = "msdata") 45 | mzMLfiles<-list.files(mzMLpath, pattern = "extracted.mzML", 46 | recursive = TRUE, full.names = TRUE) 47 | xs <- xcmsSet(mzMLfiles, method = "MS1") 48 | ##takes only one file from the file set 49 | xfrag <- xcmsFragments(xs) 50 | found<-findMZ(xfrag, 657.3433, 50) 51 | } 52 | 53 | } 54 | \author{H. Paul Benton, \email{hpaul.beonton08@imperial.ac.uk}} 55 | \keyword{methods} 56 | -------------------------------------------------------------------------------- /man/findPeaks-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{findPeaks-methods} 2 | \docType{methods} 3 | \alias{findPeaks-methods} 4 | \alias{findPeaks} 5 | \alias{findPeaks,xcmsRaw-method} 6 | \title{Feature detection for GC/MS and LC/MS Data - methods} 7 | \description{ 8 | A number of peak pickers exist in XCMS. \code{findPeaks} 9 | is the generic method. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{ 15 | findPeaks(object, ...) 16 | } 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{\code{\link{xcmsRaw-class}} object} 21 | \item{method}{Method to use for peak detection. See details.} 22 | \item{...}{Optional arguments to be passed along} 23 | } 24 | \details{ 25 | Different algorithms can be used by specifying them with the 26 | \code{method} argument. For example to use the matched filter 27 | approach described by Smith et al (2006) one would use: 28 | \code{findPeaks(object, method="matchedFilter")}. This is also 29 | the default. 30 | 31 | Further arguments given by \code{...} are 32 | passed through to the function implementing 33 | the \code{method}. 34 | 35 | A character vector of \emph{nicknames} for the 36 | algorithms available is returned by 37 | \code{getOption("BioC")$xcms$findPeaks.methods}. 38 | If the nickname of a method is called "centWave", 39 | the help page for that specific method can 40 | be accessed with \code{?findPeaks.centWave}. 41 | } 42 | \value{ 43 | A matrix with columns: 44 | \item{mz}{ 45 | weighted (by intensity) mean of peak m/z across scans 46 | } 47 | \item{mzmin}{ 48 | m/z of minimum step 49 | } 50 | \item{mzmax}{ 51 | m/z of maximum step 52 | } 53 | \item{rt}{ 54 | retention time of peak midpoint 55 | } 56 | \item{rtmin}{ 57 | leading edge of peak retention time 58 | } 59 | \item{rtmax}{ 60 | trailing edge of peak retention time 61 | } 62 | \item{into}{ 63 | integrated area of original (raw) peak 64 | } 65 | \item{maxo}{ 66 | maximum intensity of original (raw) peak 67 | } 68 | 69 | and additional columns depending on the choosen method. 70 | 71 | } 72 | \seealso{ 73 | \code{\link{findPeaks.matchedFilter}} 74 | \code{\link{findPeaks.centWave}} 75 | \code{\link{findPeaks.addPredictedIsotopeFeatures}} 76 | \code{\link{findPeaks.centWaveWithPredictedIsotopeROIs}} 77 | \code{\link{xcmsRaw-class}} 78 | } 79 | \keyword{methods} 80 | -------------------------------------------------------------------------------- /man/findPeaks.MS1-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{findPeaks.MS1-methods} 2 | \docType{methods} 3 | \alias{findPeaks.MS1} 4 | \alias{findPeaks.MS1,xcmsRaw-method} 5 | \title{Collecting MS1 precursor peaks} 6 | \description{ 7 | Collecting Tandem MS or MS$^n$ Mass Spectrometry 8 | precursor peaks as annotated in XML raw file} 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsRaw"}{ 12 | \code{ 13 | findPeaks.MS1(object) 14 | } 15 | } 16 | }} 17 | \details{ 18 | Some mass spectrometers can acquire MS1 and MS2 (or MS$^n$ scans) 19 | quasi simultaneously, e.g. in data dependent tandem MS or DDIT mode. 20 | 21 | Since xcmsFragments attaches \emph{all} MS$^n$ peaks to MS1 peaks in xcmsSet, 22 | it is important that findPeaks and xcmsSet do not miss any MS1 precursor peak. 23 | 24 | To be sure that all MS1 precursor peaks are in an xcmsSet, 25 | findPeaks.MS1 does not do an actual peak picking, but simply uses the 26 | annotation stored in mzXML, mzData or mzML raw files. 27 | 28 | This relies on the following XML tags: 29 | 30 | mzData: 31 | \code{ 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | } 42 | 43 | mzXML: 44 | \code{ 45 | 46 | 220.1828003 47 | 48 | } 49 | 50 | Several mzXML and mzData converters are known to create incomplete 51 | files, either without intensities (they will be set to 0) or without 52 | the precursor retention time (then a reasonably close rt will be 53 | chosen. NYI). 54 | 55 | } 56 | \arguments{ 57 | \item{object}{\code{xcmsRaw} object} 58 | } 59 | \value{ 60 | A matrix with columns: 61 | 62 | \item{mz, mzmin, mzmax}{ 63 | annotated MS1 precursor selection mass 64 | } 65 | 66 | \item{rt, rtmin, rtmax}{ 67 | annotated MS1 precursor retention time 68 | } 69 | 70 | \item{into, maxo, sn}{ 71 | annotated MS1 precursor intensity 72 | } 73 | 74 | } 75 | \author{Steffen Neumann, \email{sneumann@ipb-halle.de}} 76 | \seealso{ 77 | \code{\link{findPeaks-methods}} 78 | \code{\link{xcmsRaw-class}} 79 | } 80 | \keyword{methods} 81 | -------------------------------------------------------------------------------- /man/findPeaks.MSW-xcmsRaw-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-xcmsRaw.R 3 | \name{findPeaks.MSW,xcmsRaw-method} 4 | \alias{findPeaks.MSW,xcmsRaw-method} 5 | \alias{findPeaks.MSW} 6 | \title{Peak detection for single-spectrum non-chromatography MS data} 7 | \usage{ 8 | \S4method{findPeaks.MSW}{xcmsRaw}(object, snthresh = 3, verbose.columns = FALSE, ...) 9 | } 10 | \arguments{ 11 | \item{object}{The \code{xcmsRaw} object on which peak 12 | detection should be performed.} 13 | 14 | \item{snthresh}{\code{numeric(1)} defining the signal to noise ratio cutoff.} 15 | 16 | \item{verbose.columns}{Logical whether additional peak meta data columns 17 | should be returned.} 18 | 19 | \item{...}{Additional parameters to be passed to the 20 | \code{peakDetectionCWT()} and 21 | \code{identifyMajorPeaks()} functions from the 22 | \emph{MassSpecWavelet} package.} 23 | } 24 | \value{ 25 | \if{html}{\out{
}}\preformatted{A matrix, each row representing an intentified peak. 26 | }\if{html}{\out{
}} 27 | } 28 | \description{ 29 | This method performs peak detection in mass spectrometry 30 | direct injection spectrum using a wavelet based algorithm. 31 | } 32 | \details{ 33 | This is a wrapper around the peak picker in Bioconductor's 34 | \emph{MassSpecWavelet} package calling 35 | \code{peakDetectionCWT} and 36 | \code{tuneInPeakInfo} functions. 37 | } 38 | \author{ 39 | Joachim Kutzera, Steffen Neumann, Johannes Rainer 40 | } 41 | -------------------------------------------------------------------------------- /man/findneutral.Rd: -------------------------------------------------------------------------------- 1 | \name{findneutral} 2 | \alias{findneutral} 3 | \alias{findneutral,xcmsFragments-method} 4 | \title{Find neutral losses in xcmsFragment objects} 5 | \description{ 6 | This is a method to find a neutral loss with a ppm window in a xcmsFragment object 7 | } 8 | \usage{ 9 | findneutral(object, find, ppmE=25, print=TRUE) 10 | } 11 | \arguments{ 12 | \item{object}{xcmsFragment object type} 13 | \item{find}{The neutral loss to be found} 14 | \item{ppmE}{the ppm error window for searching} 15 | \item{print}{If we should print a nice little report} 16 | } 17 | \details{ 18 | The method searches for a given neutral loss in an xcmsFragment object type given a certain ppm error window. The neutral losses are generated between neighbouring ions. The resulting data frame shows the whole scan in which the neutral loss was found. 19 | } 20 | \value{ 21 | A data frame with the following columns: 22 | 23 | \item{PrecursorMz}{The precursor m/z of the neutral losses} 24 | \item{MSnParentPeakID}{An index ID of the location of the precursor peak in the xcmsFragment object} 25 | \item{msLevel}{The level of the found fragment ion} 26 | \item{rt}{the Retention time of the found ion} 27 | \item{mz}{the actual m/z of the found fragment ion} 28 | \item{intensity}{The intensity of the fragment ion} 29 | \item{sample}{Which sample the fragment ion came from} 30 | \item{GroupPeakMSn}{an ID if the peaks were grouped by an xcmsSet grouping} 31 | \item{CollisionEnergy}{The collision energy of the precursor scan} 32 | 33 | } 34 | \references{ 35 | H. Paul Benton, D.M. Wong, S.A.Strauger, G. Siuzdak "XC\eqn{MS^2}" 36 | Analytical Chemistry 2008 37 | } 38 | \seealso{ 39 | \code{\link{findMZ}}, 40 | } 41 | \examples{ 42 | \dontrun{ 43 | library(msdata) 44 | mzMLpath <- system.file("iontrap", package = "msdata") 45 | mzMLfiles<-list.files(mzMLpath, pattern = "extracted.mzML", 46 | recursive = TRUE, full.names = TRUE) 47 | xs <- xcmsSet(mzMLfiles, method = "MS1") 48 | ##takes only one file from the file set 49 | xfrag <- xcmsFragments(xs) 50 | found<-findneutral(xfrag, 58.1455, 50) 51 | } 52 | 53 | } 54 | \author{H. Paul Benton, \email{hpbenton@scripps.edu}} 55 | \keyword{methods} 56 | -------------------------------------------------------------------------------- /man/getPeaks-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{getPeaks-methods} 2 | \docType{methods} 3 | %\alias{getPeaks-methods} 4 | \alias{getPeaks} 5 | \alias{getPeaks,xcmsRaw-method} 6 | \title{Get peak intensities for specified regions} 7 | \description{ 8 | Integrate extracted ion chromatograms in pre-defined defined 9 | regions. Return output similar to \code{\link{findPeaks}}. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{getPeaks(object, peakrange, step = 0.1)} 15 | } 16 | }} 17 | \arguments{ 18 | \item{object}{the \code{xcmsSet} object} 19 | \item{peakrange}{ 20 | matrix or data frame with 4 columns: \code{mzmin}, \code{mzmax}, 21 | \code{rtmin}, \code{rtmax} (they must be in that order or named) 22 | } 23 | \item{step}{step size to use for profile generation} 24 | } 25 | \value{ 26 | A matrix with columns: 27 | \item{i}{ 28 | rank of peak identified in merged EIC (<= \code{max}), always \code{NA} 29 | } 30 | \item{mz}{ 31 | weighted (by intensity) mean of peak m/z across scans 32 | } 33 | \item{mzmin}{ 34 | m/z of minimum step 35 | } 36 | \item{mzmax}{ 37 | m/z of maximum step 38 | } 39 | \item{ret}{ 40 | retention time of peak midpoint 41 | } 42 | \item{retmin}{ 43 | leading edge of peak retention time 44 | } 45 | \item{retmax}{ 46 | trailing edge of peak retention time 47 | } 48 | \item{into}{ 49 | integrated area of original (raw) peak 50 | } 51 | \item{intf}{ 52 | integrated area of filtered peak, always \code{NA} 53 | } 54 | \item{maxo}{ 55 | maximum intensity of original (raw) peak 56 | } 57 | \item{maxf}{ 58 | maximum intensity of filtered peak, always \code{NA} 59 | } 60 | } 61 | \seealso{ 62 | \code{\link{xcmsRaw-class}} 63 | } 64 | \keyword{methods} 65 | \keyword{manip} 66 | -------------------------------------------------------------------------------- /man/getScan-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{getScan-methods} 2 | \docType{methods} 3 | \alias{getScan} 4 | \alias{getScan,xcmsRaw-method} 5 | \alias{getMsnScan} 6 | \alias{getMsnScan,xcmsRaw-method} 7 | \title{Get m/z and intensity values for a single mass scan} 8 | \description{ 9 | Return the data from a single mass scan using the numeric index 10 | of the scan as a reference. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsRaw"}{ 15 | \code{getScan(object, scan, mzrange = numeric())} 16 | \code{getMsnScan(object, scan, mzrange = numeric())} 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{the \code{xcmsRaw} object} 21 | \item{scan}{ 22 | integer index of scan. if negative, the index numbered from the 23 | end 24 | } 25 | \item{mzrange}{ 26 | limit data points returned to those between in the range, 27 | \code{range(mzrange)} 28 | } 29 | } 30 | \value{ 31 | A matrix with two columns: 32 | \item{mz}{m/z values} 33 | \item{intensity}{intensity values} 34 | } 35 | \seealso{ 36 | \code{\link{xcmsRaw-class}}, 37 | \code{\link{getSpec}} 38 | } 39 | \keyword{methods} 40 | \keyword{manip} 41 | -------------------------------------------------------------------------------- /man/getSpec-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{getSpec-methods} 2 | \docType{methods} 3 | %\alias{getSpec-methods} 4 | \alias{getSpec} 5 | \alias{getSpec,xcmsRaw-method} 6 | \title{Get average m/z and intensity values for multiple mass scans} 7 | \description{ 8 | Return full-resolution averaged data from multiple mass scans. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{object = "xcmsRaw"}{ 13 | \code{getSpec(object, ...)} 14 | } 15 | }} 16 | \arguments{ 17 | \item{object}{the \code{xcmsRaw} object} 18 | \item{...}{ 19 | arguments passed to \code{\link{profRange}} used to sepecify the 20 | spectral segments of interest for averaging 21 | } 22 | } 23 | \details{ 24 | Based on the mass points from the spectra selected, a master 25 | unique list of masses is generated. Every spectra is interpolated 26 | at those masses and then averaged. 27 | } 28 | \value{ 29 | A matrix with two columns: 30 | \item{mz}{m/z values} 31 | \item{intensity}{intensity values} 32 | } 33 | \seealso{ 34 | \code{\link{xcmsRaw-class}}, 35 | \code{\link{profRange}}, 36 | \code{\link{getScan}} 37 | } 38 | \keyword{methods} 39 | \keyword{manip} 40 | -------------------------------------------------------------------------------- /man/getXcmsRaw-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{getXcmsRaw-methods} 2 | \docType{methods} 3 | %\alias{getEIC-methods} 4 | \alias{getXcmsRaw} 5 | \alias{getXcmsRaw,xcmsSet-method} 6 | \title{Load the raw data for one or more files in the xcmsSet} 7 | \description{ 8 | Reads the raw data applies evential retention time corrections and 9 | waters Lock mass correction and 10 | returns it as an \code{xcmsRaw} object (or list of \code{xcmsRaw} 11 | objects) for one or more files of the \code{xcmsSet} object. 12 | } 13 | \section{Methods}{ 14 | \describe{ 15 | \item{object = "xcmsSet"}{ 16 | \code{getXcmsRaw(object, sampleidx=1, 17 | profmethod=profinfo(object)$method, profstep=profinfo(object)$step, 18 | rt=c("corrected", "raw"), ... 19 | )} 20 | } 21 | }} 22 | \arguments{ 23 | \item{object}{the \code{xcmsSet} object} 24 | \item{sampleidx}{ 25 | The index of the sample for which the raw data should be 26 | returned. Can be a single number or a numeric vector with the 27 | indices. Alternatively, the file name can be specified. 28 | } 29 | \item{profmethod}{ 30 | The profile method. 31 | } 32 | \item{profstep}{ 33 | The profile step. 34 | } 35 | \item{rt}{ 36 | Whether corrected or raw retention times should be returned. 37 | } 38 | \item{...}{ 39 | Additional arguments submitted to the \code{\link{xcmsRaw}} function. 40 | } 41 | } 42 | \value{ 43 | A single \code{xcmsRaw} object or a list of \code{xcmsRaw} objects. 44 | } 45 | \author{Johannes Rainer, \email{johannes.rainer@eurac.edu}} 46 | \seealso{ 47 | \code{\link{xcmsRaw-class}}, 48 | } 49 | \keyword{methods} 50 | \keyword{file} 51 | -------------------------------------------------------------------------------- /man/group-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{group-methods} 2 | \docType{methods} 3 | \alias{group-methods} 4 | \alias{group} 5 | \alias{group,xcmsSet-method} 6 | \title{Group peaks from different samples together} 7 | \description{ 8 | A number of grouping (or alignment) methods exist in XCMS. \code{group} 9 | is the generic method. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{ 15 | group(object, ...) 16 | } 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{\code{\link{xcmsSet-class}} object} 21 | \item{method}{Method to use for grouping. See details.} 22 | \item{...}{Optional arguments to be passed along} 23 | } 24 | \details{ 25 | Different algorithms can be used by specifying them with the 26 | \code{method} argument. For example to use the density-based 27 | approach described by Smith et al (2006) one would use: 28 | \code{group(object, method="density")}. This is also the default. 29 | 30 | Further arguments given by \code{...} are 31 | passed through to the function implementing 32 | the \code{method}. 33 | 34 | A character vector of \emph{nicknames} for the 35 | algorithms available is returned by 36 | \code{getOption("BioC")$xcms$group.methods}. 37 | If the nickname of a method is called "mzClust", 38 | the help page for that specific method can 39 | be accessed with \code{?group.mzClust}. 40 | } 41 | 42 | \value{ 43 | An \code{xcmsSet} object with peak group assignments and statistics. 44 | } 45 | \seealso{ 46 | \code{\link{group.density}} 47 | \code{\link{group.mzClust}} 48 | \code{\link{group.nearest}} 49 | \code{\link{xcmsSet-class}}, 50 | } 51 | \keyword{methods} 52 | -------------------------------------------------------------------------------- /man/group.density.Rd: -------------------------------------------------------------------------------- 1 | \name{group.density} 2 | \docType{methods} 3 | \alias{group.density} 4 | \alias{group.density,xcmsSet-method} 5 | \title{Group peaks from different samples together} 6 | \description{ 7 | Group peaks together across samples using overlapping m/z bins and 8 | calculation of smoothed peak distributions in chromatographic time. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{object = "xcmsSet"}{ 13 | \code{ 14 | group(object, bw = 30, minfrac = 0.5, minsamp = 1, 15 | mzwid = 0.25, max = 50, sleep = 0) 16 | } 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{the \code{xcmsSet} object} 21 | \item{minfrac}{ 22 | minimum fraction of samples necessary in at least one of the sample 23 | groups for it to be a valid group 24 | } 25 | \item{minsamp}{ 26 | minimum number of samples necessary in at least one of the sample 27 | groups for it to be a valid group 28 | } 29 | \item{bw}{ 30 | bandwidth (standard deviation or half width at half maximum) 31 | of gaussian smoothing kernel to apply to the peak density 32 | chromatogram 33 | } 34 | \item{mzwid}{ 35 | width of overlapping m/z slices to use for creating peak density 36 | chromatograms and grouping peaks across samples 37 | } 38 | \item{max}{ 39 | maximum number of groups to identify in a single m/z slice 40 | } 41 | \item{sleep}{ 42 | seconds to pause between plotting successive steps of the peak 43 | grouping algorithm. peaks are plotted as points showing relative 44 | intensity. identified groups are flanked by dotted vertical 45 | lines. 46 | } 47 | } 48 | \value{ 49 | An \code{xcmsSet} object with peak group assignments and statistics. 50 | } 51 | \seealso{ 52 | \code{\link{do_groupChromPeaks_density}} for the core API function 53 | performing the analysis. 54 | \code{\link{xcmsSet-class}}, 55 | \code{\link{density}} 56 | } 57 | \keyword{methods} 58 | \keyword{file} 59 | -------------------------------------------------------------------------------- /man/group.mzClust.Rd: -------------------------------------------------------------------------------- 1 | \name{group.mzClust} 2 | \docType{methods} 3 | \alias{group.mzClust} 4 | \alias{group.mzClust,xcmsSet-method} 5 | 6 | \title{Group Peaks via High Resolution Alignment} 7 | \description{ 8 | Runs high resolution alignment on single spectra samples stored in a 9 | given xcmsSet. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{ 15 | group(object, method="mzClust", mzppm = 20, mzabs = 0, minsamp = 1, minfrac=0) 16 | } 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{a xcmsSet with peaks } 21 | \item{mzppm}{the relative error used for clustering/grouping in ppm (parts per million)} 22 | \item{mzabs}{the absolute error used for clustering/grouping} 23 | \item{minsamp}{set the minimum number of samples in one bin} 24 | \item{minfrac}{set the minimum fraction of each class in one bin} 25 | } 26 | \value{ 27 | Returns a xcmsSet with slots groups and groupindex set. 28 | } 29 | \seealso{ 30 | \code{\link{xcmsSet-class}}, 31 | } 32 | 33 | \examples{ 34 | \dontrun{ 35 | library(msdata) 36 | mzMLpath <- system.file("fticr-mzML", package = "msdata") 37 | mzMLfiles <- list.files(mzMLpath, recursive = TRUE, full.names = TRUE) 38 | 39 | xs <- xcmsSet(method="MSW", files=mzMLfiles, scales=c(1,7), 40 | SNR.method='data.mean' , winSize.noise=500, 41 | peakThr=80000, amp.Th=0.005) 42 | 43 | xsg <- group(xs, method="mzClust") 44 | } 45 | } 46 | \references{ 47 | Saira A. Kazmi, Samiran Ghosh, Dong-Guk Shin, 48 | Dennis W. Hill and David F. Grant\cr 49 | \emph{Alignment of high resolution mass spectra: development of a heuristic 50 | approach for metabolomics}.\cr 51 | Metabolomics, Vol. 2, No. 2, 75-83 (2006) 52 | } 53 | \keyword{methods} 54 | \keyword{file} 55 | -------------------------------------------------------------------------------- /man/groupOverlaps.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-utils.R 3 | \name{groupOverlaps} 4 | \alias{groupOverlaps} 5 | \title{Group overlapping ranges} 6 | \usage{ 7 | groupOverlaps(xmin, xmax) 8 | } 9 | \arguments{ 10 | \item{xmin}{\code{numeric} (same length than \code{xmax}) with the lower boundary of 11 | the range.} 12 | 13 | \item{xmax}{\code{numeric} (same length than \code{xmin}) with the upper boundary of 14 | the range.} 15 | } 16 | \value{ 17 | \code{list} with the indices of grouped elements. 18 | } 19 | \description{ 20 | \code{groupOverlaps} identifies overlapping ranges in the input data and groups 21 | them by returning their indices in \code{xmin} \code{xmax}. 22 | } 23 | \examples{ 24 | 25 | x <- c(2, 12, 34.2, 12.4) 26 | y <- c(3, 16, 35, 36) 27 | 28 | groupOverlaps(x, y) 29 | } 30 | \author{ 31 | Johannes Rainer 32 | } 33 | -------------------------------------------------------------------------------- /man/groupnames-XCMSnExp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-XCMSnExp.R 3 | \name{groupnames,XCMSnExp-method} 4 | \alias{groupnames,XCMSnExp-method} 5 | \title{Generate unique group (feature) names based on mass and retention time} 6 | \usage{ 7 | \S4method{groupnames}{XCMSnExp}(object, mzdec = 0, rtdec = 0, template = NULL) 8 | } 9 | \arguments{ 10 | \item{object}{\code{XCMSnExp} object containing correspondence results.} 11 | 12 | \item{mzdec}{\code{integer(1)} with the number of decimal places to use for m/z ( 13 | defaults to \code{0}).} 14 | 15 | \item{rtdec}{\code{integer(1)} with the number of decimal places to use for the 16 | retention time (defaults to \code{0}).} 17 | 18 | \item{template}{\code{character} with existing group names whose format should 19 | be emulated.} 20 | } 21 | \value{ 22 | \code{character} with unique names for each feature in \code{object}. The 23 | format is \verb{M(m/z)T(time in seconds)}. 24 | } 25 | \description{ 26 | \code{groupnames} generates names for the identified features from the 27 | correspondence analysis based in their mass and retention time. This 28 | generates feature names that are equivalent to the group names of the \emph{old} 29 | user interface (aka xcms1). 30 | } 31 | \seealso{ 32 | \link{XCMSnExp}. 33 | } 34 | -------------------------------------------------------------------------------- /man/groupnames-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{groupnames-methods} 2 | \docType{methods} 3 | %\alias{groupnames-methods} 4 | \alias{groupnames} 5 | \alias{groupnames,xcmsEIC-method} 6 | \alias{groupnames,xcmsSet-method} 7 | \title{Generate unque names for peak groups} 8 | \description{ 9 | Allow linking of peak group data between classes using unique 10 | group names that remain the same as long as no re-grouping occurs. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsSet"}{ 15 | \code{(object, mzdec = 0, rtdec = 0, template = NULL)} 16 | } 17 | \item{object = "xcmsEIC"}{ 18 | \code{(object)} 19 | } 20 | }} 21 | \arguments{ 22 | \item{object}{the \code{xcmsSet} or \code{xcmsEIC} object} 23 | \item{mzdec}{number of decimal places to use for m/z} 24 | \item{rtdec}{number of decimal places to use for retention time} 25 | \item{template}{ 26 | a character vector with existing group names whose format should 27 | be emulated 28 | } 29 | } 30 | \value{ 31 | A character vector with unique names for each peak group in the 32 | object. The format is \code{M[m/z]T[time in seconds]}. 33 | } 34 | \seealso{ 35 | \code{\link{xcmsSet-class}}, 36 | \code{\link{xcmsEIC-class}} 37 | } 38 | \keyword{methods} 39 | \keyword{file} 40 | -------------------------------------------------------------------------------- /man/groupval-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{groupval-methods} 2 | \docType{methods} 3 | %\alias{groupval-methods} 4 | \alias{groupval} 5 | \alias{groupval,xcmsSet-method} 6 | \title{Extract a matrix of peak values for each group} 7 | \description{ 8 | Generate a matrix of peak values with rows for every group and 9 | columns for every sample. The value included in the matrix can 10 | be any of the columns from the \code{xcmsSet} \code{peaks} slot 11 | matrix. Collisions where more than one peak from a single sample 12 | are in the same group get resolved with one of several user-selectable 13 | methods. 14 | } 15 | \section{Methods}{ 16 | \describe{ 17 | \item{object = "xcmsSet"}{ 18 | \code{groupval(object, method = c("medret", "maxint"), 19 | value = "index", intensity = "into")} 20 | } 21 | }} 22 | \arguments{ 23 | \item{object}{the \code{xcmsSet} object} 24 | \item{method}{ 25 | conflict resolution method, \code{"medret"} to use the peak 26 | closest to the median retention time or \code{"maxint"} to use 27 | the peak with the highest intensity 28 | } 29 | \item{value}{ 30 | name of peak column to enter into returned matrix, or \code{"index"} 31 | for index to the corresponding row in the \code{peaks} slot 32 | matrix 33 | } 34 | \item{intensity}{ 35 | if \code{method == "maxint"}, name of peak column to use for 36 | intensity 37 | } 38 | } 39 | \value{ 40 | A matrix with with rows for every group and columns for every 41 | sample. Missing peaks have \code{NA} values. 42 | } 43 | \seealso{ 44 | \code{\link{xcmsSet-class}} 45 | } 46 | \keyword{methods} 47 | \keyword{manip} 48 | -------------------------------------------------------------------------------- /man/image.xcmsRaw.Rd: -------------------------------------------------------------------------------- 1 | \name{image-methods} 2 | \docType{methods} 3 | \alias{image,xcmsRaw-method} 4 | \title{Plot log intensity image of a xcmsRaw object} 5 | \description{ 6 | Create log intensity false-color image of a xcmsRaw object plotted 7 | with m/z and retention time axes 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{x = "xcmsRaw"}{ 12 | \code{ 13 | image(x, col = rainbow(256), ...) 14 | } 15 | } 16 | }} 17 | \arguments{ 18 | \item{x}{xcmsRaw object} 19 | \item{col}{vector of colors to use for for the image} 20 | \item{\dots}{arguments for \code{profRange}} 21 | } 22 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 23 | \seealso{ 24 | \code{\link{xcmsRaw-class}} 25 | } 26 | \keyword{hplot} 27 | -------------------------------------------------------------------------------- /man/imputeRowMin.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-imputation.R 3 | \name{imputeRowMin} 4 | \alias{imputeRowMin} 5 | \title{Replace missing values with a proportion of the row minimum} 6 | \usage{ 7 | imputeRowMin(x, min_fraction = 1/2) 8 | } 9 | \arguments{ 10 | \item{x}{\code{matrix} with abundances, rows being features/metabolites and 11 | columns samples.} 12 | 13 | \item{min_fraction}{\code{numeric(1)} with the fraction of the row minimum that 14 | should be used to replace \code{NA} values in that row.} 15 | } 16 | \description{ 17 | \code{imputeRowMin} imputes missing values in \code{x} by replacing \code{NA}s in each row 18 | with a proportion of the minimal value for that row (i.e. 19 | \code{min_fraction * min(x[i, ])}). 20 | } 21 | \examples{ 22 | 23 | library(MSnbase) 24 | library(faahKO) 25 | data("faahko") 26 | 27 | xset <- group(faahko) 28 | mat <- groupval(xset, value = "into") 29 | 30 | mat_imp <- imputeRowMin(mat) 31 | 32 | head(mat) 33 | head(mat_imp) 34 | 35 | ## Replace with 1/8 of the row mimimum 36 | head(imputeRowMin(mat, min_fraction = 1/8)) 37 | } 38 | \seealso{ 39 | \code{imputeLCMD} package for more left censored imputation functions. 40 | 41 | Other imputation functions: 42 | \code{\link{imputeRowMinRand}()} 43 | } 44 | \author{ 45 | Johannes Rainer 46 | } 47 | \concept{imputation functions} 48 | -------------------------------------------------------------------------------- /man/isolationWindowTargetMz-OnDiskMSnExp-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-OnDiskMSnExp.R 3 | \name{isolationWindowTargetMz,OnDiskMSnExp-method} 4 | \alias{isolationWindowTargetMz,OnDiskMSnExp-method} 5 | \alias{isolationWindowTargetMz} 6 | \title{Extract isolation window target m/z definition} 7 | \usage{ 8 | \S4method{isolationWindowTargetMz}{OnDiskMSnExp}(object) 9 | } 10 | \arguments{ 11 | \item{object}{\link[MSnbase:OnDiskMSnExp-class]{MSnbase::OnDiskMSnExp} object.} 12 | } 13 | \value{ 14 | a \code{numeric} of length equal to the number of spectra in \code{object} with 15 | the isolation window target m/z or \code{NA} if not specified/available. 16 | } 17 | \description{ 18 | \code{isolationWindowTargetMz} extracts the isolation window target m/z definition 19 | for each spectrum in \code{object}. 20 | } 21 | \author{ 22 | Johannes Rainer 23 | } 24 | -------------------------------------------------------------------------------- /man/levelplot.xcmsRaw.Rd: -------------------------------------------------------------------------------- 1 | \name{levelplot-methods} 2 | \docType{methods} 3 | \alias{levelplot,xcmsRaw-method} 4 | \alias{levelplot,xcmsSet-method} 5 | \title{Plot log intensity image of a xcmsRaw object} 6 | \description{ 7 | Create an image of the raw (profile) data m/z against retention 8 | time, with the intensity color coded. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{x = "xcmsRaw"}{ 13 | \code{ 14 | levelplot(x, log=TRUE, col.regions=colorRampPalette(brewer.pal(9, 15 | "YlOrRd"))(256), ...) 16 | } 17 | } 18 | \item{x = "xcmsSet"}{ 19 | \code{ 20 | levelplot(x, log=TRUE, col.regions=colorRampPalette(brewer.pal(9, 21 | "YlOrRd"))(256), rt="raw", ...) 22 | } 23 | } 24 | }} 25 | \arguments{ 26 | \item{x}{xcmsRaw object.} 27 | \item{log}{Whether the intensity should be log transformed.} 28 | \item{col.regions}{The color ramp that should be used for encoding of 29 | the intensity.} 30 | \item{rt}{wheter the original (\code{rt="raw"}) or the corrected 31 | (\code{rt="corrected"}) retention times should be used.} 32 | \item{\dots}{Arguments for \code{profRange}.} 33 | } 34 | \author{Johannes Rainer, \email{johannes.rainer@eurac.edu}} 35 | \seealso{ 36 | \code{\link{xcmsRaw-class}}, \code{\link{xcmsSet-class}} 37 | } 38 | \keyword{hplot} 39 | 40 | -------------------------------------------------------------------------------- /man/loadRaw-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{loadRaw-methods} 2 | \alias{loadRaw} 3 | \alias{loadRaw-methods} 4 | \alias{loadRaw,xcmsSource-method} 5 | \alias{loadRaw,xcmsFileSource-method} 6 | \title{Read binary data from a source} 7 | \description{ 8 | This function extracts the raw data which will be used an 9 | \code{\linkS4class{xcmsRaw}} object. Further processing of data is 10 | done in the \code{\link{xcmsRaw}} constructor. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{\code{signature(object = "xcmsSource")}}{ 15 | Uses \code{\link{loadRaw,xcmsSource-method}} to extract raw data. 16 | Subclasses of \code{\linkS4class{xcmsSource}} can provide different 17 | ways of fetching data. 18 | } 19 | } 20 | } 21 | 22 | \arguments{ 23 | \item{object}{Specification of a data source (such as a file name or 24 | database query)} 25 | } 26 | \details{ 27 | The implementing methods decide how to gather the data. 28 | } 29 | \value{ 30 | 31 | A list containing elements describing the data source. The \code{rt}, 32 | \code{scanindex}, \code{tic}, and \code{acquisitionNum} components 33 | each have one entry per scan. They are \emph{parallel} in the sense that 34 | \code{rt[1]}, \code{scanindex[1]}, and \code{acquisitionNum[1]} all 35 | refer to the same scan. The list containst the following components: 36 | 37 | \item{\code{rt}}{ 38 | Numeric vector with acquisition time (in seconds) for each scan 39 | } 40 | \item{\code{tic}}{Numeric vector with Total Ion Count for each scan} 41 | \item{\code{scanindex}}{ 42 | Integer vector with starting positions of each scan in the \code{mz} 43 | and \code{intensity} components. It is an exclusive offset, so 44 | \code{scanindex[i]} is the offset in \code{mz} and \code{intensity} 45 | \emph{before} the beginning of scan \code{i}. This means that the 46 | \code{mz} (respectively \code{intensity}) values for scan \code{i} 47 | would be from \code{scanindex[i] + 1} to \code{scanindex[i + 1]} 48 | } 49 | \item{\code{mz}}{Concatenated vector of m/z values for all scans} 50 | \item{\code{intensity}}{Concatenated vector of intensity values for all scans} 51 | } 52 | 53 | \author{Daniel Hackney, \email{dan@haxney.org}} 54 | \seealso{ 55 | \code{\link{xcmsRaw-class}}, 56 | \code{\linkS4class{xcmsSource}} 57 | } 58 | \keyword{methods} 59 | -------------------------------------------------------------------------------- /man/loadXcmsData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loadXcmsData.R 3 | \name{loadXcmsData} 4 | \alias{loadXcmsData} 5 | \alias{xdata} 6 | \alias{xmse} 7 | \alias{faahko_sub} 8 | \alias{faahko_sub2} 9 | \title{LC-MS preprocessing result test data sets} 10 | \usage{ 11 | loadXcmsData(x = c("xmse", "xdata", "faahko_sub", "faahko_sub2")) 12 | } 13 | \arguments{ 14 | \item{x}{For \code{loadXcmsData}: \code{character(1)} with the name of the data file 15 | (object) to load.} 16 | } 17 | \description{ 18 | Data sets with \code{xcms} preprocessing results are provided within the \code{xcms} 19 | package and can be loaded with the \code{loadXcmsData} function. The available 20 | Test data sets are: 21 | \itemize{ 22 | \item \code{xdata}: an \code{\link[=XCMSnExp]{XCMSnExp()}} object with the results from a \code{xcms}-based 23 | pre-processing of an LC-MS untargeted metabolomics data set. The raw data 24 | files are provided in the \code{faahKO} R package. 25 | \item \code{xmse}: an \code{\link[=XcmsExperiment]{XcmsExperiment()}} object with the results from an \code{xcms}-based 26 | pre-processing of an LC-MS untargeted metabolomics data set (same original 27 | data set and pre-processing settings as for the \code{xdata} data set). 28 | The pre-processing of this data set is described in detail in the \emph{xcms} 29 | vignette of the \code{xcms} package. 30 | \item \code{faahko_sub}: an \code{\link[=XCMSnExp]{XCMSnExp()}} object with identified 31 | chromatographic peaks in 3 samples from the data files in the \code{faahKO} 32 | R package. 33 | \item \code{faahko_sub2}: an \code{\link[=XcmsExperiment]{XcmsExperiment()}} object with identified 34 | chromatographic peaks in 3 samples from the data files in the \code{faahKO} 35 | R package. 36 | } 37 | 38 | Data sets can also be loaded using \code{data}, which would however require to 39 | update objects to point to the location of the raw data files. The 40 | \code{loadXcmsData} loads the data and ensures that all paths are updated 41 | accordingly. 42 | } 43 | \examples{ 44 | 45 | library(xcms) 46 | xdata <- loadXcmsData() 47 | } 48 | -------------------------------------------------------------------------------- /man/medianFilter.Rd: -------------------------------------------------------------------------------- 1 | \name{medianFilter} 2 | \alias{medianFilter} 3 | \title{Apply a median filter to a matrix} 4 | \description{ 5 | For each element in a matix, replace it with the median of the 6 | values around it. 7 | } 8 | \usage{ 9 | medianFilter(x, mrad, nrad) 10 | } 11 | \arguments{ 12 | \item{x}{numeric matrix to median filter} 13 | \item{mrad}{ 14 | number of rows on either side of the value to use for median 15 | calculation 16 | } 17 | \item{nrad}{ 18 | number of rows on either side of the value to use for median 19 | calculation 20 | } 21 | } 22 | \value{ 23 | A matrix whose values have been median filtered 24 | } 25 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 26 | \examples{ 27 | mat <- matrix(1:25, nrow=5) 28 | mat 29 | medianFilter(mat, 1, 1) 30 | } 31 | \keyword{manip} 32 | -------------------------------------------------------------------------------- /man/msn2xcmsRaw.Rd: -------------------------------------------------------------------------------- 1 | \name{msn2xcmsRaw} 2 | \alias{msn2xcmsRaw} 3 | \title{Copy MSn data in an xcmsRaw to the MS slots} 4 | \description{ 5 | The MS2 and MSn data is stored in separate slots, 6 | and can not directly be used by e.g. findPeaks(). 7 | \code{msn2xcmsRaw()} will copy the MSn spectra 8 | into the "normal" \code{xcmsRaw} slots. 9 | } 10 | \usage{ 11 | msn2xcmsRaw(xmsn) 12 | } 13 | \arguments{ 14 | \item{xmsn}{an object of class \code{xcmsRaw} that contains 15 | spectra read with includeMSn=TRUE} 16 | } 17 | \details{ 18 | 19 | The default gap value is determined from the 90th percentile of 20 | the pair-wise differences between adjacent mass values. 21 | } 22 | \value{ 23 | An xcmsRaw object 24 | } 25 | \author{Steffen Neumann \email{sneumann@ipb-halle.de}} 26 | \examples{ 27 | msnfile <- system.file("microtofq/MSMSpos20_6.mzML", package = "msdata") 28 | xrmsn <- xcmsRaw(msnfile, includeMSn=TRUE) 29 | xr <- msn2xcmsRaw(xrmsn) 30 | p <- findPeaks(xr, method="centWave") 31 | } 32 | 33 | \seealso{ 34 | \code{\link{xcmsRaw}}, 35 | } 36 | \keyword{manip} 37 | -------------------------------------------------------------------------------- /man/na.flatfill.Rd: -------------------------------------------------------------------------------- 1 | \name{na.flatfill} 2 | \alias{na.flatfill} 3 | \title{Fill in NA values at the extremes of a vector} 4 | \description{ 5 | Extend the first and last real values in a vector to fill in any 6 | NA values present. 7 | } 8 | \usage{ 9 | na.flatfill(x) 10 | } 11 | \arguments{ 12 | \item{x}{numeric vector with NA values} 13 | } 14 | \value{ 15 | Modified vector. 16 | } 17 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 18 | \keyword{NA}% at least one, from doc/KEYWORDS 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/overlappingFeatures.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-XCMSnExp.R 3 | \name{overlappingFeatures} 4 | \alias{overlappingFeatures} 5 | \title{Identify overlapping features} 6 | \usage{ 7 | overlappingFeatures(x, expandMz = 0, expandRt = 0, ppm = 0) 8 | } 9 | \arguments{ 10 | \item{x}{\code{\link[=XcmsExperiment]{XcmsExperiment()}} or \code{\link[=XCMSnExp]{XCMSnExp()}} object with the features.} 11 | 12 | \item{expandMz}{\code{numeric(1)} with the value to expand each feature (on each 13 | side) in m/z dimension before identifying overlapping features. 14 | The resulting \code{"mzmin"} for the feature is thus \code{mzmin - expandMz} and 15 | the \code{"mzmax"} \code{mzmax + expandMz}.} 16 | 17 | \item{expandRt}{\code{numeric(1)} with the value to expand each feature (on each 18 | side) in retention time dimension before identifying overlapping 19 | features. The resulting \code{"rtmin"} for the 20 | feature is thus \code{rtmin - expandRt} and the \code{"rtmax"} \code{rtmax + expandRt}.} 21 | 22 | \item{ppm}{\code{numeric(1)} to grow the m/z width of the feature by a relative 23 | value: \code{mzmin - mzmin * ppm / 2e6}, \code{mzmax + mzmax * ppm / 2e6}. Each 24 | feature is thus expanded in m/z dimension by ppm/2 on each side before 25 | identifying overlapping features.} 26 | } 27 | \value{ 28 | \code{list} with indices of features (in \code{\link[=featureDefinitions]{featureDefinitions()}}) that 29 | are overlapping. 30 | } 31 | \description{ 32 | \code{overlappingFeatures} identifies features that are overlapping or close in 33 | the m/z - rt space. 34 | } 35 | \examples{ 36 | 37 | ## Load a test data set with detected peaks 38 | library(MSnbase) 39 | data(faahko_sub) 40 | ## Update the path to the files for the local system 41 | dirname(faahko_sub) <- system.file("cdf/KO", package = "faahKO") 42 | 43 | ## Disable parallel processing for this example 44 | register(SerialParam()) 45 | 46 | ## Correspondence analysis 47 | xdata <- groupChromPeaks(faahko_sub, param = PeakDensityParam(sampleGroups = c(1, 1, 1))) 48 | 49 | ## Identify overlapping features 50 | overlappingFeatures(xdata) 51 | 52 | ## Identify features that are separated on retention time by less than 53 | ## 2 minutes 54 | overlappingFeatures(xdata, expandRt = 60) 55 | } 56 | \author{ 57 | Johannes Rainer 58 | } 59 | -------------------------------------------------------------------------------- /man/panel.cor.Rd: -------------------------------------------------------------------------------- 1 | \name{panel.cor} 2 | \alias{panel.cor} 3 | \title{Correlation coefficient panel for pairs function} 4 | \description{ 5 | Correlation coefficient panel for pairs function. 6 | } 7 | \usage{ 8 | panel.cor(x, y, digits = 2, prefix = "", cex.cor) 9 | } 10 | \arguments{ 11 | \item{x}{first data series} 12 | \item{y}{second data series} 13 | \item{digits}{number of digits to plot} 14 | \item{prefix}{text to prefix the coefficients} 15 | \item{cex.cor}{character expansion factor} 16 | } 17 | \author{ 18 | Colin A. Smith, \email{csmith@scripps.edu}, based on 19 | pairs example code 20 | } 21 | \seealso{ 22 | \code{\link{pairs}} 23 | } 24 | \keyword{aplot} 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/peakPlots-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{peakPlots-methods} 2 | \docType{methods} 3 | \alias{peakPlots-methods} 4 | \alias{peakPlots,xcmsSet-method} 5 | \title{Plot a grid of a large number of peaks} 6 | \description{ 7 | Plot extracted ion chromatograms for many peaks simultaneously, 8 | indicating peak integration start and end points with vertical 9 | grey lines. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | 14 | \item{\code{signature(object = "xcmsSet")}}{ 15 | \code{plotPeaks(object, peaks, figs, width = 200)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsRaw} object} 20 | \item{peaks}{ 21 | matrix with peak information as produced by \code{\link{findPeaks}} 22 | } 23 | \item{figs}{ 24 | two-element vector describing the number of rows and the number 25 | of columns of peaks to plot, if missing then an approximately 26 | square grid that will fit the number of peaks supplied 27 | } 28 | \item{width}{ 29 | width of chromatogram retention time to plot for each peak 30 | } 31 | } 32 | 33 | \details{ 34 | This function is intended to help graphically analyze the results 35 | of peak picking. It can help estimate the number of false positives 36 | and improper integration start and end points. Its output is very 37 | compact and tries to waste as little space as possible. Each plot 38 | is labeled with rounded m/z and retention time separated by a 39 | space. 40 | } 41 | \seealso{ 42 | \code{\link{xcmsRaw-class}}, 43 | \code{\link{findPeaks}}, 44 | \code{\link{split.screen}} 45 | } 46 | 47 | \keyword{methods} 48 | -------------------------------------------------------------------------------- /man/peakTable-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{peakTable-methods} 2 | \docType{methods} 3 | \alias{peakTable} 4 | \alias{peakTable,xcmsSet-method} 5 | \title{Create report of aligned peak intensities} 6 | \description{ 7 | Create a report showing all aligned peaks. 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsSet"}{ 12 | \code{peakTable(object, filebase = character(), ...)} 13 | } 14 | }} 15 | \arguments{ 16 | \item{object}{the \code{xcmsSet} object} 17 | \item{filebase}{ 18 | base file name to save report, \code{.tsv} file and \code{_eic} 19 | will be appended to this name for the tabular report and EIC 20 | directory, respectively. if blank nothing will be saved 21 | } 22 | \item{...}{arguments passed down to \code{\link{groupval}}, 23 | which provides the actual intensities. } 24 | } 25 | \details{ 26 | 27 | This method handles creation of summary reports similar to 28 | \code{\link{diffreport}}. It returns a summary report that can 29 | optionally be written out to a tab-separated file. 30 | 31 | If a base file name is provided, the report (see Value section) 32 | will be saved to a tab separated file. 33 | } 34 | 35 | \value{ 36 | A data frame with the following columns: 37 | 38 | \item{mz}{median m/z of peaks in the group} 39 | \item{mzmin}{minimum m/z of peaks in the group} 40 | \item{mzmax}{maximum m/z of peaks in the group} 41 | \item{rt}{median retention time of peaks in the group} 42 | \item{rtmin}{minimum retention time of peaks in the group} 43 | \item{rtmax}{maximum retention time of peaks in the group} 44 | \item{npeaks}{number of peaks assigned to the group} 45 | \item{Sample Classes}{ 46 | number samples from each sample class represented in the group 47 | } 48 | \item{...}{one column for every sample class} 49 | \item{Sample Names}{integrated intensity value for every sample} 50 | \item{...}{one column for every sample} 51 | } 52 | \seealso{ 53 | \code{\link{xcmsSet-class}}, 54 | } 55 | \examples{ 56 | \dontrun{ 57 | library(faahKO) 58 | cdfpath <- system.file("cdf", package = "faahKO") 59 | cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE) 60 | xs<-xcmsSet(cdf files) 61 | xs<-group(xs) 62 | peakTable(xs, filebase="peakList") 63 | } 64 | } 65 | \keyword{methods} 66 | \keyword{file} 67 | -------------------------------------------------------------------------------- /man/phenoDataFromPaths.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-xcmsSet.R 3 | \name{phenoDataFromPaths} 4 | \alias{phenoDataFromPaths} 5 | \title{Derive experimental design from file paths} 6 | \usage{ 7 | phenoDataFromPaths(paths) 8 | } 9 | \arguments{ 10 | \item{paths}{\code{character} representing the file names (including the full 11 | path) of the experiment's files.} 12 | } 13 | \description{ 14 | The \code{phenoDataFromPaths} function builds a \code{data.frame} 15 | representing the experimental design from the folder structure in which 16 | the files of the experiment are located. 17 | } 18 | \note{ 19 | This function is used by the \emph{old} \code{xcmsSet} function to guess 20 | the experimental design (i.e. group assignment of the files) from the 21 | folders in which the files of the experiment can be found. 22 | } 23 | \examples{ 24 | ## List the files available in the faahKO package 25 | base_dir <- system.file("cdf", package = "faahKO") 26 | cdf_files <- list.files(base_dir, recursive = TRUE, full.names = TRUE) 27 | } 28 | -------------------------------------------------------------------------------- /man/plot.xcmsEIC.Rd: -------------------------------------------------------------------------------- 1 | \name{plot.xcmsEIC} 2 | \docType{methods} 3 | \alias{plot.xcmsEIC} 4 | \alias{plot, plot-methods} 5 | \title{Plot extracted ion chromatograms from multiple files} 6 | \description{ 7 | Batch plot a list of extracted ion chromatograms to the current 8 | graphics device. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{x = "xcmsEIC"}{ 13 | \code{ 14 | plot.xcmsEIC(x, y, groupidx = groupnames(x), sampleidx = sampnames(x), rtrange = x@rtrange, 15 | col = rep(1, length(sampleidx)), legtext = NULL, peakint = TRUE, sleep = 0, ...)} 16 | } 17 | 18 | }} 19 | 20 | \value{ 21 | A \code{xcmsSet} object. 22 | } 23 | \arguments{ 24 | \item{x}{the \code{xcmsEIC} object} 25 | \item{y}{optional \code{xcmsSet} object with peak integration data} 26 | \item{groupidx}{ 27 | either character vector with names or integer vector with 28 | indicies of peak groups for which to plot EICs 29 | } 30 | \item{sampleidx}{ 31 | either character vector with names or integer vector with 32 | indicies of samples for which to plot EICs 33 | } 34 | \item{rtrange}{ 35 | a two column matrix with minimum and maximum retention times 36 | between which to return EIC data points 37 | 38 | if it has the same number of rows as the number groups in the 39 | \code{xcmsEIC} object, then \code{sampleidx} is used to subset 40 | it. otherwise, it is repeated over the length of \code{sampleidx} 41 | 42 | it may also be a single number specifying the time window around 43 | the peak for which to plot EIC data 44 | } 45 | \item{col}{ 46 | color to use for plotting extracted ion chromatograms. if missing 47 | and \code{y} is specified, colors are taken from 48 | \code{unclass(sampclass(y))} and the default palette 49 | 50 | if it is the same length as the number groups in the \code{xcmsEIC} 51 | object, then \code{sampleidx} is used to subset it. otherwise, 52 | it is repeated over the length of \code{sampleidx} 53 | } 54 | \item{legtext}{ 55 | text to use for legend. if \code{NULL} and \code{y} is specified, 56 | legend text is taken from the sample class information found 57 | in the \code{xcmsSet} 58 | } 59 | \item{peakint}{ 60 | logical, plot integrated peak area with darkened lines (requires 61 | that \code{y} also be specified) 62 | } 63 | \item{sleep}{seconds to pause between plotting EICs} 64 | \item{...}{other graphical parameters} 65 | } 66 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 67 | \seealso{ 68 | \code{\link{xcmsEIC-class}}, 69 | \code{\link{png}}, 70 | \code{\link{pdf}}, 71 | \code{\link{postscript}}, 72 | } 73 | \keyword{methods} 74 | \keyword{hplot} 75 | -------------------------------------------------------------------------------- /man/plotChrom-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotChrom-methods} 2 | \docType{methods} 3 | %\alias{plotChrom-methods} 4 | \alias{plotChrom} 5 | \alias{plotChrom,xcmsRaw-method} 6 | \title{Plot extracted ion chromatograms from the profile matrix} 7 | \description{ 8 | Uses the pre-generated profile mode matrix to plot averaged or 9 | base peak extracted ion chromatograms over a specified mass range. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{plotChrom(object, base = FALSE, ident = FALSE, 15 | fitgauss = FALSE, vline = numeric(0), ...)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsRaw} object} 20 | \item{base}{logical, plot a base-peak chromatogram} 21 | \item{ident}{logical, use mouse to identify and label peaks} 22 | \item{fitgauss}{logical, fit a gaussian to the largest peak} 23 | \item{vline}{numeric vector with locations of vertical lines} 24 | \item{...}{arguments passed to \code{\link{profRange}}} 25 | } 26 | \value{ 27 | If \code{ident == TRUE}, an integer vector with the indecies of 28 | the points that were identified. If \code{fitgauss == TRUE}, a 29 | \code{nls} model with the fitted gaussian. Otherwise a two-column 30 | matrix with the plotted points. 31 | } 32 | \seealso{ 33 | \code{\link{xcmsRaw-class}} 34 | } 35 | \keyword{methods} 36 | \keyword{hplot} 37 | \keyword{iplot} 38 | -------------------------------------------------------------------------------- /man/plotEIC-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotEIC-methods} 2 | \docType{methods} 3 | \alias{plotEIC} 4 | \alias{plotEIC,xcmsRaw-method} 5 | \title{Plot extracted ion chromatograms for specified m/z range} 6 | \description{ 7 | Plot extracted ion chromatogram for m/z values of interest. The raw data is used in contrast to \code{\link{plotChrom}} which uses data from the profile matrix. 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsRaw"}{ 12 | \code{ 13 | plotEIC(object, mzrange = numeric(), rtrange = numeric(), 14 | scanrange = numeric(), mzdec=2, type="l", add=FALSE, ...) 15 | } 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{\code{xcmsRaw} object} 20 | \item{mzrange}{ 21 | m/z range for EIC. Uses the full m/z range by default. 22 | } 23 | \item{rtrange}{ 24 | retention time range for EIC. Uses the full retention time range by default. 25 | } 26 | \item{scanrange}{ 27 | scan range for EIC 28 | } 29 | \item{mzdec}{ 30 | Number of decimal places of title m/z values in the eic plot. 31 | } 32 | \item{type}{ 33 | Speficies how the data should be plotted (by default as a line). 34 | } 35 | \item{add}{ 36 | If the EIC should be added to an existing plot. 37 | } 38 | \item{...}{ 39 | Additional parameters passed to the plotting function 40 | (e.g. \code{col} etc). 41 | } 42 | } 43 | \value{ 44 | A two-column matrix with the plotted points. 45 | } 46 | 47 | \author{Ralf Tautenhahn} 48 | 49 | \seealso{ 50 | \code{\link{rawEIC},\link{xcmsRaw-class}} 51 | } 52 | \keyword{methods} 53 | -------------------------------------------------------------------------------- /man/plotFeatureGroups.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-group-features.R 3 | \name{plotFeatureGroups} 4 | \alias{plotFeatureGroups} 5 | \title{Plot feature groups in the m/z-retention time space} 6 | \usage{ 7 | plotFeatureGroups( 8 | x, 9 | xlim = numeric(), 10 | ylim = numeric(), 11 | xlab = "retention time", 12 | ylab = "m/z", 13 | pch = 4, 14 | col = "#00000060", 15 | type = "o", 16 | main = "Feature groups", 17 | featureGroups = character(), 18 | ... 19 | ) 20 | } 21 | \arguments{ 22 | \item{x}{\link{XcmsExperiment} or \code{\link[=XCMSnExp]{XCMSnExp()}} object with grouped features 23 | (i.e. after calling \code{\link[MsFeatures:groupFeatures]{MsFeatures::groupFeatures()}}.} 24 | 25 | \item{xlim}{\code{numeric(2)} with the lower and upper limit for the x-axis.} 26 | 27 | \item{ylim}{\code{numeric(2)} with the lower and upper limit for the y-axis.} 28 | 29 | \item{xlab}{\code{character(1)} with the label for the x-axis.} 30 | 31 | \item{ylab}{\code{character(1)} with the label for the y-axis.} 32 | 33 | \item{pch}{the plotting character. Defaults to \code{pch = 4} i.e. plotting 34 | features as crosses. See \code{\link[=par]{par()}} for more information.} 35 | 36 | \item{col}{color to be used to draw the features. At present only a single 37 | color is supported.} 38 | 39 | \item{type}{plotting type (see \code{\link[=par]{par()}}). Defaults to \code{type = "o"} which 40 | draws each feature as a point and connecting the features of the same 41 | feature group with a line.} 42 | 43 | \item{main}{\code{character(1)} with the title of the plot.} 44 | 45 | \item{featureGroups}{optional \code{character} of feature group IDs to draw only 46 | specified feature group(s). If not provided, all feature groups are 47 | drawn.} 48 | 49 | \item{...}{additional parameters to be passed to the \code{lines} function.} 50 | } 51 | \description{ 52 | \code{plotFeatureGroups()} visualizes defined feature groups in the m/z by 53 | retention time space. Features are indicated by points with features from 54 | the same feature group being connected by a line. See 55 | \code{\link[MsFeatures:featureGroups]{MsFeatures::featureGroups()}} for details on and options for 56 | feature grouping. 57 | } 58 | \author{ 59 | Johannes Rainer 60 | } 61 | -------------------------------------------------------------------------------- /man/plotMsData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-utils.R 3 | \name{plotMsData} 4 | \alias{plotMsData} 5 | \title{DEPRECATED: Create a plot that combines a XIC and a mz/rt 2D plot for one sample} 6 | \usage{ 7 | plotMsData( 8 | x, 9 | main = "", 10 | cex = 1, 11 | mfrow = c(2, 1), 12 | grid.color = "lightgrey", 13 | colramp = colorRampPalette(rev(brewer.pal(9, "YlGnBu"))) 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{\code{data.frame} such as returned by the \code{\link[=extractMsData]{extractMsData()}} function. 18 | Only a single \code{data.frame} is supported.} 19 | 20 | \item{main}{\code{character(1)} specifying the title.} 21 | 22 | \item{cex}{\code{numeric(1)} defining the size of points. Passed directly to the 23 | \code{plot} function.} 24 | 25 | \item{mfrow}{\code{numeric(2)} defining the plot layout. This will be passed 26 | directly to \code{par(mfrow = mfrow)}. See \code{par} for more information. Setting 27 | \code{mfrow = NULL} avoids calling \code{par(mfrow = mfrow)} hence allowing to 28 | pre-define the plot layout.} 29 | 30 | \item{grid.color}{a color definition for the grid line (or \code{NA} to skip 31 | creating them).} 32 | 33 | \item{colramp}{a \emph{color ramp palette} to be used to color the data points 34 | based on their intensity. See argument \code{col.regions} in 35 | \link[lattice:level.colors]{lattice::level.colors} documentation.} 36 | } 37 | \description{ 38 | \strong{UPDATE}: please use \code{plot()} from the \code{MsExperiment} or 39 | \code{plot(x, type = "XIC")} from the \code{MSnbase} package instead. See examples 40 | in the vignette for more information. 41 | 42 | The \code{plotMsData} creates a plot that combines an (base peak ) 43 | extracted ion chromatogram on top (rt against intensity) and a plot of 44 | rt against m/z values at the bottom. 45 | } 46 | \author{ 47 | Johannes Rainer 48 | } 49 | -------------------------------------------------------------------------------- /man/plotPeaks-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotPeaks-methods} 2 | \docType{methods} 3 | %\alias{plotPeaks-methods} 4 | \alias{plotPeaks} 5 | \alias{plotPeaks,xcmsRaw-method} 6 | \title{Plot a grid of a large number of peaks} 7 | \description{ 8 | Plot extracted ion chromatograms for many peaks simultaneously, 9 | indicating peak integration start and end points with vertical 10 | grey lines. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsRaw"}{ 15 | \code{plotPeaks(object, peaks, figs, width = 200)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsRaw} object} 20 | \item{peaks}{ 21 | matrix with peak information as produced by \code{\link{findPeaks}} 22 | } 23 | \item{figs}{ 24 | two-element vector describing the number of rows and the number 25 | of columns of peaks to plot, if missing then an approximately 26 | square grid that will fit the number of peaks supplied 27 | } 28 | \item{width}{ 29 | width of chromatogram retention time to plot for each peak 30 | } 31 | } 32 | \details{ 33 | This function is intended to help graphically analyze the results 34 | of peak picking. It can help estimate the number of false positives 35 | and improper integration start and end points. Its output is very 36 | compact and tries to waste as little space as possible. Each plot 37 | is labeled with rounded m/z and retention time separated by a 38 | space. 39 | } 40 | \seealso{ 41 | \code{\link{xcmsRaw-class}}, 42 | \code{\link{findPeaks}}, 43 | \code{\link{split.screen}} 44 | } 45 | \keyword{methods} 46 | \keyword{hplot} 47 | -------------------------------------------------------------------------------- /man/plotPrecursorIons.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/XcmsExperiment-plotting.R 3 | \name{plotPrecursorIons} 4 | \alias{plotPrecursorIons} 5 | \title{General visualization of precursor ions of LC-MS/MS data} 6 | \usage{ 7 | plotPrecursorIons( 8 | x, 9 | pch = 21, 10 | col = "#00000080", 11 | bg = "#00000020", 12 | xlab = "retention time", 13 | ylab = "m/z", 14 | main = character(), 15 | ... 16 | ) 17 | } 18 | \arguments{ 19 | \item{x}{\code{MsExperiment} of LC-MS/MS data.} 20 | 21 | \item{pch}{\code{integer(1)} defining the symbol/point type to be used to draw 22 | points. See \code{\link[=points]{points()}} for details. Defaults to \code{pch = 21} which allows 23 | defining the background and border color for points.} 24 | 25 | \item{col}{the color to be used for all data points. Defines the border 26 | color if \code{pch = 21}.} 27 | 28 | \item{bg}{the background color (if \code{pch = 21}).} 29 | 30 | \item{xlab}{\code{character(1)} defining the x-axis label.} 31 | 32 | \item{ylab}{\code{character(1)} defining the y-axis label.} 33 | 34 | \item{main}{Optional \code{character(1)} with the title for \strong{every} plot. If 35 | not provided (the default) the base file name will be used for each 36 | sample.} 37 | 38 | \item{...}{additional parameters to be passed to the \code{plot} calls.} 39 | } 40 | \description{ 41 | Simple visualization of the position of fragment spectra's precursor ion 42 | in the MS1 retention time by m/z area. 43 | } 44 | \examples{ 45 | 46 | ## Load a test data file with DDA LC-MS/MS data 47 | library(MsExperiment) 48 | fl <- system.file("TripleTOF-SWATH", "PestMix1_DDA.mzML", package = "msdata") 49 | pest_dda <- readMsExperiment(fl) 50 | 51 | plotPrecursorIons(pest_dda) 52 | grid() 53 | 54 | ## Subset the data object to plot the data specifically for one or 55 | ## selected file/sample: 56 | plotPrecursorIons(pest_dda[1L]) 57 | } 58 | \author{ 59 | Johannes Rainer 60 | } 61 | -------------------------------------------------------------------------------- /man/plotQC.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plotQC.R 3 | \name{plotQC} 4 | \alias{plotQC} 5 | \title{Plot m/z and RT deviations for QC purposes without external reference data} 6 | \usage{ 7 | plotQC(object, sampNames, sampColors, sampOrder, what) 8 | } 9 | \arguments{ 10 | \item{object}{A grouped \code{xcmsSet}} 11 | 12 | \item{sampNames}{Override sample names (e.g. with simplified names)} 13 | 14 | \item{sampColors}{Provide a set of colors (default: monochrome ?)} 15 | 16 | \item{sampOrder}{Override the order of samples, e.g. to bring them in order 17 | of measurement to detect time drift} 18 | 19 | \item{what}{A vector of which QC plots to generate. 20 | "mzdevhist": histogram of mz deviations. Should be gaussian shaped. If it is multimodal, then some peaks seem to have a systematically higher m/z deviation 21 | "rtdevhist": histogram of RT deviations. Should be gaussian shaped. If it is multimodal, then some peaks seem to have a systematically higher RT deviation 22 | "mzdevmass": Shows whether m/z deviations are absolute m/z dependent, could indicate miscalibration 23 | "mzdevtime": Shows whether m/z deviations are RT dependent, could indicate instrument drift 24 | "mzdevsample": median mz deviation for each sample, indicates outliers 25 | "rtdevsample": median RT deviation for each sample, indicates outliers} 26 | } 27 | \value{ 28 | List with four matrices, each of dimension features * samples: 29 | "mz": median mz deviation for each sample 30 | "mzdev": median mz deviation for each sample 31 | "rt": median RT deviation for each sample 32 | "rtdev": median RT deviation for each sample 33 | } 34 | \description{ 35 | Use "democracy" to determine the average m/z and RT deviations 36 | for a grouped xcmsSet, and dependency on sample or absolute m/z 37 | 38 | \code{plotQC()} is a warpper to create a set of diagnostic plots. 39 | For the m/z deviations, the median of all m/z withon one group are assumed. 40 | } 41 | \examples{ 42 | library(faahKO) 43 | xsg <- group(faahko) 44 | 45 | plotQC(xsg, what="mzdevhist") 46 | plotQC(xsg, what="rtdevhist") 47 | plotQC(xsg, what="mzdevmass") 48 | plotQC(xsg, what="mzdevtime") 49 | plotQC(xsg, what="mzdevsample") 50 | plotQC(xsg, what="rtdevsample") 51 | 52 | } 53 | \author{ 54 | Michael Wenk, Michael Wenk \href{mailto:michael.wenk@student.uni-halle.de}{michael.wenk@student.uni-halle.de} 55 | } 56 | -------------------------------------------------------------------------------- /man/plotRaw-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotRaw-methods} 2 | \docType{methods} 3 | %\alias{plotRaw-methods} 4 | \alias{plotRaw} 5 | \alias{plotRaw,xcmsRaw-method} 6 | \title{Scatterplot of raw data points} 7 | \description{ 8 | Produce a scatterplot showing raw data point location in retention 9 | time and m/z. This plot is more useful for centroided data than 10 | continuum data. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsRaw"}{ 15 | \code{plotRaw(object, mzrange = numeric(), rtrange = numeric(), 16 | scanrange = numeric(), log=FALSE, title='Raw Data')} 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{the \code{xcmsRaw} object} 21 | \item{mzrange}{ 22 | numeric vector of length >= 2 whose range will be used to select 23 | the masses to plot 24 | } 25 | \item{rtrange}{ 26 | numeric vector of length >= 2 whose range will be used to select 27 | the retention times to plot 28 | } 29 | \item{scanrange}{ 30 | numeric vector of length >= 2 whose range will be used to select 31 | scans to plot 32 | } 33 | \item{log}{ 34 | logical, log transform intensity 35 | } 36 | \item{title}{ 37 | main title of the plot 38 | } 39 | } 40 | \value{ 41 | A matrix with the points plotted. 42 | } 43 | \seealso{ 44 | \code{\link{xcmsRaw-class}} 45 | } 46 | \keyword{methods} 47 | \keyword{hplot} 48 | -------------------------------------------------------------------------------- /man/plotScan-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotScan-methods} 2 | \docType{methods} 3 | %\alias{plotScan-methods} 4 | \alias{plotScan} 5 | \alias{plotScan,xcmsRaw-method} 6 | \title{Plot a single mass scan} 7 | \description{ 8 | Plot a single mass scan using the impulse representation. Most 9 | useful for centroided data. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{plotScan(object, scan, mzrange = numeric(), ident = FALSE)} 15 | } 16 | }} 17 | \arguments{ 18 | \item{object}{the \code{xcmsRaw} object} 19 | \item{scan}{ 20 | integer with number of scan to plot 21 | } 22 | \item{mzrange}{ 23 | numeric vector of length >= 2 whose range will be used to select 24 | masses to plot 25 | } 26 | \item{ident}{ 27 | logical, use mouse to interactively identify and label individual 28 | masses 29 | } 30 | } 31 | \seealso{ 32 | \code{\link{xcmsRaw-class}} 33 | } 34 | \keyword{methods} 35 | \keyword{hplot} 36 | -------------------------------------------------------------------------------- /man/plotSpec-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotSpec-methods} 2 | \docType{methods} 3 | %\alias{plotSpec-methods} 4 | \alias{plotSpec} 5 | \alias{plotSpec,xcmsRaw-method} 6 | \title{Plot mass spectra from the profile matrix} 7 | \description{ 8 | Uses the pre-generated profile mode matrix to plot mass spectra 9 | over a specified retention time range. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{plotSpec(object, ident = FALSE, vline = numeric(0), ...)} 15 | } 16 | }} 17 | \arguments{ 18 | \item{object}{the \code{xcmsRaw} object} 19 | \item{ident}{logical, use mouse to identify and label peaks} 20 | \item{vline}{numeric vector with locations of vertical lines} 21 | \item{...}{arguments passed to \code{\link{profRange}}} 22 | } 23 | \value{ 24 | If \code{ident == TRUE}, an integer vector with the indecies of 25 | the points that were identified. Otherwise a two-column matrix 26 | with the plotted points. 27 | } 28 | \seealso{ 29 | \code{\link{xcmsRaw-class}} 30 | } 31 | \keyword{methods} 32 | \keyword{hplot} 33 | \keyword{iplot} 34 | -------------------------------------------------------------------------------- /man/plotSurf-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotSurf-methods} 2 | \docType{methods} 3 | %\alias{plotSurf-methods} 4 | \alias{plotSurf} 5 | \alias{plotSurf,xcmsRaw-method} 6 | \title{Plot profile matrix 3D surface using OpenGL} 7 | \description{ 8 | This method uses the rgl package to create interactive three 9 | dimensonal representations of the profile matrix. It uses the terrain 10 | color scheme. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsRaw"}{ 15 | \code{plotSurf(object, log = FALSE, aspect = c(1, 1, .5), ...)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsRaw} object} 20 | \item{log}{logical, log transform intensity} 21 | \item{aspect}{ 22 | numeric vector with aspect ratio of the m/z, retention time and 23 | intensity components of the plot 24 | } 25 | \item{...}{arguments passed to \code{\link{profRange}}} 26 | } 27 | \details{ 28 | The rgl package is still in development and imposes some limitations 29 | on the output format. A bug in the axis label code means that the 30 | axis labels only go from 0 to the aspect ratio constant of that 31 | axis. Additionally the axes are not labeled with what they are. 32 | 33 | It is important to only plot a small portion of the profile matrix. 34 | Large portions can quickly overwhelm your CPU and memory. 35 | } 36 | \seealso{ 37 | \code{\link{xcmsRaw-class}} 38 | } 39 | \keyword{methods} 40 | \keyword{hplot} 41 | \keyword{iplot} 42 | -------------------------------------------------------------------------------- /man/plotTIC-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotTIC-methods} 2 | \docType{methods} 3 | %\alias{plotTIC-methods} 4 | \alias{plotTIC} 5 | \alias{plotTIC,xcmsRaw-method} 6 | \title{Plot total ion count} 7 | \description{ 8 | Plot chromatogram of total ion count. Optionally allow identification 9 | of target peaks and viewing/identification of individual spectra. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{plotTIC(object, ident = FALSE, msident = FALSE)} 15 | } 16 | }} 17 | \arguments{ 18 | \item{object}{the \code{xcmsRaw} object} 19 | \item{ident}{ 20 | logical, use mouse to identify and label chromatographic peaks 21 | } 22 | \item{msident}{ 23 | logical, use mouse to identify and label spectral peaks 24 | } 25 | } 26 | \value{ 27 | If \code{ident == TRUE}, an integer vector with the indecies of 28 | the points that were identified. Otherwise a two-column matrix 29 | with the plotted points. 30 | } 31 | \seealso{ 32 | \code{\link{xcmsRaw-class}} 33 | } 34 | \keyword{methods} 35 | \keyword{hplot} 36 | \keyword{iplot} 37 | -------------------------------------------------------------------------------- /man/plotrt-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{plotrt-methods} 2 | \docType{methods} 3 | %\alias{plotrt-methods} 4 | \alias{plotrt} 5 | \alias{plotrt,xcmsSet-method} 6 | \title{Plot retention time deviation profiles} 7 | \description{ 8 | Use corrected retention times for each sample to calculate retention 9 | time deviation profiles and plot each on the same graph. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{plotrt(object, col = NULL, ty = NULL, leg = TRUE, 15 | densplit = FALSE)} 16 | } 17 | }} 18 | \arguments{ 19 | \item{object}{the \code{xcmsSet} object} 20 | \item{col}{vector of colors for plotting each sample} 21 | \item{ty}{vector of line and point types for plotting each sample} 22 | \item{leg}{logical plot legend with sample labels} 23 | \item{densplit}{logical, also plot peak overall peak density} 24 | } 25 | \seealso{ 26 | \code{\link{xcmsSet-class}}, 27 | \code{\link{retcor}} 28 | } 29 | \keyword{methods} 30 | \keyword{hplot} 31 | -------------------------------------------------------------------------------- /man/profMedFilt-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{profMedFilt-methods} 2 | \docType{methods} 3 | %\alias{profMedFilt-methods} 4 | \alias{profMedFilt} 5 | \alias{profMedFilt,xcmsRaw-method} 6 | \title{Median filtering of the profile matrix} 7 | \description{ 8 | Apply a median filter of given size to a profile matrix. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{object = "xcmsRaw"}{ 13 | \code{profMedFilt(object, massrad = 0, scanrad = 0)} 14 | } 15 | }} 16 | \arguments{ 17 | \item{object}{the \code{xcmsRaw} object} 18 | \item{massrad}{ 19 | number of m/z grid points on either side to use for median 20 | calculation 21 | } 22 | \item{scanrad}{ 23 | number of scan grid points on either side to use for median 24 | calculation 25 | } 26 | } 27 | \seealso{ 28 | \code{\link{xcmsRaw-class}}, 29 | \code{\link{medianFilter}} 30 | } 31 | \keyword{methods} 32 | \keyword{manip} 33 | -------------------------------------------------------------------------------- /man/profMethod-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{profMethod-methods} 2 | \docType{methods} 3 | %\alias{profMethod-methods} 4 | %\alias{profMethod<--methods} 5 | \alias{profMethod} 6 | \alias{profMethod<-} 7 | \alias{profMethod,xcmsRaw-method} 8 | \alias{profMethod<-,xcmsRaw-method} 9 | \title{Get and set method for generating profile data} 10 | \description{ 11 | These methods get and set the method for generating profile 12 | (matrix) data from raw mass spectral data. It can currently be 13 | \code{bin}, \code{binlin}, \code{binlinbase}, or \code{intlin}. 14 | } 15 | \section{Methods}{ 16 | \describe{ 17 | \item{object = "xcmsRaw"}{ 18 | \code{profMethod(object)} 19 | } 20 | }} 21 | \seealso{ 22 | \code{\link{xcmsRaw-class}}, 23 | \code{\link{profMethod}}, 24 | \code{\link{profBin}}, 25 | \code{\link{plotSpec}}, 26 | \code{\link{plotChrom}}, 27 | \code{\link{findPeaks}} 28 | } 29 | \keyword{methods} 30 | \keyword{manip} 31 | -------------------------------------------------------------------------------- /man/profRange-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{profRange-methods} 2 | \docType{methods} 3 | %\alias{profRange-methods} 4 | \alias{profRange} 5 | \alias{profRange,xcmsRaw-method} 6 | \title{Specify a subset of profile mode data} 7 | \description{ 8 | Specify a subset of the profile mode matrix given a mass, time, 9 | or scan range. Allow flexible user entry for other functions. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsRaw"}{ 14 | \code{profRange(object, mzrange = numeric(), 15 | rtrange = numeric(), scanrange = numeric(), 16 | ...)} 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{the \code{xcmsRaw} object} 21 | \item{mzrange}{single numeric mass or vector of masses} 22 | \item{rtrange}{ 23 | single numeric time (in seconds) or vector of times 24 | } 25 | \item{scanrange}{single integer scan index or vector of indecies} 26 | \item{...}{arguments to other functions} 27 | } 28 | \details{ 29 | This function handles selection of mass/time subsets of the profile 30 | matrix for other functions. It allows the user to specify such 31 | subsets in a variety of flexible ways with minimal typing. 32 | 33 | Because \R does partial argument matching, \code{mzrange}, 34 | \code{scanrange}, and \code{rtrange} can be specified in short 35 | form using \code{m=}, \code{s=}, and \code{t=}, respectively. If 36 | both a \code{scanrange} and \code{rtrange} are specified, then 37 | the \code{rtrange} specification takes precedence. 38 | 39 | When specifying ranges, you may either enter a single number or 40 | a numeric vector. If a single number is entered, then the closest 41 | single scan or mass value is selected. If a vector is entered, 42 | then the range is set to the \code{range()} of the values entered. 43 | That allows specification of ranges using shortened, slightly 44 | non-standard syntax. For example, one could specify 400 to 500 45 | seconds using any of the following: \code{t=c(400,500)}, 46 | \code{t=c(500,400)}, or \code{t=400:500}. Use of the sequence 47 | operator (\code{:}) can save several keystrokes when specifying 48 | ranges. However, while the sequence operator works well for 49 | specifying integer ranges, fractional ranges do not always work 50 | as well. 51 | } 52 | \value{ 53 | A list with the folloing items: 54 | 55 | \item{mzrange}{numeric vector with start and end mass} 56 | \item{masslab}{textual label of mass range} 57 | \item{massidx}{integer vector of mass indecies} 58 | \item{scanrange}{integer vector with stat ane end scans} 59 | \item{scanlab}{textual label of scan range} 60 | \item{scanidx}{integer vector of scan range} 61 | \item{rtrange}{numeric vector of start and end times} 62 | \item{timelab}{textual label of time range} 63 | } 64 | \seealso{ 65 | \code{\link{xcmsRaw-class}} 66 | } 67 | \keyword{methods} 68 | \keyword{manip} 69 | -------------------------------------------------------------------------------- /man/profStep-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{profStep-methods} 2 | \docType{methods} 3 | %\alias{profStep-methods} 4 | %\alias{profStep<--methods} 5 | \alias{profStep} 6 | \alias{profStep<-} 7 | \alias{profStep,xcmsRaw-method} 8 | \alias{profStep<-,xcmsRaw-method} 9 | \title{Get and set m/z step for generating profile data} 10 | \description{ 11 | These methods get and set the m/z step for generating profile 12 | (matrix) data from raw mass spectral data. Smaller steps yield 13 | more precision at the cost of greater memory usage. 14 | } 15 | \section{Methods}{ 16 | \describe{ 17 | \item{object = "xcmsRaw"}{ 18 | \code{profStep(object)} 19 | } 20 | }} 21 | \seealso{ 22 | \code{\link{xcmsRaw-class}}, 23 | \code{\link{profMethod}} 24 | } 25 | \examples{ 26 | \dontrun{ 27 | library(faahKO) 28 | cdfpath <- system.file("cdf", package = "faahKO") 29 | cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE) 30 | xset <- xcmsRaw(cdffiles[1]) 31 | 32 | xset 33 | plotSurf(xset, mass=c(200,500)) 34 | 35 | profStep(xset)<-0.1 ## decrease the bin size to get better resolution 36 | plotSurf(xset, mass=c(200, 500)) 37 | ##works nicer on high resolution data. 38 | } 39 | } 40 | \keyword{methods} 41 | \keyword{manip} 42 | -------------------------------------------------------------------------------- /man/pval.Rd: -------------------------------------------------------------------------------- 1 | \name{pval} 2 | \alias{pval} 3 | \title{Generate p-values for a vector of t-statistics} 4 | \description{ 5 | Generate p-values for a vector of Welch's two-sample t-statistics 6 | based on the t distribution. 7 | } 8 | \usage{ 9 | pval(X, classlabel, teststat) 10 | } 11 | \arguments{ 12 | \item{X}{original data matrix} 13 | \item{classlabel}{integer vector with classlabel} 14 | \item{teststat}{numeric vector with Welch's two-sample t-statistics} 15 | } 16 | \value{ 17 | A numeric vector of p-values. 18 | } 19 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 20 | \keyword{univar} 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/rawEIC-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{rawEIC-methods} 2 | \docType{methods} 3 | \alias{rawEIC} 4 | \alias{rawEIC,xcmsRaw-method} 5 | \title{Get extracted ion chromatograms for specified m/z range} 6 | \description{ 7 | Generate extracted ion chromatogram for m/z values of interest. The 8 | raw data is used in contrast to \code{\link{getEIC}} which uses 9 | data from the profile matrix (i.e. values binned along the M/Z 10 | dimension). 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsRaw"}{ 15 | \code{ 16 | rawEIC(object, mzrange = numeric(), rtrange = numeric(), scanrange = numeric()) 17 | } 18 | } 19 | }} 20 | \arguments{ 21 | \item{object}{\code{xcmsRaw} object} 22 | \item{mzrange}{ 23 | m/z range for EIC 24 | } 25 | \item{rtrange}{ 26 | retention time range for EIC 27 | } 28 | \item{scanrange}{ 29 | scan range for EIC 30 | } 31 | } 32 | \value{ 33 | A list of : 34 | 35 | \item{scan}{ 36 | scan number 37 | } 38 | \item{intensity}{ 39 | added intensity values 40 | } 41 | 42 | } 43 | 44 | \author{Ralf Tautenhahn} 45 | 46 | \seealso{ 47 | \code{\link{xcmsRaw-class}} 48 | } 49 | \keyword{methods} 50 | -------------------------------------------------------------------------------- /man/rawMat-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{rawMat-methods} 2 | \docType{methods} 3 | \alias{rawMat} 4 | \alias{rawMat-methods} 5 | \alias{rawMat,xcmsRaw-method} 6 | \title{Get a raw data matrix} 7 | \description{ 8 | Returns a matrix with columns for time, m/z, and intensity that 9 | represents the raw data from a chromatography mass spectrometry experiment. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | 14 | \item{object = "xcmsRaw"}{ 15 | \code{rawMat(object, mzrange = numeric(), rtrange = numeric(), 16 | scanrange = numeric(), log=FALSE)} 17 | } 18 | }} 19 | \arguments{ 20 | \item{object}{The container of the raw data} 21 | \item{mzrange}{Subset by m/z range} 22 | \item{rtrange}{Subset by retention time range} 23 | \item{scanrange}{Subset by scan index range} 24 | \item{log}{Whether to log transform the intensities} 25 | } 26 | \value{ 27 | A numeric matrix with three columns: time, mz and intensity. 28 | } 29 | \seealso{\code{\link{plotRaw}} for plotting the raw intensities} 30 | \author{Michael Lawrence} 31 | \keyword{methods} 32 | -------------------------------------------------------------------------------- /man/rectUnique.Rd: -------------------------------------------------------------------------------- 1 | \name{rectUnique} 2 | \alias{rectUnique} 3 | \title{Determine a subset of rectangles with unique, non-overlapping areas} 4 | \description{ 5 | Given a matrix of rectangular areas, this function determines a subset 6 | of those rectangles that do not overlap. Rectangles are preserved on 7 | a first come, first served basis, with user control over the order in 8 | which the rectangles are processed. 9 | } 10 | \usage{ 11 | rectUnique(m, order = seq(length = nrow(m)), xdiff = 0, ydiff = 0) 12 | } 13 | \arguments{ 14 | \item{m}{four column matrix defining rectangular areas} 15 | \item{order}{order in which matrix columns should be scanned} 16 | \item{xdiff}{maximum space between overlapping rectangles in x dimension} 17 | \item{ydiff}{maximum space between overlapping rectangles in y dimension} 18 | } 19 | \details{ 20 | The \code{m} matrix must contain four colums defining the position of 21 | rectangle sides in the folloing order: left, right, bottom, top. This 22 | function is currently implemented in \code{C} using a an algorithm 23 | with quadratic running time. 24 | } 25 | \value{ 26 | A logical vector indicating which rows should be kept. 27 | } 28 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 29 | \examples{ 30 | m <- rbind(c(0,4,0,3), c(1,3,2,6), c(3,6,4,6)) 31 | plot(0, 0, type = "n", xlim=range(m[,1:2]), ylim=range(m[,3:4])) 32 | rect(m[,1], m[,3], m[,2], m[,4]) 33 | xcms:::rectUnique(m) 34 | # Changing order of processing 35 | xcms:::rectUnique(m, c(2,1,3)) 36 | # Requiring border spacing 37 | xcms:::rectUnique(m, ydiff = 1) 38 | # Allowing adjacent boxes 39 | xcms:::rectUnique(m, c(2,1,3), xdiff = -0.00001) 40 | # Allowing interpenetration 41 | xcms:::rectUnique(m, xdiff = -1.00001, ydiff = -1.00001) 42 | } 43 | \keyword{array} 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /man/retcor-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{retcor-methods} 2 | \docType{methods} 3 | \alias{retcor-methods} 4 | \alias{retcor} 5 | \alias{retcor,xcmsSet-method} 6 | \title{Correct retention time from different samples} 7 | \description{ 8 | To correct differences between retention times between different 9 | samples, a number of of methods exist in XCMS. \code{retcor} 10 | is the generic method. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{object = "xcmsSet"}{ 15 | \code{ 16 | retcor(object, ...) 17 | } 18 | } 19 | }} 20 | \arguments{ 21 | \item{object}{\code{\link{xcmsSet-class}} object} 22 | \item{method}{Method to use for retention time correction. See details.} 23 | \item{...}{Optional arguments to be passed along} 24 | } 25 | \details{ 26 | Different algorithms can be used by specifying them with the 27 | \code{method} argument. For example to use the approach described by 28 | Smith et al (2006) one would use: \code{retcor(object, 29 | method="loess")}. This is also the default. 30 | 31 | Further arguments given by \code{...} are 32 | passed through to the function implementing 33 | the \code{method}. 34 | 35 | A character vector of \emph{nicknames} for the 36 | algorithms available is returned by 37 | \code{getOption("BioC")$xcms$retcor.methods}. 38 | If the nickname of a method is called "loess", 39 | the help page for that specific method can 40 | be accessed with \code{?retcor.loess}. 41 | } 42 | 43 | \value{ 44 | An \code{xcmsSet} object with corrected retntion times. 45 | } 46 | \seealso{ 47 | \code{\link{retcor.loess}} 48 | \code{\link{retcor.obiwarp}} 49 | \code{\link{xcmsSet-class}}, 50 | } 51 | \keyword{methods} 52 | -------------------------------------------------------------------------------- /man/retcor.obiwarp-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{retcor.obiwarp} 2 | \docType{methods} 3 | \alias{retcor.obiwarp} 4 | \alias{retcor.obiwarp,xcmsSet-method} 5 | 6 | \title{Align retention times across samples with Obiwarp} 7 | 8 | \description{ 9 | Calculate retention time deviations for each sample. 10 | It is based on the code at \url{http://obi-warp.sourceforge.net/}. 11 | However, this function is able to align multiple samples, by a 12 | center-star strategy. 13 | 14 | For the original publication see 15 | 16 | Chromatographic Alignment of ESI-LC-MS Proteomics Data Sets by 17 | Ordered Bijective Interpolated Warping John T. Prince and, Edward 18 | M. Marcotte Analytical Chemistry 2006 78 (17), 6140-6152 19 | } 20 | 21 | \section{Methods}{ 22 | \describe{ 23 | \item{object = "xcmsSet"}{ 24 | retcor(object, method="obiwarp", plottype = c("none", "deviation"), 25 | profStep=1, center=NULL, col = NULL, ty = NULL, 26 | response=1, distFunc="cor_opt", gapInit=NULL, gapExtend=NULL, 27 | factorDiag=2, factorGap=1, localAlignment=0, initPenalty=0) 28 | } 29 | }} 30 | 31 | \arguments{ 32 | \item{object}{the \code{xcmsSet} object} 33 | \item{plottype}{if \code{deviation} plot retention time deviation} 34 | \item{profStep}{step size (in m/z) to use for profile generation from 35 | the raw data files} 36 | \item{center}{the index of the sample all others will be aligned 37 | to. If center==NULL, the sample with the most peaks is chosen as default.} 38 | \item{col}{vector of colors for plotting each sample} 39 | \item{ty}{vector of line and point types for plotting each sample} 40 | \item{response}{Responsiveness of warping. 0 will give a linear warp based 41 | on start and end points. 100 will use all bijective anchors} 42 | \item{distFunc}{DistFunc function: cor (Pearson's R) or cor_opt (default, 43 | calculate only 10\% diagonal band of distance matrix, better 44 | runtime), cov (covariance), prd (product), euc (Euclidean distance)} 45 | \item{gapInit}{Penalty for Gap opening, see below} 46 | \item{gapExtend}{Penalty for Gap enlargement, see below} 47 | \item{factorDiag}{Local weighting applied to diagonal moves in alignment.} 48 | \item{factorGap}{Local weighting applied to gap moves in alignment.} 49 | \item{localAlignment}{Local rather than global alignment} 50 | \item{initPenalty}{Penalty for initiating alignment (for local 51 | alignment only) Default: 0} 52 | 53 | Default gap penalties: (gapInit, gapExtend) [by distFunc type]: 54 | 'cor' = '0.3,2.4' 55 | 'cov' = '0,11.7' 56 | 'prd' = '0,7.8' 57 | 'euc' = '0.9,1.8' 58 | } 59 | \value{ 60 | An \code{xcmsSet} object 61 | } 62 | \seealso{ 63 | \code{\link{xcmsSet-class}}, 64 | } 65 | \keyword{methods} 66 | -------------------------------------------------------------------------------- /man/retcor.peakgroups-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{retcor.peakgroups-methods} 2 | \docType{methods} 3 | \alias{retcor.peakgroups} 4 | \alias{retcor.peakgroups,xcmsSet-method} 5 | \alias{retcor.loess} 6 | \alias{retcor.loess,xcmsSet-method} 7 | \alias{retcor.linear} 8 | \alias{retcor.linear,xcmsSet-method} 9 | \title{Align retention times across samples} 10 | \description{ 11 | These two methods use ``well behaved'' peak groups to calculate 12 | retention time deviations for every time point of each sample. Use 13 | smoothed deviations to align retention times. 14 | } 15 | \section{Methods}{ 16 | \describe{ 17 | \item{object = "xcmsSet"}{ 18 | \code{retcor(object, missing = 1, extra = 1, 19 | smooth = c("loess", "linear"), span = .2, 20 | family = c("gaussian", "symmetric"), 21 | plottype = c("none", "deviation", "mdevden"), 22 | col = NULL, ty = NULL)} 23 | } 24 | }} 25 | \arguments{ 26 | \item{object}{the \code{xcmsSet} object} 27 | \item{missing}{ 28 | number of missing samples to allow in retention time correction 29 | groups 30 | } 31 | \item{extra}{ 32 | number of extra peaks to allow in retention time correction 33 | correction groups 34 | } 35 | \item{smooth}{ 36 | either \code{"loess"} for non-linear alignment or \code{"linear"} 37 | for linear alignment 38 | } 39 | \item{span}{ 40 | degree of smoothing for local polynomial regression fitting 41 | } 42 | \item{family}{ 43 | if \code{gaussian} fitting is by least-squares with no outlier 44 | removal, and if \code{symmetric} a re-descending M estimator 45 | is used with Tukey's biweight function, allowing outlier removal 46 | } 47 | \item{plottype}{ 48 | if \code{deviation} plot retention time deviation points and 49 | regression fit, and if \code{mdevden} also plot peak overall 50 | peak density and retention time correction peak density 51 | } 52 | \item{col}{vector of colors for plotting each sample} 53 | \item{ty}{vector of line and point types for plotting each sample} 54 | } 55 | \value{ 56 | An \code{xcmsSet} object 57 | } 58 | \seealso{ 59 | \code{\link{xcmsSet-class}}, 60 | \code{\link{loess}} 61 | \code{\link{retcor.obiwarp}} 62 | } 63 | \keyword{methods} 64 | \keyword{file} 65 | -------------------------------------------------------------------------------- /man/retexp.Rd: -------------------------------------------------------------------------------- 1 | \name{retexp} 2 | \alias{retexp} 3 | \title{Set retention time window to a specified width} 4 | \description{ 5 | Expands (or contracts) the retention time window in each row of 6 | a matrix as defined by the \code{retmin} and \code{retmax} columns. 7 | } 8 | \usage{ 9 | retexp(peakrange, width = 200) 10 | } 11 | \arguments{ 12 | \item{peakrange}{maxtrix with columns \code{retmin} and \code{retmax}} 13 | \item{width}{new width for the window} 14 | } 15 | \value{ 16 | The altered matrix. 17 | } 18 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 19 | \seealso{ 20 | \code{\link{getEIC}} 21 | } 22 | \keyword{manip} 23 | -------------------------------------------------------------------------------- /man/rla.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-utils.R 3 | \name{rla} 4 | \alias{rla} 5 | \alias{rowRla} 6 | \title{Calculate relative log abundances} 7 | \usage{ 8 | rla(x, group, log.transform = TRUE) 9 | 10 | rowRla(x, group, log.transform = TRUE) 11 | } 12 | \arguments{ 13 | \item{x}{\code{numeric} (for \code{rla}) or \code{matrix} (for \code{rowRla}) with the 14 | abundances (in natural scale) on which the RLA should be calculated.} 15 | 16 | \item{group}{\code{factor}, \code{numeric} or \code{character} with the same length 17 | than \code{x} that groups values in \code{x}. If omitted all values are considered 18 | to be from the same group.} 19 | 20 | \item{log.transform}{\code{logical(1)} whether \code{x} should be log2 transformed. 21 | Set to \code{log.transform = FALSE} if \code{x} is already in log scale.} 22 | } 23 | \value{ 24 | \code{numeric} of the same length than \code{x} (for \code{rla}) or \code{matrix} with 25 | the same dimensions than \code{x} (for \code{rowRla}). 26 | } 27 | \description{ 28 | \code{rla} calculates the relative log abundances (RLA, see reference) on a 29 | \code{numeric} vector. 30 | } 31 | \details{ 32 | The RLA is defines as the (log) abundance of an analyte relative 33 | to the median across all abundances of the same group. 34 | } 35 | \examples{ 36 | 37 | x <- c(3, 4, 5, 1, 2, 3, 7, 8, 9) 38 | 39 | grp <- c(1, 1, 1, 2, 2, 2, 3, 3, 3) 40 | 41 | rla(x, grp) 42 | } 43 | \references{ 44 | De Livera AM, Dias DA, De Souza D, Rupasinghe T, Pyke J, Tull D, Roessner U, 45 | McConville M, Speed TP. Normalizing and integrating metabolomics data. 46 | \emph{Anal Chem} 2012 Dec 18;84(24):10768-76. 47 | doi: \href{https://doi.org/10.1021/ac302748b}{10.1021/ac302748b} 48 | } 49 | \author{ 50 | Johannes Rainer 51 | } 52 | -------------------------------------------------------------------------------- /man/sampnames-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{sampnames-methods} 2 | \docType{methods} 3 | %\alias{sampnames-methods} 4 | \alias{sampnames} 5 | \alias{sampnames,xcmsEIC-method} 6 | \alias{sampnames,xcmsSet-method} 7 | \title{Get sample names} 8 | \description{ 9 | Return sample names for an object 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsEIC"}{ 14 | sampnames(object) 15 | } 16 | \item{object = "xcmsSet"}{ 17 | sampnames(object) 18 | } 19 | }} 20 | \value{ 21 | A character vector with sample names. 22 | } 23 | \seealso{ 24 | \code{\link{xcmsSet-class}}, 25 | \code{\link{xcmsEIC-class}} 26 | } 27 | \keyword{methods} 28 | \keyword{file} 29 | -------------------------------------------------------------------------------- /man/showError-xcmsSet-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-xcmsSet.R 3 | \name{showError,xcmsSet-method} 4 | \alias{showError,xcmsSet-method} 5 | \alias{showError} 6 | \title{Extract processing errors} 7 | \usage{ 8 | \S4method{showError}{xcmsSet}(object, message. = TRUE, ...) 9 | } 10 | \arguments{ 11 | \item{object}{An \code{xcmsSet} object.} 12 | 13 | \item{message.}{Logical indicating whether only the error message, or the 14 | error itself should be returned.} 15 | 16 | \item{...}{Additional arguments.} 17 | } 18 | \value{ 19 | A list of error messages (if \code{message. = TRUE}) or errors or an 20 | empty list if no errors are present. 21 | } 22 | \description{ 23 | If peak detection is performed with \code{findPeaks} 24 | setting argument \code{stopOnError = FALSE} eventual errors during the 25 | process do not cause to stop the processing but are recorded inside of 26 | the resulting \code{xcmsSet} object. These errors can be 27 | accessed with the \code{showError} method. 28 | } 29 | \author{ 30 | Johannes Rainer 31 | } 32 | -------------------------------------------------------------------------------- /man/specDist-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{specDist-methods} 2 | \docType{methods} 3 | \alias{specDist-methods} 4 | \alias{specDist} 5 | \alias{specDist,xcmsSet-method} 6 | \title{Distance methods for xcmsSet, xcmsRaw and xsAnnotate} 7 | \description{ 8 | There are several methods for calculating a distance between two sets of peaks in xcms. \code{specDist} 9 | is the generic method. 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{ 15 | specDist(object, peakIDs1, peakIDs2,...) 16 | } 17 | } 18 | } 19 | \describe{ 20 | \item{object = "xsAnnotate"}{ 21 | \code{ 22 | specDist(object, PSpec1, PSpec2,...) 23 | } 24 | } 25 | } 26 | 27 | } 28 | 29 | 30 | \arguments{ 31 | \item{object}{a xcmsSet or xcmsRaw.} 32 | \item{method}{Method to use for distance calculation. See details.} 33 | \item{...}{mzabs, mzppm and parameters for the distance function.} 34 | } 35 | \details{ 36 | Different algorithms can be used by specifying them with the 37 | \code{method} argument. For example to use the "meanMZmatch" 38 | approach with xcmsSet one would use: 39 | \code{specDist(object, peakIDs1, peakIDs2, method="meanMZmatch")}. This is also 40 | the default. 41 | 42 | Further arguments given by \code{...} are 43 | passed through to the function implementing 44 | the \code{method}. 45 | 46 | A character vector of \emph{nicknames} for the 47 | algorithms available is returned by 48 | \code{getOption("BioC")$xcms$specDist.methods}. 49 | If the nickname of a method is called "meanMZmatch", 50 | the help page for that specific method can 51 | be accessed with \code{?specDist.meanMZmatch}. 52 | } 53 | \value{ 54 | \item{mzabs}{ 55 | maximum absolute deviation for two matching peaks 56 | } 57 | \item{mzppm}{ 58 | relative deviations in ppm for two matching peaks 59 | } 60 | \item{symmetric}{ 61 | use symmetric pairwise m/z-matches only, or each match 62 | } 63 | } 64 | 65 | \author{Joachim Kutzera, \email{jkutzer@ipb-halle.de}} 66 | \keyword{methods} 67 | -------------------------------------------------------------------------------- /man/specDist.cosine-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{specDist.cosine} 2 | \docType{methods} 3 | \alias{specDist.cosine} 4 | \alias{specDist.cosine,matrix,matrix-method} 5 | \title{a Distance function based on matching peaks} 6 | \description{This method calculates the distance of two sets of peaks 7 | using the cosine-distance.} 8 | \section{Methods}{ 9 | \describe{ 10 | \item{peakTable1 = "matrix", peakTable2 = "matrix"}{ 11 | \code{ 12 | specDist.cosine(peakTable1, peakTable2, mzabs = 0.001, mzppm = 10, 13 | mzExp = 0.6, intExp = 3, nPdiff = 2, nPmin = 8, 14 | symmetric = FALSE) 15 | } 16 | } 17 | }} 18 | \details{ 19 | The result is the cosine-distance of the product from weighted factors 20 | of mz and intensity from matching peaks in the two peaktables. 21 | The factors are calculated as wFact = mz^mzExp * int^intExp. 22 | if no distance is calculated (for example because no matching 23 | peaks were found) the return-value is NA. 24 | } 25 | 26 | \arguments{ 27 | \item{peakTable1}{a Matrix containing at least m/z-values, 28 | row must be called "mz"} 29 | \item{peakTable2}{the matrix for the other mz-values} 30 | \item{mzabs}{maximum absolute deviation for two matching peaks} 31 | \item{mzppm}{relative deviations in ppm for two matching peaks} 32 | \item{symmetric}{use symmetric pairwise m/z-matches only, or each match} 33 | \item{mzExp}{the exponent used for mz} 34 | \item{intExp}{the exponent used for intensity} 35 | \item{nPdiff}{the maximum nrow-difference of the two peaktables} 36 | \item{nPmin}{the minimum absolute sum of peaks from both praktables} 37 | } 38 | \usage{ 39 | specDist.cosine(peakTable1, peakTable2, mzabs=0.001, mzppm=10, mzExp=0.6, 40 | intExp=3, nPdiff=2, nPmin=8, symmetric=FALSE) 41 | } 42 | \author{Joachim Kutzera, \email{jkutzer@ipb-halle.de}} 43 | \keyword{methods} 44 | -------------------------------------------------------------------------------- /man/specDist.meanMZmatch-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{specDist.meanMZmatch} 2 | \docType{methods} 3 | \alias{specDist.meanMZmatch} 4 | \alias{specDist.meanMZmatch,matrix,matrix-method} 5 | \title{a Distance function based on matching peaks} 6 | \description{This method calculates the distance of two sets of peaks.} 7 | \section{Methods}{ 8 | \describe{ 9 | \item{peakTable1 = "matrix", peakTable2 = "matrix"}{ 10 | \code{ 11 | specDist.meanMZmatch(peakTable1, peakTable2, 12 | matchdist=1, matchrate=1, 13 | mzabs=0.001, mzppm=10, symmetric=TRUE) 14 | } 15 | } 16 | }} 17 | \details{ 18 | The result of the calculation is a weighted sum of two values. 19 | Value one is the mean absolute difference of the matching peaks, 20 | value two is the relation of matching peaks and non matching peaks. 21 | if no distance is calculated (for example because no matching peaks 22 | were found) the return-value is NA. 23 | } 24 | \arguments{ 25 | \item{peakTable1}{a Matrix containing at least m/z-values, 26 | row must be called "mz"} 27 | \item{peakTable2}{the matrix for the other mz-values} 28 | \item{mzabs}{maximum absolute deviation for two matching peaks} 29 | \item{mzppm}{relative deviations in ppm for two matching peaks} 30 | \item{symmetric}{use symmetric pairwise m/z-matches only, or each match} 31 | \item{matchdist}{the weight for value one (see details) } 32 | \item{matchrate}{the weight for value two} 33 | } 34 | \usage{ 35 | specDist.meanMZmatch(peakTable1, peakTable2, matchdist=1, matchrate=1, 36 | mzabs=0.001, mzppm=10, symmetric=TRUE) 37 | } 38 | \author{Joachim Kutzera, \email{jkutzer@ipb-halle.de}} 39 | \keyword{methods} 40 | -------------------------------------------------------------------------------- /man/specDist.peakCount-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{specDist.peakCount-methods} 2 | \docType{methods} 3 | \alias{specDist.peakCount-methods} 4 | \alias{specDist.peakCount} 5 | \alias{specDist.peakCount,matrix,matrix-method} 6 | 7 | \title{a Distance function based on matching peaks} 8 | \description{This method calculates the distance of two sets of peaks by just returning the number of matching peaks (m/z-values).} 9 | \section{Methods}{ 10 | \describe{ 11 | \item{peakTable1 = "matrix", peakTable2 = "matrix"}{ 12 | \code{ 13 | specDist.peakCount(peakTable1, peakTable2, mzppm=10,symmetric=FALSE ) 14 | }} 15 | }} 16 | \arguments{ 17 | \item{peakTable1}{a Matrix containing at least m/z-values, 18 | row must be called "mz"} 19 | \item{peakTable2}{the matrix for the other mz-values} 20 | \item{mzabs}{maximum absolute deviation for two matching peaks} 21 | \item{mzppm}{relative deviations in ppm for two matching peaks} 22 | \item{symmetric}{use symmetric pairwise m/z-matches only, or each match} 23 | } 24 | \usage{ 25 | specDist.peakCount(peakTable1, peakTable2, mzabs=0.001, mzppm=10, symmetric=FALSE) 26 | } 27 | \author{Joachim Kutzera, \email{jkutzer@ipb-halle.de}} 28 | \keyword{methods} 29 | -------------------------------------------------------------------------------- /man/specNoise.Rd: -------------------------------------------------------------------------------- 1 | \name{specNoise} 2 | \alias{specNoise} 3 | \title{Calculate noise for a sparse continuum mass spectrum} 4 | \description{ 5 | Given a sparse continuum mass spectrum, determine regions where 6 | no signal is present, substituting half of the minimum intensity 7 | for those regions. Calculate the noise level as the weighted mean 8 | of the regions with signal and the regions without signal. 9 | If there is only one raw peak, return zero. 10 | } 11 | \usage{ 12 | specNoise(spec, gap = quantile(diff(spec[, "mz"]), 0.9)) 13 | } 14 | \arguments{ 15 | \item{spec}{matrix with named columns \code{mz} and \code{intensity}} 16 | \item{gap}{ 17 | threshold above which to data points are considerd to be separated 18 | by a blank region and not bridged by an interpolating line 19 | } 20 | } 21 | \details{ 22 | The default gap value is determined from the 90th percentile of 23 | the pair-wise differences between adjacent mass values. 24 | } 25 | \value{ 26 | A numeric noise level 27 | } 28 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 29 | \seealso{ 30 | \code{\link{getSpec}}, 31 | \code{\link{specPeaks}} 32 | } 33 | \keyword{manip} 34 | -------------------------------------------------------------------------------- /man/specPeaks.Rd: -------------------------------------------------------------------------------- 1 | \name{specPeaks} 2 | \alias{specPeaks} 3 | \title{Identify peaks in a sparse continuum mode spectrum} 4 | \description{ 5 | Given a spectrum, identify and list significant peaks as determined 6 | by several criteria. 7 | } 8 | \usage{ 9 | specPeaks(spec, sn = 20, mzgap = 0.2) 10 | } 11 | \arguments{ 12 | \item{spec}{matrix with named columns \code{mz} and \code{intensity}} 13 | \item{sn}{minimum signal to noise ratio} 14 | \item{mzgap}{ 15 | minimal distance between adjacent peaks, with smaller peaks 16 | being excluded 17 | } 18 | } 19 | \details{ 20 | Peaks must meet two criteria to be considered peaks: 1) Their 21 | s/n ratio must exceed a certain threshold. 2) They must not be 22 | within a given distance of any greater intensity peaks. 23 | } 24 | \value{ 25 | A matrix with columns: 26 | 27 | \item{mz}{m/z at maximum peak intensity} 28 | \item{intensity}{maximum intensity of the peak} 29 | \item{fwhm}{full width at half max of the peak} 30 | } 31 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 32 | \seealso{ 33 | \code{\link{getSpec}}, 34 | \code{\link{specNoise}} 35 | } 36 | \keyword{manip} 37 | -------------------------------------------------------------------------------- /man/split.xcmsRaw.Rd: -------------------------------------------------------------------------------- 1 | \name{split.xcmsRaw} 2 | \docType{methods} 3 | \alias{split.xcmsRaw} 4 | \title{Divide an xcmsRaw object} 5 | \description{ 6 | Divides the scans from a \code{xcmsRaw} object into 7 | a list of multiple objects. MS$^n$ data is discarded. 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{xr = "xcmsRaw"}{ 12 | \code{ 13 | split(x, f, drop = TRUE, ...) 14 | } 15 | } 16 | }} 17 | 18 | \arguments{ 19 | \item{x}{\code{xcmsRaw} object} 20 | \item{f}{factor such that \code{factor(f)} defines the scans which go 21 | into the new \code{xcmsRaw} objects} 22 | \item{drop}{ 23 | logical indicating if levels that do not occur should be dropped 24 | (if 'f' is a 'factor' or a list). 25 | } 26 | \item{\dots}{further potential arguments passed to methods.} 27 | } 28 | \value{ 29 | A list of \code{xcmsRaw} objects. 30 | } 31 | \author{Steffen Neumann, \email{sneumann@ipb-halle.de}} 32 | \seealso{ 33 | \code{\link{xcmsRaw-class}} 34 | } 35 | \keyword{manip} 36 | -------------------------------------------------------------------------------- /man/split.xcmsSet.Rd: -------------------------------------------------------------------------------- 1 | \name{split.xcmsSet} 2 | \docType{methods} 3 | \alias{split.xcmsSet} 4 | \alias{split, split-methods} 5 | \title{Divide an xcmsSet object} 6 | \description{ 7 | Divides the samples and peaks from a \code{xcmsSet} object into 8 | a list of multiple objects. Group data is discarded. 9 | } 10 | \section{Methods}{ 11 | \describe{ 12 | \item{xs = "xcmsSet"}{ 13 | \code{ 14 | split(x, f, drop = TRUE, ...) 15 | } 16 | } 17 | }} 18 | 19 | \arguments{ 20 | \item{xs}{\code{xcmsSet} object} 21 | \item{f}{factor such that \code{factor(f)} defines the grouping} 22 | \item{drop}{ 23 | logical indicating if levels that do not occur should be dropped 24 | (if 'f' is a 'factor' or a list). 25 | } 26 | \item{\dots}{further potential arguments passed to methods.} 27 | } 28 | \value{ 29 | A list of \code{xcmsSet} objects. 30 | } 31 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 32 | \seealso{ 33 | \code{\link{xcmsSet-class}} 34 | } 35 | \keyword{manip} 36 | -------------------------------------------------------------------------------- /man/stitch-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{stitch-methods} 2 | \docType{methods} 3 | \alias{stitch} 4 | \alias{stitch-methods} 5 | \alias{stitch,xcmsRaw-method} 6 | \alias{stitch.netCDF} 7 | \alias{stitch.xml} 8 | \alias{makeacqNum} 9 | \alias{makeacqNum, xcmsRaw-method} 10 | 11 | \title{Correct gaps in data} 12 | \description{ 13 | Fixes gaps in data due to calibration scans or lock mass. Automatically detects file type 14 | and calls the relevant method. The mzXML file keeps the data the same length in time but 15 | overwrites the lock mass scans. The netCDF version adds the scans back into the data thereby 16 | increasing the length of the data and correcting for the unseen gap. 17 | } 18 | \section{Methods}{ 19 | \describe{ 20 | \item{object = "xcmsRaw"}{ 21 | \code{ 22 | stitch(object, lockMass=numeric()) 23 | } 24 | } 25 | } 26 | \describe{ 27 | \item{object = "xcmsRaw"}{ 28 | \code{ 29 | makeacqNum(object, freq=numeric(), start=1) 30 | } 31 | } 32 | } 33 | 34 | } 35 | 36 | \arguments{ 37 | \item{object}{An \code{\link{xcmsRaw-class}} object} 38 | \item{lockMass}{A dataframe of locations of the gaps} 39 | \item{freq}{The intervals of the lock mass scans} 40 | \item{start}{The starting lock mass scan location, default is 1} 41 | } 42 | \details{ 43 | \code{makeacqNum} takes locates the gap using the starting lock mass scan and it's intervals. This data frame is then used in 44 | \code{stitch} to correct for the gap caused by the lock mass. Correction works by using scans from either side of the gap to fill it in. 45 | } 46 | \value{ 47 | \code{stitch} A corrected \code{xcmsRaw-class} object 48 | \code{makeacqNum} A numeric vector of scan locations corresponding to lock Mass scans 49 | 50 | } 51 | \author{Paul Benton, \email{hpaul.benton08@imperial.ac.uk}} 52 | \examples{ 53 | \dontrun{library(xcms) 54 | library(faahKO) 55 | ## These files do not have this problem to correct for but just 56 | ## for an example 57 | cdfpath <- system.file("cdf", package = "faahKO") 58 | cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE) 59 | xr<-xcmsRaw(cdffiles[1]) 60 | xr 61 | ##Lets assume that the lockmass starts at 1 and is every 100 scans 62 | lockMass<-xcms:::makeacqNum(xr, freq=100, start=1) 63 | ## these are equcal 64 | lockmass<-AutoLockMass(xr) 65 | ob<-stitch(xr, lockMass) 66 | ob 67 | 68 | ## plot the old data before correction 69 | foo<-rawEIC(xr, m=c(200,210), scan=c(80,140)) 70 | plot(foo$scan, foo$intensity, type="h") 71 | 72 | ## plot the new corrected data to see what changed 73 | foo<-rawEIC(ob, m=c(200,210), scan=c(80,140)) 74 | plot(foo$scan, foo$intensity, type="h") 75 | } 76 | } 77 | \keyword{manip} 78 | \keyword{methods} 79 | -------------------------------------------------------------------------------- /man/sub-xcmsRaw-logicalOrNumeric-missing-missing-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-xcmsRaw.R 3 | \name{[,xcmsRaw,logicalOrNumeric,missing,missing-method} 4 | \alias{[,xcmsRaw,logicalOrNumeric,missing,missing-method} 5 | \alias{subset-xcmsRaw} 6 | \title{Subset an xcmsRaw object by scans} 7 | \usage{ 8 | \S4method{[}{xcmsRaw,logicalOrNumeric,missing,missing}(x, i, j, drop) 9 | } 10 | \arguments{ 11 | \item{x}{The \code{xcmsRaw} object that should be sub-setted.} 12 | 13 | \item{i}{Integer or logical vector specifying the scans/spectra to which 14 | \code{x} should be sub-setted.} 15 | 16 | \item{j}{Not supported.} 17 | 18 | \item{drop}{Not supported.} 19 | } 20 | \value{ 21 | The sub-setted \code{xcmsRaw} object. 22 | } 23 | \description{ 24 | Subset an \code{xcmsRaw} object by scans. The 25 | returned \code{xcmsRaw} object contains values for all 26 | scans specified with argument \code{i}. Note that the \code{scanrange} 27 | slot of the returned \code{xcmsRaw} will be 28 | \code{c(1, length(object@scantime))} and hence not \code{range(i)}. 29 | } 30 | \details{ 31 | Only subsetting by scan index in increasing order or by a logical 32 | vector are supported. If not ordered, argument \code{i} is sorted 33 | automatically. Indices which are larger than the total number of scans 34 | are discarded. 35 | } 36 | \examples{ 37 | ## Load a test file 38 | file <- system.file('cdf/KO/ko15.CDF', package = "faahKO") 39 | xraw <- xcmsRaw(file, profstep = 0) 40 | ## The number of scans/spectra: 41 | length(xraw@scantime) 42 | 43 | ## Subset the object to scans with a scan time from 3500 to 4000. 44 | xsub <- xraw[xraw@scantime >= 3500 & xraw@scantime <= 4000] 45 | range(xsub@scantime) 46 | ## The number of scans: 47 | length(xsub@scantime) 48 | ## The number of values of the subset: 49 | length(xsub@env$mz) 50 | } 51 | \author{ 52 | Johannes Rainer 53 | } 54 | -------------------------------------------------------------------------------- /man/updateObject-xcmsSet-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-xcmsSet.R 3 | \name{updateObject,xcmsSet-method} 4 | \alias{updateObject,xcmsSet-method} 5 | \title{Update an \code{xcmsSet} object} 6 | \usage{ 7 | \S4method{updateObject}{xcmsSet}(object, ..., verbose = FALSE) 8 | } 9 | \arguments{ 10 | \item{object}{The \code{xcmsSet} object to update.} 11 | 12 | \item{...}{Optional additional arguments. Currently ignored.} 13 | 14 | \item{verbose}{Currently ignored.} 15 | } 16 | \value{ 17 | An updated \code{xcmsSet} containing all data from 18 | the input object. 19 | } 20 | \description{ 21 | This method updates an old \code{xcmsSet} 22 | object to the latest definition. 23 | } 24 | \author{ 25 | Johannes Rainer 26 | } 27 | -------------------------------------------------------------------------------- /man/useOriginalCode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions-utils.R 3 | \name{useOriginalCode} 4 | \alias{useOriginalCode} 5 | \title{Enable usage of old xcms code} 6 | \usage{ 7 | useOriginalCode(x) 8 | } 9 | \arguments{ 10 | \item{x}{\code{logical(1)} to specify whether or not original 11 | old code should be used in corresponding functions. If not provided the 12 | function simply returns the value of the global option.} 13 | } 14 | \value{ 15 | \code{logical(1)} indicating whether old code is being used. 16 | } 17 | \description{ 18 | This function allows to enable the usage of old, partially deprecated 19 | code from xcms by setting a corresponding global option. See details 20 | for functions affected. 21 | } 22 | \details{ 23 | The functions/methods that are affected by this option are: 24 | \itemize{ 25 | \item \link{do_findChromPeaks_matchedFilter}: use the original 26 | code that iteratively creates a subset of the binned (profile) 27 | matrix. This is helpful for computers with limited memory or 28 | matchedFilter settings with a very small bin size. 29 | \item \link{getPeaks} 30 | } 31 | } 32 | \note{ 33 | For parallel processing using the SOCKS method (e.g. by 34 | \code{\link[BiocParallel:SnowParam-class]{BiocParallel::SnowParam()}} on 35 | Windows computers) this option might not be passed to the individual R 36 | processes performing the calculations. In such cases it is suggested to 37 | specify the option manually and system-wide by adding the line 38 | \code{options(XCMSuseOriginalCode = TRUE)} in a file called \emph{.Rprofile} in the 39 | folder in which new R processes are started (usually the user's 40 | home directory; to ensure that the option is correctly read add a new line 41 | to the file too). See also \link{Startup} from the base R documentation on how to 42 | specify system-wide options for R. 43 | 44 | Usage of old code is strongly dicouraged. This function is thought 45 | to be used mainly in the transition phase from xcms to xcms version 3. 46 | } 47 | \author{ 48 | Johannes Rainer 49 | } 50 | -------------------------------------------------------------------------------- /man/verify.mzQuantML.Rd: -------------------------------------------------------------------------------- 1 | \name{verify.mzQuantM} 2 | \alias{verify.mzQuantML} 3 | \title{Verify an mzQuantML file} 4 | \description{ 5 | Export in XML data formats: verify the written data 6 | } 7 | 8 | \usage{ 9 | verify.mzQuantML(filename, xsdfilename) 10 | } 11 | 12 | \arguments{ 13 | \item{filename}{filename (may include full path) 14 | for the output file. Pipes or URLs are not allowed. 15 | } 16 | \item{xsdfilename}{Filename of the XSD to verify against (may include full path) 17 | } 18 | } 19 | 20 | 21 | \details{ 22 | The verify.mzQuantML() function will verify an PSI standard format mzQuantML 23 | document against the XSD schemda, see \url{http://www.psidev.info/mzquantml} 24 | 25 | } 26 | \value{ 27 | None. 28 | } 29 | \seealso{ 30 | \code{\link{write.mzQuantML}} 31 | } 32 | \keyword{file} 33 | -------------------------------------------------------------------------------- /man/write.cdf-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{write.cdf-methods} 2 | \docType{methods} 3 | \alias{write.cdf} 4 | \alias{write.cdf,xcmsRaw-method} 5 | \title{Save an xcmsRaw object to file} 6 | \description{ 7 | Write the raw data to a (simple) CDF file. 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsRaw"}{ 12 | \code{write.cdf(object, filename)} 13 | } 14 | }} 15 | \arguments{ 16 | \item{object}{the \code{xcmsRaw} object} 17 | \item{filename}{filename (may include full path) 18 | for the CDF file. Pipes or URLs are not allowed. 19 | } 20 | } 21 | \details{ 22 | Currently the only application known to read the resulting file is 23 | XCMS. Others, especially those which build on the AndiMS library, 24 | will refuse to load the output. 25 | } 26 | \value{ 27 | None. 28 | } 29 | \seealso{ 30 | \code{\link{xcmsRaw-class}}, 31 | \code{\link{xcmsRaw}}, 32 | } 33 | \keyword{methods} 34 | \keyword{file} 35 | -------------------------------------------------------------------------------- /man/write.mzQuantML.Rd: -------------------------------------------------------------------------------- 1 | \name{write.mzQuantML-methods} 2 | \docType{methods} 3 | \alias{write.mzQuantML} 4 | \alias{write.mzQuantML,xcmsSet-method} 5 | \title{Save an xcmsSet object to an PSI mzQuantML file} 6 | \description{ 7 | Export in XML data formats: 8 | Write the processed data in an xcmsSet to mzQuantML. 9 | } 10 | 11 | \section{Methods}{ 12 | \describe{ 13 | \item{object = "xcmsSet"}{ 14 | \code{write.mzQuantML(object, filename)} 15 | } 16 | } 17 | } 18 | \arguments{ 19 | \item{object}{the \code{xcmsRaw} or \code{xcmsSet} object} 20 | \item{filename}{filename (may include full path) 21 | for the output file. Pipes or URLs are not allowed. 22 | } 23 | } 24 | 25 | 26 | \details{ 27 | The write.mzQuantML() function will write a (grouped) xcmsSet 28 | into the PSI standard format mzQuantML, see \url{http://www.psidev.info/mzquantml} 29 | 30 | } 31 | \value{ 32 | None. 33 | } 34 | \seealso{ 35 | \code{\link{xcmsSet-class}}, 36 | \code{\link{xcmsSet}}, 37 | \code{\link{verify.mzQuantML}}, 38 | } 39 | \keyword{methods} 40 | \keyword{file} 41 | -------------------------------------------------------------------------------- /man/write.mzdata-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{write.mzdata-methods} 2 | \docType{methods} 3 | \alias{write.mzdata} 4 | \alias{write.mzdata,xcmsRaw-method} 5 | \title{Save an xcmsRaw object to a file} 6 | \description{ 7 | Write the raw data to a (simple) mzData file. 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | \item{object = "xcmsRaw"}{ 12 | \code{write.mzdata(object, filename)} 13 | } 14 | }} 15 | \arguments{ 16 | \item{object}{the \code{xcmsRaw} object} 17 | \item{filename}{filename (may include full path) 18 | for the mzData file. Pipes or URLs are not allowed. 19 | } 20 | } 21 | \details{ 22 | This function will export a given xcmsRaw object to an mzData file. 23 | The mzData file will contain a containing the 24 | with mass and intensity values in 32 bit precision. Other 25 | formats are currently not supported. Any header information 26 | (e.g. additional information or ) will be lost. 27 | Currently, also any MSn information will not be stored. 28 | } 29 | \value{ 30 | None. 31 | } 32 | \seealso{ 33 | \code{\link{xcmsRaw-class}}, 34 | \code{\link{xcmsRaw}}, 35 | } 36 | \keyword{methods} 37 | \keyword{file} 38 | -------------------------------------------------------------------------------- /man/writeMSData-XCMSnExp-character-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-XCMSnExp.R 3 | \name{writeMSData,XCMSnExp,character-method} 4 | \alias{writeMSData,XCMSnExp,character-method} 5 | \title{Export MS data to mzML/mzXML files} 6 | \usage{ 7 | \S4method{writeMSData}{XCMSnExp,character}( 8 | object, 9 | file, 10 | outformat = c("mzml", "mzxml"), 11 | copy = FALSE, 12 | software_processing = NULL, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{object}{\link{XCMSnExp} object with the mass spectrometry data.} 18 | 19 | \item{file}{\code{character} with the file name(s). The length of this parameter 20 | has to match the number of files/samples of \code{object}.} 21 | 22 | \item{outformat}{\code{character(1)} defining the format of the output files ( 23 | either \code{"mzml"} or \code{"mzxml"}).} 24 | 25 | \item{copy}{\code{logical(1)} if metadata (data processing, software used, 26 | original file names etc) should be copied from the original files.} 27 | 28 | \item{software_processing}{optionally provide specific data processing steps. 29 | See documentation of the \code{software_processing} parameter of 30 | \code{\link[MSnbase:writeMSData]{MSnbase::writeMSData()}}.} 31 | 32 | \item{...}{Additional parameters to pass down to the \code{\link[MSnbase:writeMSData]{MSnbase::writeMSData()}} 33 | function in the \code{MSnbase} package, such as \code{outformat} to specify the 34 | output format (\code{"mzml"} or \code{"mzxml"}) or \code{copy} to specify whether 35 | general information from the original MS data files (such as data 36 | processing, software etc) should be copied to the new files.} 37 | } 38 | \description{ 39 | \code{writeMSData} exports mass spectrometry data in mzML or mzXML format. 40 | If adjusted retention times are present, these are used as retention time of 41 | the exported spectra. 42 | } 43 | \seealso{ 44 | \code{\link[MSnbase:writeMSData]{MSnbase::writeMSData()}} function in the \code{MSnbase} package. 45 | } 46 | \author{ 47 | Johannes Rainer 48 | } 49 | -------------------------------------------------------------------------------- /man/writeMzTab.Rd: -------------------------------------------------------------------------------- 1 | \name{writeMzTab} 2 | \alias{writeMzTab} 3 | \title{Save a grouped xcmsSet object in mzTab-1.1 format file} 4 | \description{ 5 | Write the grouped xcmsSet to an mzTab file. 6 | } 7 | \section{Usage}{ 8 | \describe{ 9 | \item{object = "xcmsSet"}{ 10 | \code{writeMzTab(object, filename)} 11 | } 12 | }} 13 | \arguments{ 14 | \item{object}{the \code{xcmsSet} object} 15 | \item{filename}{filename (may include full path) 16 | for the mzTab file. Pipes or URLs are not allowed. 17 | } 18 | } 19 | \details{ 20 | The mzTab file format for MS-based metabolomics (and proteomics) 21 | is a lightweight 22 | supplement to the existing standard XML-based file formats (mzML, 23 | mzIdentML, mzQuantML), providing a comprehensive summary, similar in 24 | concept to the supplemental material of a scientific 25 | publication. mzTab files from xcms contain small 26 | molecule sections together with experimental metadata and 27 | basic quantitative information. The format is intended to store 28 | a simple summary of the final results. 29 | } 30 | \value{ 31 | None. 32 | } 33 | \examples{ 34 | library(faahKO) 35 | xs <- group(faahko) 36 | 37 | mzt <- data.frame(character(0)) 38 | mzt <- xcms:::mzTabHeader(mzt, 39 | version="1.1.0", mode="Complete", type="Quantification", 40 | description="faahKO", 41 | xset=xs) 42 | mzt <- xcms:::mzTabAddSME(mzt, xs) 43 | 44 | xcms:::writeMzTab(mzt, "faahKO.mzTab") 45 | } 46 | 47 | \seealso{ 48 | \code{\link{xcmsSet-class}}, 49 | \code{\link{xcmsSet}}, 50 | } 51 | \keyword{file} 52 | -------------------------------------------------------------------------------- /man/xcms-deprecated.Rd: -------------------------------------------------------------------------------- 1 | \name{xcms-deprecated} 2 | \alias{xcms-deprecated} 3 | \title{Deprecated functions in package \sQuote{xcms}} 4 | 5 | \description{ 6 | These functions are provided for compatibility with older versions of 7 | \sQuote{xcms} only, and will be defunct at the next release. 8 | } 9 | 10 | \details{ 11 | 12 | The following functions/methods are deprecated. 13 | 14 | \itemize{ 15 | \item{\code{profBin}, \code{profBinM}, \code{profBinLin}, 16 | \code{profBinLinM}, \code{profBinLinBase}, \code{profBinLinBaseM} 17 | have been deprecated and \code{\link{binYonX}}} in combination 18 | with \code{\link{imputeLinInterpol}} should be used instead. 19 | 20 | \item{\code{extractMsData}}: replaced by \code{as(x, "data.frame")}. 21 | 22 | \item{\code{plotMsData}}: replaced by \code{plot(x, type = "XIC")}. 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /man/xcmsEIC-class.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsEIC-class} 2 | \docType{class} 3 | \alias{xcmsEIC-class} 4 | \alias{mzrange,xcmsEIC-method} 5 | \alias{mzrange} 6 | \alias{rtrange,xcmsEIC-method} 7 | \alias{rtrange} 8 | 9 | \title{Class xcmsEIC, a class for multi-sample extracted ion chromatograms} 10 | \description{ 11 | This class is used to store and plot parallel extracted ion 12 | chromatograms from multiple sample files. It integrates with the 13 | \code{xcmsSet} class to display peak area integrated during peak 14 | identification or fill-in. 15 | } 16 | \section{Objects from the Class}{ 17 | Objects can be created with the \code{\link{getEIC}} method of 18 | the \code{xcmsSet} class. Objects can also be created by calls 19 | of the form \code{new("xcmsEIC", ...)}. 20 | } 21 | \section{Slots}{ 22 | \describe{ 23 | \item{\code{eic}:}{ 24 | list containing named entries for every sample. for each entry, a 25 | list of two column EIC matricies with retention time and intensity 26 | } 27 | \item{\code{mzrange}:}{ 28 | two column matrix containing starting and ending m/z for each EIC 29 | } 30 | \item{\code{rtrange}:}{ 31 | two column matrix containing starting and ending time for 32 | each EIC 33 | } 34 | \item{\code{rt}:}{ 35 | either \code{"raw"} or \code{"corrected"} to specify retention 36 | times contained in the object 37 | } 38 | \item{\code{groupnames}:}{ 39 | group names from \code{xcmsSet} object used to generate EICs 40 | } 41 | } 42 | } 43 | \section{Methods}{ 44 | \describe{ 45 | \item{\link{groupnames}}{ 46 | \code{signature(object = "xcmsEIC")}: get \code{groupnames} slot 47 | } 48 | \item{mzrange}{ 49 | \code{signature(object = "xcmsEIC")}: get \code{mzrange} slot 50 | } 51 | \item{\link[xcms:plot.xcmsEIC]{plot}}{ 52 | \code{signature(x = "xcmsEIC")}: plot the extracted ion 53 | chromatograms 54 | } 55 | \item{rtrange}{ 56 | \code{signature(object = "xcmsEIC")}: get \code{rtrange} slot 57 | } 58 | \item{\link{sampnames}}{ 59 | \code{signature(object = "xcmsEIC")}: get sample names 60 | } 61 | } 62 | } 63 | \author{Colin A. Smith, \email{csmith@scripps.edu}} 64 | \note{ 65 | No notes yet. 66 | } 67 | \seealso{ 68 | \code{\link{getEIC}} 69 | } 70 | \keyword{classes} 71 | -------------------------------------------------------------------------------- /man/xcmsFileSource-class.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsFileSource-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{xcmsFileSource-class} 5 | \alias{xcmsSource,character-method} 6 | \title{Base class for loading raw data from a file} 7 | \description{ 8 | Data sources which read data from a file should inherit from this 9 | class. The \code{xcms} package provides classes to read from 10 | \code{netCDF}, \code{mzData}, \code{mzXML}, and \code{mzML} files 11 | using \code{xcmsFileSource}. 12 | 13 | This class should be considered virtual and will not work if passed to 14 | \code{\link{loadRaw-methods}}. The reason it is not explicitly 15 | virtual is that there does not appear to be a way for a class to be 16 | both virtual and have a data part (which lets functions treat objects 17 | as if they were character strings). 18 | 19 | This class validates that a file exists at the path given. 20 | } 21 | \section{Objects from the Class}{ 22 | \code{xcmsFileSource} objects should not be instantiated directly. 23 | Instead, create subclasses and instantiate those. 24 | } 25 | \section{Slots}{ 26 | \describe{ 27 | \item{\code{.Data}:}{Object of class \code{"character"}. File path 28 | of a file from which to read raw data as the object's data part} 29 | } 30 | } 31 | \section{Extends}{ 32 | Class \code{"\linkS4class{character}"}, from data part. 33 | Class \code{"\linkS4class{xcmsSource}"}, directly. 34 | } 35 | \section{Methods}{ 36 | \describe{ 37 | \item{\code{xcmsSource}}{ 38 | \code{signature(object = "character")}: Create an 39 | \code{xcmsFileSource} object referencing the given file name. 40 | } 41 | } 42 | } 43 | 44 | \author{Daniel Hackney \email{dan@haxney.org}} 45 | \seealso{\code{\linkS4class{xcmsSource}}} 46 | \keyword{classes} 47 | \keyword{file} 48 | -------------------------------------------------------------------------------- /man/xcmsFragments-class.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsFragments-class} 2 | \docType{class} 3 | \alias{xcmsFragments-class} 4 | \alias{plotTree} 5 | \alias{plotTree,xcmsFragments-method} 6 | 7 | \title{Class xcmsFragments, a class for handling Tandem MS and MS$^n$ data} 8 | \description{ 9 | This class is similar to \code{\link{xcmsSet}} because it stores peaks 10 | from a number of individual files. However, xcmsFragments keeps 11 | Tandem MS and e.g. Ion Trap or Orbitrap MS$^n$ peaks, including the 12 | parent ion relationships. 13 | } 14 | \section{Objects from the Class}{ 15 | Objects can be created with the \code{\link{xcmsFragments}} 16 | constructor and filled with peaks using the collect method. 17 | } 18 | \section{Slots}{ 19 | \describe{ 20 | \item{\code{peaks}:}{ 21 | matrix with colmns peakID (MS1 parent in corresponding xcmsSet), 22 | MSnParentPeakID (parent peak within this xcmsFragments), msLevel 23 | (e.g. 2 for Tandem MS), rt (retention time in case of LC data), mz 24 | (fragment mass-to-charge), intensity (peak intensity extracted 25 | from the original \code{xcmsSet}), sample (the index of the rawData-file). 26 | } 27 | \item{\code{MS2spec}:}{This is a list of matrixes. Each matrix in the list is a single collected spectra from \code{collect}. The column ID's are mz, intensity, and full width half maximum(fwhm). The fwhm column is only relevant if the spectra came from profile data.} 28 | \item{\code{specinfo}:}{This is a matrix with reference data for the spectra in MS2spec. The column id's are preMZ, AccMZ, rtmin, rtmax, ref, CollisionEnergy. The preMZ is precursor mass from the MS1 scan. This mass is given by the XML file. With some instruments this mass is only given as nominal mass, therefore a AccMZ is given which is a weighted average mass from the MS1 scan of the collected spectra. The retention time is given by rtmin and rtmax. The ref column is a pointer to the MS2spec matrix spectra. The collisionEnergy column is the collision Energy for the spectra.} 29 | } 30 | } 31 | \section{Methods}{ 32 | \describe{ 33 | \item{\link{collect}}{ 34 | \code{signature(object = "xcmsFragments")}: gets a xcmsSet-object, collects ms1-peaks from it and the msn-peaks from the corresponding xcmsRaw-files. 35 | } 36 | \item{plotTree}{ 37 | \code{signature(object = "xcmsFragments")}: prints a (text based) pseudo-tree of the peaktable to display the dependencies of the peaks among each other. 38 | } 39 | \item{\link{show}}{ 40 | \code{signature(object = "xcmsFragments")}: print a human-readable 41 | description of this object to the console. 42 | } 43 | } 44 | } 45 | \author{S. Neumann, J. Kutzera} 46 | \seealso{ 47 | \code{\link{xcmsRaw}} 48 | } 49 | \keyword{classes} 50 | -------------------------------------------------------------------------------- /man/xcmsFragments.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsFragments} 2 | \alias{xcmsFragments} 3 | \title{Constructor for xcmsFragments objects which holds Tandem MS 4 | peaks} 5 | \description{ 6 | EXPERIMANTAL FEATURE 7 | 8 | xcmsFragments is an object similar to xcmsSet, which holds peaks 9 | picked (or collected) from one or several xcmsRaw objects. 10 | 11 | There are still discussions going on about the exact API for MS$^n$ 12 | data, so this is likely to change in the future. The code is not yet 13 | pipeline-ified. 14 | 15 | } 16 | \usage{ 17 | xcmsFragments(xs, ...) 18 | } 19 | \arguments{ 20 | \item{xs}{A \code{\link{xcmsSet-class}} object which contains 21 | picked ms1-peaks from one or several experiments} 22 | \item{\dots}{ 23 | further arguments to the \code{collect} method 24 | } 25 | } 26 | \details{ 27 | After running collect(xFragments,xSet) The peaktable of the 28 | xcmsFragments includes the ms1Peaks from all experinemts stored in a 29 | xcmsSet-object. Further it contains the relevant MSn-peaks from the 30 | xcmsRaw-objects, which were created temporarily with the paths in 31 | xcmsSet. 32 | } 33 | \value{ 34 | An \code{xcmsFragments} object. 35 | } 36 | \author{Joachim Kutzera, Steffen Neumann, \email{sneumann@ipb-halle.de}} 37 | \seealso{ 38 | \code{\link{xcmsFragments-class}}, 39 | \code{\link{collect}} 40 | } 41 | \keyword{file} 42 | -------------------------------------------------------------------------------- /man/xcmsPeaks-class.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsPeaks-class} 2 | \docType{class} 3 | \alias{xcmsPeaks-class} 4 | 5 | \title{A matrix of peaks} 6 | \description{A matrix of peak information. The actual columns depend on 7 | how it is generated (i.e. the \code{\link{findPeaks}} method).} 8 | \section{Objects from the Class}{ 9 | Objects can be created by calls of the form \code{new("xcmsPeaks", ...)}. 10 | } 11 | \section{Slots}{ 12 | \describe{ 13 | \item{\code{.Data}:}{The matrix holding the peak information} 14 | } 15 | } 16 | \section{Extends}{ 17 | %Class \code{"\linkS4class{xcmsData}"}, directly. 18 | Class \code{"\linkS4class{matrix}"}, from data part. 19 | Class \code{"\linkS4class{array}"}, by class "matrix", distance 2. 20 | Class \code{"\linkS4class{structure}"}, by class "matrix", distance 3. 21 | Class \code{"\linkS4class{vector}"}, by class "matrix", distance 4, with explicit coerce. 22 | } 23 | \section{Methods}{ 24 | None yet. Some utilities for working with peak data would be nice. 25 | } 26 | \author{Michael Lawrence} 27 | \seealso{ 28 | \code{\link{findPeaks}} for detecting peaks in an 29 | \code{\linkS4class{xcmsRaw}}. 30 | } 31 | \keyword{classes} 32 | -------------------------------------------------------------------------------- /man/xcmsSource-class.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsSource-class} 2 | \docType{class} 3 | \alias{xcmsSource-class} 4 | \title{Virtual class for raw data sources} 5 | \description{ 6 | This virtual class provides an implementation-independent way to load 7 | mass spectrometer data from various sources for use in an 8 | \code{\linkS4class{xcmsRaw}} object. Subclasses can be defined to 9 | enable data to be loaded from user-specified sources. The virtual 10 | class \code{\linkS4class{xcmsFileSource}} is included out of the box 11 | which contains a file name as a character string. 12 | 13 | When implementing child classes of \code{xcmsSource}, a corresponding 14 | \code{\link{loadRaw-methods}} method must be provided which accepts 15 | the \code{xcmsSource} child class and returns a list in the format 16 | described in \code{\link{loadRaw-methods}}. 17 | } 18 | \section{Objects from the Class}{ 19 | A virtual Class: No objects may be created from it. 20 | } 21 | 22 | \author{Daniel Hackney, \email{dan@haxney.org}} 23 | \seealso{ 24 | \code{\link{xcmsSource-methods}} for creating \code{xcmsSource} 25 | objects in various ways. 26 | } 27 | \keyword{classes} 28 | -------------------------------------------------------------------------------- /man/xcmsSource-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{xcmsSource-methods} 2 | \docType{methods} 3 | \alias{xcmsSource} 4 | \alias{xcmsSource-methods} 5 | \alias{xcmsSource,xcmsSource-method} 6 | \title{Create an \code{\linkS4class{xcmsSource}} object in a flexible way} 7 | \description{ 8 | Users can define alternate means of reading data for 9 | \code{\linkS4class{xcmsRaw}} objects by creating new implementations 10 | of this method. 11 | } 12 | \section{Methods}{ 13 | \describe{ 14 | \item{\code{signature(object = "xcmsSource")}}{ 15 | Pass the object through unmodified. 16 | } 17 | } 18 | } 19 | \author{Daniel Hackney, \email{dan@haxney.org}} 20 | \seealso{ 21 | \code{\linkS4class{xcmsSource}} 22 | } 23 | \keyword{methods} 24 | -------------------------------------------------------------------------------- /src/Makevars: -------------------------------------------------------------------------------- 1 | MQOBJECTS=massifquant/xcms_massifquant.o massifquant/TrMgr.o massifquant/Tracker.o massifquant/SegProc.o massifquant/DataKeeper.o massifquant/OpOverload.o 2 | 3 | OBIOBJECTS=obiwarp/mat.o obiwarp/vec.o obiwarp/xcms_dynprog.o obiwarp/xcms_lmat.o xcms_obiwarp.o 4 | 5 | XCMSOBJECTS=fastMatch.o mzClust_hclust.o mzROI.o util.o xcms.o binners.o 6 | 7 | OBJECTS= $(MQOBJECTS) $(OBIOBJECTS) $(XCMSOBJECTS) 8 | 9 | all: clean $(SHLIB) 10 | 11 | clean: 12 | rm -f $(OBJECTS) 13 | -------------------------------------------------------------------------------- /src/Makevars.win: -------------------------------------------------------------------------------- 1 | MQOBJECTS=massifquant/xcms_massifquant.o massifquant/TrMgr.o massifquant/Tracker.o massifquant/SegProc.o massifquant/DataKeeper.o massifquant/OpOverload.o 2 | 3 | OBIOBJECTS=obiwarp/mat.o obiwarp/vec.o obiwarp/xcms_dynprog.o obiwarp/xcms_lmat.o xcms_obiwarp.o 4 | 5 | XCMSOBJECTS=fastMatch.o mzClust_hclust.o mzROI.o util.o xcms.o binners.o 6 | 7 | OBJECTS= $(MQOBJECTS) $(OBIOBJECTS) $(XCMSOBJECTS) 8 | 9 | all: $(SHLIB) 10 | 11 | # Hack found at 12 | # http://r.789695.n4.nabble.com/suppressing-quot-global-quot-cppflags-in-an-individual-package-td910894.html 13 | MINGWBUILDBROKENWITHOPTIMIZATION2FLAGS=-fno-inline 14 | 15 | %.o: %.c 16 | $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(MINGWBUILDBROKENWITHOPTIMIZATION2FLAGS) -c $< -o $@ 17 | 18 | clean: 19 | rm -f $(OBJECTS) 20 | -------------------------------------------------------------------------------- /src/binarySearch.h: -------------------------------------------------------------------------------- 1 | int lowerBound(double val,double *mzval,int first, int length); 2 | int upperBound(double val,double *mzval,int first, int length); 3 | -------------------------------------------------------------------------------- /src/massifquant/DataKeeper.h: -------------------------------------------------------------------------------- 1 | #ifndef DK_h 2 | #define DK_h 3 | 4 | #include 5 | 6 | #ifndef WIN32 7 | //------------Unix------------ 8 | #include 9 | #define MKDIR(path,mask) mkdir(path,mask) 10 | #define GETCWD(buf,len) getcwd(buf,len) 11 | #define OPEN(buf,mode,access) open(buf,mode,access) 12 | #endif 13 | 14 | //outside libraries 15 | #include 16 | #include 17 | 18 | /* Not able to find these header files */ 19 | #include 20 | #include 21 | 22 | 23 | const int MZITR = 0; 24 | const int IITR = 1; 25 | const int FILECHARMAX = 300; 26 | const int RANGEMAXNUM = 6; 27 | class DataKeeper { 28 | 29 | private: 30 | uint32_t num_scans; 31 | std::vector scan_idx; 32 | std::vector rt; //a single big array 33 | std::vector mz; //an 34 | std::vector intensity; 35 | 36 | struct scanBuf * scbuf; 37 | double * pmz; 38 | double * pinten; 39 | int * pscanindex; 40 | int nmz; 41 | int lastScan; 42 | double * pscantime; 43 | char filename[FILECHARMAX]; 44 | 45 | double initMZS2; 46 | double initIS2; //var 47 | double initIS; //sd 48 | 49 | void printVec(const std::vector & myvec); 50 | void printList(const std::list & mylist); 51 | void printList(const std::list & mylist); 52 | 53 | /*not working on windows build of bioconductor*/ 54 | //void assign_values(float64* data, uint32_t data_len, std::vector & vec, int vec_len); 55 | 56 | std::vector privGetMZScan(int s); 57 | std::vector privGetIScan(int s); 58 | 59 | void privGetScanXcms(int scan, std::vector & mzScan, 60 | std::vector & intenScan); 61 | 62 | //want to be able to change data 63 | std::vector transformIntensity(std::vector & A); 64 | void transformIntensityR(); 65 | 66 | public: 67 | 68 | DataKeeper(SEXP mz, SEXP inten, SEXP scanindex, SEXP ls, SEXP scantime); 69 | DataKeeper(const char* dotplms1); 70 | ~DataKeeper(); 71 | 72 | uint32_t getTotalScanNumbers(); 73 | int getTotalCentroidCount(); 74 | double getInitMZS2(); 75 | double getInitIS2(); 76 | double getInitIS(); 77 | 78 | std::vector getMZScan(int s); 79 | std::vector getIScan(int s); 80 | 81 | void getScanMQ(int s, std::vector & mzScan, std::vector & intenScan); 82 | void getScanXcms(int scan, int nmz, int lastScan, std::vector & mzScan, std::vector & intenScan); 83 | 84 | double getScanTime(int s); 85 | 86 | void ghostScan(); 87 | 88 | void ghostScanR(); 89 | 90 | }; 91 | #endif 92 | -------------------------------------------------------------------------------- /src/massifquant/SegProc.h: -------------------------------------------------------------------------------- 1 | #ifndef SPROC_h 2 | #define SPROC_h 3 | 4 | #include "nmath.h" 5 | #include "dpq.h" 6 | 7 | #include 8 | #include 9 | 10 | const int MAXGAP = 5; 11 | const double TROBUST1 = 0.5; 12 | const double TROBUST2 = 2; 13 | const double ALPHA = 0.001; 14 | 15 | class SegProc { 16 | 17 | private: 18 | 19 | double origTrNum; //num of trackers before soldering of trackers 20 | double t; //the test statistic from a student t distribution 21 | double v; //degrees of freedom for student t distribution 22 | double p; //the probability of obtaining a test statistic at least 23 | //as extreme as the one that was actually observed, assuming 24 | //that the null hypothesis is true (wiki) 25 | 26 | std::vector segClusters; 27 | std::vector segIdx;//the list of tracker indices to be soldered together 28 | std::vector unionIdx; //the delimiation of unions of soldered trks 29 | 30 | //after cleaned subsets 31 | std::vector cleanSegIdx;//the list of tracker indices to be soldered together 32 | std::vector cleanUnionIdx; //the delimiation of unions of soldered trks 33 | 34 | 35 | 36 | void compareMeans(TrMgr & busybody, const int seed, const std::list edges, const int & segCounts); 37 | 38 | //equal variances 39 | void ttestEq(double xbar1, double xbar2, double n1, double n2, double s12, double s22); 40 | 41 | //unequal variance - Welch-Satterwaite Approx. 42 | void ttestWelch(double xbar1, double xbar2, double n1, double n2, double s12, double s22); 43 | 44 | double pt(double x, double n, int lower_tail, int log_p); 45 | 46 | public: 47 | 48 | SegProc(int otn); 49 | 50 | ~SegProc(); 51 | 52 | void groupSegments(TrMgr & busybody); 53 | 54 | void collapseSubsets(); 55 | 56 | void solderSegs(TrMgr & busybody); 57 | 58 | void segsToFile(TrMgr & busybody); 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/obiwarp/lmat.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _LMAT_H 3 | #define _LMAT_H 4 | 5 | #include "vec.h" 6 | #include "mat.h" 7 | 8 | extern "C"{ 9 | using namespace VEC; 10 | 11 | class LMat { 12 | private: 13 | #define LEN_LARGEST_NUM (30) 14 | #define LARGEST_NUM_MZ_VALS (40000) 15 | #define LARGEST_NUM_TIME_VALS (40000) 16 | public: 17 | int _mz_vals; 18 | int _tm_vals; 19 | 20 | // All constructors call new! 21 | // All swaps of these MUST delete their memory before swapping! 22 | MatF *_mat; 23 | VecF *_mz; 24 | VecF *_tm; 25 | 26 | LMat(); 27 | // Takes a binary lmat file as input 28 | LMat(const char *file); 29 | 30 | ~LMat(); 31 | int mzlen() { return _mz_vals; } 32 | int tmlen() { return _tm_vals; } 33 | int num_mz() { return _mz_vals; } 34 | int num_tm() { return _tm_vals; } 35 | MatF * mat() { return _mat; } 36 | VecF * mz() { return _mz; } 37 | VecF * tm() { return _tm; } 38 | 39 | float hi_mz() { return (*_mz)[_mz_vals-1]; } 40 | float lo_mz() { return (*_mz)[0]; } 41 | float hi_tm() { return (*_tm)[_tm_vals-1]; } 42 | float lo_tm() { return (*_tm)[0]; } 43 | void mz_axis_vals(VecI &mzCoords, VecF &mzVals); 44 | void tm_axis_vals(VecI &tmCoords, VecF &tmVals); 45 | 46 | void set_from_xcms(int valuescantime, double *pscantime, int mzrange, 47 | double *mz, double *intensity); 48 | void print_xcms(); 49 | 50 | // selfTimes and equivTimes are the anchor points for the warping 51 | // function.. warps the time values (not the actual data values) 52 | void warp_tm(VecF &selfTimes, VecF &equivTimes); 53 | 54 | // expects one line with the # mz vals and next with the vals 55 | void set_mz_from_ascii(FILE *fpt); 56 | // expects one line with the # tm vals and next with the vals 57 | void set_tm_from_ascii(FILE *fpt); 58 | // expects the matrix in ascii format 59 | void set_mat_from_ascii(FILE *ptr, int rows, int cols); 60 | // writes the lmat in binary to a file (or STDOUT if NULL) 61 | void write(const char *file=NULL); 62 | // writes the lmat in ascii to a file (or STDOUT if NULL) 63 | void print(const char *file=NULL); 64 | 65 | // obviously not the final resting place 66 | void chomp_plus_spaces( char *str); 67 | }; 68 | 69 | #endif 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void DescendZero(double *yvals, int *numin, int *istart, 4 | int *ilower, int *iupper); 5 | 6 | void DescendMin(double *yvals, int *numin, int *istart, 7 | int *ilower, int *iupper); 8 | 9 | void FindEqualGreaterM(const double *in, const int *size, const double *values, 10 | const int *valsize, int *index); 11 | 12 | void FindEqualGreater(const double *in, const int *size, const double *target, 13 | int *index); 14 | 15 | void FindEqualLess(const double *in, const int *size, const double *target, 16 | int *index); 17 | 18 | void ColMax(const double *in, const int *n, const int *dn, double *out); 19 | 20 | void RowMax(const double *in, const int *dn, const int *p, double *out); 21 | 22 | void WhichColMax(const double *in, const int *n, const int *dn, int *out); 23 | 24 | void WhichRowMax(const double *in, const int *dn, const int *p, int *out); 25 | 26 | int ComparIntIndex(void *numptr, const void *i1, const void *i2); 27 | 28 | void RectUnique(const double *m, const int *order, const int *nrow, 29 | const int *ncol, const double *xdiff, const double *ydiff, 30 | int *keep); 31 | 32 | SEXP DoubleMatrix(SEXP nrow, SEXP ncol); 33 | 34 | SEXP IntegerMatrix(SEXP nrow, SEXP ncol); 35 | 36 | SEXP LogicalMatrix(SEXP nrow, SEXP ncol); 37 | -------------------------------------------------------------------------------- /src/xcms.h: -------------------------------------------------------------------------------- 1 | void ProfBinLin(double *xvals, double *yvals, int *numin, 2 | double *xstart, double *xend, int *numout, double *out); 3 | 4 | void ProfBinLinM(double *xvals, double *yvals, int *numin, int *mindex, int *nummi, 5 | double *xstart, double *xend, int *numout, double *out); 6 | 7 | void ProfBinLinBase(double *xvals, double *yvals, int *numin, double *baselevel, double *basespace, 8 | double *xstart, double *xend, int *numout, double *out); 9 | 10 | void ProfBinLinBaseM(double *xvals, double *yvals, int *numin, int *mindex, int *nummi, 11 | double *baselevel, double *basespace, double *xstart, double *xend, 12 | int *numout, double *out); 13 | 14 | void ProfIntLin(double *xvals, double *yvals, int *numin, 15 | double *xstart, double *xend, int *numout, double *out); 16 | 17 | void ProfIntLinM(double *xvals, double *yvals, int *numin, int *mindex, int *nummi, 18 | double *xstart, double *xend, int *numout, double *out); 19 | 20 | void ProfBin(double *xvals, double *yvals, int *numin, 21 | double *xstart, double *xend, int *numout, double *out); 22 | 23 | void ProfBinM(double *xvals, double *yvals, int *numin, int *mindex, int *nummi, 24 | double *xstart, double *xend, int *numout, double *out); 25 | 26 | void ProfMaxIdx(double *xvals, double *yvals, int *numin, 27 | double *xstart, double *xend, int *numout, int *out); 28 | 29 | void ProfMaxIdxM(double *xvals, double *yvals, int *numin, int *mindex, int *nummi, 30 | double *xstart, double *xend, int *numout, int *out); 31 | 32 | void MedianFilter(double *inmat, int *m, int *n, int *mrad, int *nrad, double *outmat); 33 | 34 | int CompareDouble(const void *a, const void *b); 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/testthat/test_functions-imputation.R: -------------------------------------------------------------------------------- 1 | test_that("imputeRowMin works", { 2 | skip_on_os(os = "windows", arch = "i386") 3 | 4 | mat <- cbind(c(4, 2, 4, NA, NA), c(NA, NA, NA, NA, NA), c(4, NA, 6, 3, 9), 5 | c(6, 3, NA, 6, NA)) 6 | mat_imp <- imputeRowMin(mat) 7 | expect_equal(mat_imp[, 2], c(2, 1, 2, 1.5, 4.5)) 8 | 9 | mat_imp <- imputeRowMin(mat[, -3]) 10 | expect_equal(mat_imp[, 2], c(2, 1, 2, 3, NA)) 11 | }) 12 | 13 | test_that("imputeRowMinRand works", { 14 | skip_on_os(os = "windows", arch = "i386") 15 | 16 | set.seed(123) 17 | mat <- cbind(c(4, 2, 4, NA, NA), c(NA, NA, NA, NA, NA), c(4, NA, 6, 3, 9), 18 | c(6, 3, NA, 6, NA)) 19 | mat_imp <- imputeRowMinRand(mat) 20 | rmin <- apply(mat, 1, min, na.rm = TRUE) 21 | rmin_imp <- apply(mat_imp, 1, min, na.rm = TRUE) 22 | expect_true(all(rmin_imp < rmin)) 23 | 24 | mat_2 <- imputeRowMinRand(mat, method = "from_to") 25 | expect_true(all(!is.na(mat_2))) 26 | rmin_imp2 <- apply(mat_2, 1, min, na.rm = TRUE) 27 | expect_true(all(rmin_imp2 < rmin)) 28 | expect_true(all(rmin_imp2 < rmin / 2)) 29 | expect_true(all(rmin_imp2 > rmin / 1000)) 30 | expect_true(all(rmin_imp != rmin_imp2)) 31 | 32 | mat_imp <- imputeRowMinRand(mat[, -3]) 33 | expect_true(all(is.na(mat_imp[5, ]))) 34 | }) 35 | -------------------------------------------------------------------------------- /tests/testthat/test_functions-xcmsSwath.R: -------------------------------------------------------------------------------- 1 | test_that(".which_mz_in_range works", { 2 | skip_on_os(os = "windows", arch = "i386") 3 | 4 | mz <- 3.4 5 | lowerMz <- c(1, 3, 8, 12) 6 | upperMz <- c(3, 7, 11, 15) 7 | res <- .which_mz_in_range(mz, lowerMz, upperMz) 8 | expect_equal(res, 2L) 9 | res <- .which_mz_in_range(c(3, 3.4, 9), lowerMz, upperMz) 10 | expect_equal(res, list(c(1L, 2L), 2L, 3L)) 11 | }) 12 | 13 | test_that(".which_chrom_peak_overlap_rt works", { 14 | skip_on_os(os = "windows", arch = "i386") 15 | 16 | pks <- cbind(rtmin = c(1, 2, 3, 4, 5), rtmax = c(2, 3, 4, 5, 6)) 17 | res <- .which_chrom_peak_overlap_rt(c(rtmin = 1.1, rtmax = 2.2), pks) 18 | expect_equal(res, c(1L, 2L)) 19 | res <- .which_chrom_peak_overlap_rt(c(rtmin = 3.1, rtmax = 3.2), pks) 20 | expect_equal(res, 3L) 21 | }) 22 | 23 | test_that(".which_chrom_peak_diff_rt works", { 24 | skip_on_os(os = "windows", arch = "i386") 25 | 26 | pks <- cbind(rt = c(1, 2, 3, 4, 5), rtmax = c(2, 3, 4, 5, 6)) 27 | res <- .which_chrom_peak_diff_rt(c(rt = 1.1), pks, diffRt = 2) 28 | expect_equal(res, c(1L, 2L, 3L)) 29 | res <- .which_chrom_peak_diff_rt(c(rt = 3.1), pks, diffRt = 0.101) 30 | expect_equal(res, 3L) 31 | }) 32 | 33 | test_that(".reconstruct_dia_ms2 works", { 34 | res <- .reconstruct_dia_ms2(pest_swth) 35 | expect_true(is(res, "Spectra")) 36 | expect_equal(length(res), nrow(chromPeaks(pest_swth, msLevel = 1L))) 37 | expect_equal(res$peak_id, rownames(chromPeaks(pest_swth, msLevel = 1L))) 38 | expect_equal( 39 | res$precursorMz, unname(chromPeaks(pest_swth, msLevel = 1L)[, "mz"])) 40 | }) 41 | 42 | test_that(".reconstruct_dia_ms2 works", { 43 | res <- .reconstruct_dia_ms2(pest_swth) 44 | expect_true(is(res, "Spectra")) 45 | expect_equal(length(res), nrow(chromPeaks(pest_swth, msLevel = 1L))) 46 | expect_equal(res$peak_id, rownames(chromPeaks(pest_swth, msLevel = 1L))) 47 | expect_equal( 48 | res$precursorMz, unname(chromPeaks(pest_swth, msLevel = 1L)[, "mz"])) 49 | }) 50 | -------------------------------------------------------------------------------- /tests/testthat/test_loadXcmsData.R: -------------------------------------------------------------------------------- 1 | test_that("loadXcmsData works", { 2 | expect_error(loadXcmsData("some"), "one of") 3 | 4 | a <- loadXcmsData("xdata") 5 | expect_s4_class(a, "XCMSnExp") 6 | expect_true(validObject(a)) 7 | 8 | b <- loadXcmsData("xmse") 9 | expect_s4_class(b, "XcmsExperiment") 10 | expect_true(validObject(b)) 11 | 12 | res <- loadXcmsData("faahko_sub") 13 | expect_s4_class(res, "XCMSnExp") 14 | expect_true(validObject(res)) 15 | expect_false(hasAdjustedRtime(res)) 16 | expect_false(hasFeatures(res)) 17 | 18 | res <- loadXcmsData("faahko_sub2") 19 | expect_s4_class(res, "XcmsExperiment") 20 | expect_true(validObject(res)) 21 | expect_true(hasChromPeaks(res)) 22 | expect_false(hasAdjustedRtime(res)) 23 | expect_false(hasFeatures(res)) 24 | }) 25 | -------------------------------------------------------------------------------- /tests/testthat/test_matchpeaks.R: -------------------------------------------------------------------------------- 1 | test_that("matchpeaks doesn't fail", { 2 | skip_on_os(os = "windows", arch = "i386") 3 | 4 | faahko_file <- system.file('cdf/KO/ko15.CDF', package = "faahKO") 5 | 6 | faahko_xs <- xcmsSet(faahko_file, profparam = list(step = 0), 7 | method = "centWave", noise = 10000, snthresh = 40, 8 | prefilter = c(6, 10000)) 9 | pks <- peaks(faahko_xs) 10 | 11 | calibs <- pks[c(3, 5, 7, 13, 17, 29), "mz"] 12 | 13 | res <- xcms:::matchpeaks(pks, calibs) 14 | res_2 <- xcms:::matchpeaks(pks[order(pks[, "mz"]), ], calibs) 15 | }) 16 | -------------------------------------------------------------------------------- /vignettes/swath_tomato.Rmd_notrun: -------------------------------------------------------------------------------- 1 | --- 2 | title: "SWATH data analysis with xcms (Tomato)" 3 | package: xcms 4 | output: 5 | BiocStyle::html_document: 6 | toc_float: true 7 | vignette: > 8 | %\VignetteIndexEntry{SWATH data analysis with xcms (Tomato)} 9 | %\VignetteEngine{knitr::rmarkdown} 10 | %\VignetteEncoding{UTF-8} 11 | %\VignetteDepends{xcms,RColorBrewer,faahKO,pander,magrittr,BiocStyle,pheatmap} 12 | %\VignettePackage{xcms} 13 | %\VignetteKeywords{mass spectrometry, metabolomics} 14 | bibliography: references.bib 15 | csl: biomed-central.csl 16 | references: 17 | - id: dummy 18 | title: no title 19 | author: 20 | - family: noname 21 | given: noname 22 | --- 23 | 24 | ```{r biocstyle, echo = FALSE, results = "asis" } 25 | BiocStyle::markdown() 26 | ``` 27 | 28 | **Package**: `r Biocpkg("xcms")`
29 | **Authors**: Johannes Rainer, Michael Witting
30 | **Modified**: `r file.info("swath_tomato.Rmd")$mtime`
31 | **Compiled**: `r date()` 32 | 33 | ```{r init, message = FALSE, echo = FALSE, results = "hide" } 34 | ## Silently loading all packages 35 | library(BiocStyle) 36 | library(xcms) 37 | library(pander) 38 | register(SerialParam()) 39 | ``` 40 | 41 | 42 | ```{r metabolites} 43 | library(Risa) 44 | ISAmtbls297 <- readISAtab(find.package("mtbls297")) 45 | assay <- ISAmtbls297@assay.tabs[[1]] 46 | msfiles <- paste(find.package("mtbls297"), "mzML", 47 | assay@assay.file$"Derived Spectral Data File", 48 | sep="/") 49 | 50 | tomato <- readMSData(msfiles, mode = "onDisk") 51 | 52 | table(msLevel(tomato)) 53 | head(isolationWindowLowerMz(tomato)) 54 | head(isolationWindowUpperMz(tomato)) 55 | 56 | head(fData(tomato)[, c("isolationWindowTargetMZ", "isolationWindowLowerOffset", 57 | "isolationWindowUpperOffset", "msLevel", "retentionTime")]) 58 | 59 | cwp <- CentWaveParam(ppm = 25, peakwidth = c(10, 20), snthresh = 10, 60 | prefilter = c(3, 100)) 61 | tomato <- findChromPeaks(tomato, cwp) 62 | tomato <- findChromPeaksIsolationWindow(tomato, cwp) 63 | 64 | chromPeakData(tomato) 65 | table(chromPeakData(tomato)$isolationWindow) 66 | 67 | ``` 68 | -------------------------------------------------------------------------------- /vignettes/xcms-lcms-ms.bioschemas.html: -------------------------------------------------------------------------------- 1 | 32 | -------------------------------------------------------------------------------- /vignettes/xcms.bioschemas.html: -------------------------------------------------------------------------------- 1 | 27 | --------------------------------------------------------------------------------