analyzeFT: analyzeFT

analyzeFT,MseekFT,listOrNULL,FTAnalysisParam-methodR Documentation

analyzeFT

Description

analyzeFT(): wrapper function for the methods described here. Analyze MseekFT objects, recording a processing history . Will use intensity columns and grouping information from the MseekFT object if available. See analyzeTable for the old version of this.

removeNAs: remove NA values from a range of columns and replace them with another value

FTcalculateM: Calculates M value as detailed by Vandesompele et al. (2002)

FTNormalize: Replaces zeroes by the globally smallest non-zero intensity value, then normalizes a feature table such that the mean values of all intensity columns will be equal. See also featureTableNormalize()

FTNormalizationFactors: Calculates normalization factors. See also featureTableNormalize()

FTBasicAnalysis: calculate fold changes between groups of samples. See also foldChange() and featureCalcs()for a description of the resulting columns

getMseekIntensities: get EIC-based intensities for each molecular feature in the MseekFT object for each file in rawdata. if another MseekFT object is supplied as importFrom, will try to transfer MseekIntensities from there if all settings, features and MS data files are equivalent. See also exIntensities

FTOldPeakShapes: calculate score for peak shapes. This method is kept for backwards reproducibility and not recommended, because FTPeakShapes() is much faster. See also bestgauss()

FTPeakShapes: calculate score for peak shapes. Adds a Fast_Peak_Quality column to the data.frame in the MseekFT object. See also fastPeakShapes()

FTMzMatch: Match mz values in this MseekFT with mz values from a data base. See also mzMatch()

FTT.test: calculate t-test between samples. Works only if there are two groups in grouping with multiple members. See also multittest()

FTAnova: calculate two-way ANOVA between multiple sample groups. See also MseekAnova()

FTCluster: cluster the feature table with cluster::clara() See also MosCluster()

FTPCA: Calculate Principal Component Analysis to cluster either features or samples

FTMS2scans: find MS2 scans across files and save their file and scan numbers in the MseekFT object as a text column.

getSpecList: generate a list of MS2 spectra inside the object from MS2 spectra that were identified with the FTMS2scans() method.

FTedges: wrapper for the MassTools::makeEdges() function, matching a list of MS2 spectra available inside the object and generating similarity scores.

matchReference: Match molecular features between a MseekGraph or MseekFT object and another MseekFT object by a customizable combination of retention time, m/z and MS2 similarity matching

LabelFinder: Find labeled features, see findLabels()

PatternFinder: Find Pattern in Spectra

Usage

## S4 method for signature 'MseekFT,listOrNULL,FTAnalysisParam'
analyzeFT(object, MSData, param)

## S4 method for signature 'MseekFT'
removeNAs(object, intensityCols = NULL, replacement = 0)

## S4 method for signature 'MseekFT'
FTcalculateM(object, intensityCols = NULL, maxInvalid = 0, ...)

## S4 method for signature 'MseekFT'
FTNormalize(
  object,
  normalize = TRUE,
  intensityCols = NULL,
  normalizationFactors = NULL,
  logNormalized = FALSE,
  zeroReplacement = NULL
)

## S4 method for signature 'MseekFT'
FTNormalizationFactors(
  object,
  normalizeFrom = NULL,
  normalizationMethod = c("mean", "gm_mean", "no normalization"),
  transformation = NULL,
  zeroReplacement = NULL
)

## S4 method for signature 'MseekFT'
FTBasicAnalysis(
  object,
  intensityCols = NULL,
  grouping = NULL,
  controlGroup = NULL
)

## S4 method for signature 'MseekFT,listOrNULL,missing'
getMseekIntensities(
  object,
  rawdata,
  adjustedRT = TRUE,
  ppm = 5,
  rtrange = TRUE,
  rtw = 5,
  areaMode = FALSE,
  BPPARAM = SerialParam(),
  baselineSubtract = TRUE,
  SN = NULL,
  columnSuffix = "__XIC"
)

## S4 method for signature 'MseekFT,listOrNULL,MseekFTOrNULL'
getMseekIntensities(
  object,
  rawdata,
  importFrom,
  adjustedRT = TRUE,
  ppm = 5,
  rtrange = TRUE,
  rtw = 5,
  areaMode = FALSE,
  BPPARAM = SerialParam(),
  baselineSubtract = TRUE,
  SN = NULL,
  columnSuffix = "__XIC"
)

## S4 method for signature 'MseekFT,listOrNULL'
FTOldPeakShapes(object, rawdata, ppm = 5, workers = 1)

## S4 method for signature 'MseekFT,listOrNULL'
FTPeakShapes(object, rawdata, ppm = 5, workers = 1)

## S4 method for signature 'MseekFT'
FTMzMatch(object, db, ppm = 5, mzdiff = 0.001)

## S4 method for signature 'MseekFT'
FTT.test(
  object,
  intensityCols = NULL,
  grouping = NULL,
  adjmethod = "bonferroni",
  controlGroup = NULL
)

## S4 method for signature 'MseekFT'
FTAnova(
  object,
  intensityCols = NULL,
  grouping = NULL,
  adjmethod = "bonferroni"
)

## S4 method for signature 'MseekFT'
FTCluster(object, intensityCols = NULL, numClusters = 100L)

## S4 method for signature 'MseekFT'
FTPCA(object, intensityCols = NULL, featureMode = FALSE)

## S4 method for signature 'MseekFT,listOrNULL'
FTMS2scans(object, rawdata, ppm = 5, rtw = 10, uniqueMatch = FALSE)

## S4 method for signature 'MseekFT,listOrNULL'
getSpecList(
  object,
  rawdata,
  merge = TRUE,
  noiselevel = 0,
  ppm = 5,
  mzdiff = 0.0005,
  mzThreshold = NULL
)

## S4 method for signature 'MseekFT'
FTedges(
  object,
  useParentMZs = TRUE,
  minpeaks = 6,
  mzdiff = 0.0005,
  method = "cosine"
)

## S4 method for signature 'MseekFT,MseekFT'
matchReference(
  object,
  query,
  parent_mztol = 0.001,
  parent_ppm = 5,
  rttol = 5,
  getCosine = TRUE,
  cosineThreshold = NULL,
  singleHits = TRUE,
  queryPrefix = "query__",
  returnMapping = FALSE,
  ...
)

## S4 method for signature 'MseekGraph,MseekFT'
matchReference(
  object,
  query,
  parent_mztol = 0.001,
  parent_ppm = 5,
  rttol = 5,
  getCosine = TRUE,
  cosineThreshold = NULL,
  singleHits = TRUE,
  queryPrefix = "query__",
  returnMapping = FALSE,
  ...
)

## S4 method for signature 'MseekFamily'
LabelFinder(
  object,
  object2,
  MSData,
  newName,
  ref_intensityCols,
  comp_intensityCols,
  ...
)

## S4 method for signature 'MseekFamily'
PatternFinder(
  object,
  MSData,
  peaks,
  losses,
  ppm = 5,
  mzdiff = 0.002,
  noise = 0.02
)

Arguments

object

an MseekFT or data.frame object.

MSData, rawdata

list of xcmsRaw objects

param

a FTAnalysisParam object

intensityCols

a vector of column names which contain intensity values to use for a calculation step. If not defined, will use the columns defined in the object as $intensities.

replacement

value to put in place of NA values

maxInvalid

maximum number of invalid values (0 or NA) allowed in rows that are used for M value calculation

...

additional arguments passed to internal methods (e. g. network1())

normalize

if TRUE, run normalization

normalizationFactors

normalizationFactors vector with factors to apply to each column for normalization.

logNormalized

if TRUE, applies log10 to intensity values after normalization

zeroReplacement

value to replace zeros with

normalizeFrom

can be an MseekFT object with normalization features or NULL (in which case object itself acts as base for calculation)

normalizationMethod

function to apply to normalization feature intensities

transformation

function to transform normalized intensity values, e.g. 'log10'

grouping

named list of character vectors, defining column names for different sample groups.

controlGroup

character() defining which sample group serves as control (will calculate foldChanges over control if not NULL)

adjustedRT

use adjusted RTs for all samples for which it is available

ppm

ppm mz tolerance

rtrange

if TRUE, will use rtw starting out from the rtmin and rtmax values instead of rt

rtw

retention time window to get the intensity from, +/- in seconds

areaMode

if TRUE, will calculate peak areas rather than mean intensities

BPPARAM

Parallel processing settings, see BiocParallelParam-classand bpparam

baselineSubtract

subtract baseline when calculating intensities

SN

signal to noise ratio. If not NULL, all peaks with max/min peak intensity below this will be reported as intensity 0. Requires Baselinesubstraction to be off.

columnSuffix

suffix for new intensity columns generated by this function

importFrom

a MseekFT object to use as source for Mseek intensities.

workers

number of worker processes

db

data base to search, either a vector of file paths .csv files or a data.frame, see mzMatch()

mzdiff

mz tolerance in fragment ion matching

adjmethod

method to use for p-value adjustment, see p.adjust()

numClusters

number of clusters to group the features in. Will automatically be set to be at most number of features - 1.

featureMode

if TRUE, will cluster molecular features by intensities across samples. If FALSE, will cluster samples by intensities across features

uniqueMatch

if TRUE, assign MS2 scans only to the matching feature with the closest rt

merge

if TRUE, will merge spectra for each molecular feature

noiselevel

noise level to remove as a portion of largest peak in a spectrum

mzThreshold

if not NULL, will remove all peaks with an mz below this value from the spectra.

useParentMZs

if TRUE, will also match neutral losses between spectra

minpeaks

minimum number of peaks that have to match between two spectra to allow calculation of a score

method

method for similarity calculation, passed to MassTools::makeEdges()

query

an object that contains molecular features that will be matched to object, by a customizable combination of retention time, m/z and MS2 similarity matching

parent_mztol

parent m/z matching tolerance (absolute); matches have to differ by less than either parent_mztol or parent_ppm. If NULL, will ignore m/z for matching.

parent_ppm

parent m/z matching tolerance in ppm; matches have to differ by less than either parent_mztol or parent_ppm.

rttol

retention time tolerance in seconds. If NULL, will ignore rt for matching

getCosine

if TRUE, will calculate MS2 scan similarity for features that match by rt and m/z (or between all features if rttol and parent_mztol are not set)

cosineThreshold

minimum cosine value between features for them to be considered matches. will not filter for MS2 similarity score if NULL.

singleHits

allow only one query hit for each reference molecular feature (will pick the one with best MS2 similarity)

queryPrefix

prefix for columns transferred from the matched query object

returnMapping

if true, returns a matrix defining the indices of matched features between object and query

object2

Feature Table to compare to (with targets expected to carry a label)

newName

name for the LabelFinder result object

peaks

names list of mz values (like output from parsePatterns()) to look for in spectra

losses

names list of mz values (like output from parsePatterns()) to look for in spectra (as neutral losses)

noise

remove peaks below this relative intensity when merging spectra (relative to highest peak, not percent)

Value

an object of the same class as object, with analyses performed and recorded in the processHistory

Examples

## Not run: 
MseekExamplePreload(data = TRUE, tables = TRUE)
LabelFinderResults <- LabelFinder(object = tab2, #remove intensity columns to have them replaced with new ones from rawdata
                                object2 = tab2,
                                newName = "Test",
                                MSData = MSD$data,
                                ref_intensityCols = tab2$intensities[1:3],
                                comp_intensityCols = tab2$intensities[4:7],
                                labelmz = 2*1.00335,
                                ifoldS1 = 10,
                                ifoldS2 = 10000)

## End(Not run)

## Not run: 
MseekExamplePreload(data = TRUE, tables = TRUE)
tab1 <- FTMS2scans(tab1, MSD$data)
LabelFinderResults <- PatternFinder(object = tab1, #needs to have an MS2
                                MSData = MSD$data,
                                peaks = list(testpeak = 85.02895),
                                losses = list(testloss = 18.010788))
LabelFinderResults$df$matched_losses
LabelFinderResults$df$matched_patterns

## End(Not run)


mjhelf/Mosaic documentation built on April 28, 2022, 11:32 a.m.