Skip to contents

The MassSpecEngine R6 class is a framework for parsing, processing, inspecting and storing mass spectrometry (MS) data. The MassSpecEngine is using patRoon for assembly of Non-Target Screening data processing workflows.

References

Helmus R, ter Laak TL, van Wezel AP, de Voogt P, Schymanski EL (2021). “patRoon: open source software platform for environmental mass spectrometry based non-target screening.” Journal of Cheminformatics, 13(1). doi:10.1186/s13321-020-00477-w .

Helmus R, van de Velde B, Brunner AM, ter Laak TL, van Wezel AP, Schymanski EL (2022). “patRoon 2.0: Improved non-target analysis workflows including automated transformation product screening.” Journal of Open Source Software, 7(71), 4029. doi:10.21105/joss.04029 .

Kapoulkine A (2022). “pugixml 1.13: Light-weight, simple and fast XML parser for C++ with XPath support.” Copyright (C) 2006-2018. http://pugixml.org.

Super class

StreamFind::CoreEngine -> MassSpecEngine

Public fields

help

(list())
List of function elements to access specific reference help pages.

Active bindings

analysisInfo

The analysisInfo data.frame with the list of analyses.

features

The features S4 class object from patRoon.

filtered_features

The filtered features as list of data.table objects for each analysis.

feature_list

List of features data.table objects for each analysis.

featureGroups

The featureGroups S4 class object from patRoon.

MSPeakLists

The MSPeakLists S4 class object from patRoon.

formulas

The formulas S4 class object from patRoon.

compounds

The compounds S4 class object from patRoon.

chromatograms

data.table with processed chromatograms for each analyses.

chromatograms_peaks

data.table with integrated peaks from chromatograms for each analyses.

spectra

List of spectra data.table objects for each analysis.

spectra_charges

data.table with charges assigned to spectra for each analyses.

deconvoluted_spectra

List of deconvoluted spectra for each analysis.

spectra_peaks

data.table with integrated spectra peaks for each analysis.

Methods

Public methods

Inherited methods


Method new()

Creates an R6 MassSpecEngine class object.

Usage

MassSpecEngine$new(
  files = NULL,
  headers = NULL,
  settings = NULL,
  analyses = NULL,
  results = NULL
)

Arguments

files

A character vector with full file path/s of mzML or mzXML file/s or a data.frame with the columns file, replicate and blank with the full file path of mzML or mzXML file/s (character), the replicate group name (character) and the associated blank replicate group name (character). Note the file paths must have the extension .mzML or .mzXML.

headers

A named list with headers or a ProjectHeaders S3 class object. Each list element must have length one. There is no type restrictions except for name (must be type character length 1), author (must be type character length 1), file (must be type character length 1) and date (must be class POSIXct or class POSIXt length 1). See more information in ?ProjectHeaders.

settings

A named list of ProcessingSettings objects or a single ProcessingSettings object. The list names should match the call name of each ProcessingSettings object. Alternatively, a named list with call name, algorithm and parameters to be transformed and added as ProcessingSettings object.

analyses

A MassSpecAnalysis S3 class object or a list with MassSpecAnalysis S3 class objects as elements. (see ?MassSpecAnalysis for more information).

results

A named list of objects from processing methods.

Returns

A new MassSpecEngine class object.


Method get_overview()

Gets an overview data.frame of all the analyses.

Usage

MassSpecEngine$get_overview()


Method get_metadata()

Gets metadata from each analysis.

Usage

MassSpecEngine$get_metadata(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A data.table.


Method get_instrument_info()

Gets the instrument information of each analysis.

Usage

MassSpecEngine$get_instrument_info(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A list.


Method get_software_info()

Gets the software information of each analysis.

Usage

MassSpecEngine$get_software_info(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A list.


Method get_spectra_number()

Gets the number of spectra in each analysis.

Usage

MassSpecEngine$get_spectra_number(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_mode()

Gets the spectra mode of each analysis (i.e., profile or centroid).

Usage

MassSpecEngine$get_spectra_mode(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_level()

Gets the spectra levels of each analysis.

Usage

MassSpecEngine$get_spectra_level(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A list for each analysis with an integer vector.


Method get_spectra_lowest_mz()

Gets the lower m/z value of each analysis.

Usage

MassSpecEngine$get_spectra_lowest_mz(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_highest_mz()

Gets the higher m/z value of each analysis.

Usage

MassSpecEngine$get_spectra_highest_mz(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_lowest_rt()

Gets the start retention time value of each analysis.

Usage

MassSpecEngine$get_spectra_lowest_rt(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_highest_rt()

Gets the end retention time value of each analysis.

Usage

MassSpecEngine$get_spectra_highest_rt(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_polarity()

Gets the polarity of each analysis.

Usage

MassSpecEngine$get_spectra_polarity(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_spectra_headers()

Gets the spectra headers data.table of each analysis.

Usage

MassSpecEngine$get_spectra_headers(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A data.table.


Method get_spectra_tic()

Gets the total ion chromatogram (TIC) of each analysis.

Usage

MassSpecEngine$get_spectra_tic(analyses = NULL, levels = c(1, 2), rt = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

rt

Numeric (length 2). The retention time range to filter the TIC.

Returns

A data.table with the TIC chromatogram.


Method get_spectra_bpc()

Gets the base peak chromatogram (BPC) of each analysis.

Usage

MassSpecEngine$get_spectra_bpc(analyses = NULL, levels = c(1, 2), rt = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

rt

Numeric (length 2). The retention time range to filter the BPC.

Returns

A character vector.


Method get_spectra()

Gets spectra from each analysis.

Usage

MassSpecEngine$get_spectra(
  analyses = NULL,
  levels = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  allTraces = TRUE,
  isolationWindow = 1.3,
  minIntensityMS1 = 0,
  minIntensityMS2 = 0,
  raw_spectra = FALSE,
  loaded_spectra = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

allTraces

Logical, when TRUE all level 2 data is returned. When FALSE and level has 2, only the MS2 traces of MS1 targets are returned, using the isolationWindow to calculate the mass window.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

minIntensityMS1

Numeric value with the minimum intensity of level 1 data (i.e., MS1 data).

minIntensityMS2

Numeric value with the minimum intensity of level 2 data (i.e., MS2 data).

raw_spectra

Logical of length one. Set to TRUE for parsing raw spectra not spectra results/processed.

loaded_spectra

Logical of length one. Set to TRUE for parsing loaded spectra not raw data files.


Method get_spectra_matrix()

Gets a matrix with spectra from analyses.

Usage

MassSpecEngine$get_spectra_matrix(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method get_spectra_eic()

Gets spectra extract ion chromatograms (EIC) from the analyses based on targets as a data.table.

Usage

MassSpecEngine$get_spectra_eic(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.


Method get_spectra_ms1()

Gets level 1 spectra from the analyses based on targets as a data.frame.

Usage

MassSpecEngine$get_spectra_ms1(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 1000
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.


Method get_spectra_ms2()

Gets level 2 spectra from the analyses based on targets as a data.frame.

Usage

MassSpecEngine$get_spectra_ms2(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  isolationWindow = 1.3,
  mzClust = 0.005,
  presence = 0.8,
  minIntensity = 0
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.


Method get_chromatograms_number()

Gets the number of chromatograms in each analysis.

Usage

MassSpecEngine$get_chromatograms_number(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A character vector.


Method get_chromatograms_headers()

Gets the chromatograms headers data.table of each analysis.

Usage

MassSpecEngine$get_chromatograms_headers(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A data.table.


Method get_chromatograms()

Gets chromatograms from each analysis.

Usage

MassSpecEngine$get_chromatograms(
  analyses = NULL,
  chromatograms = NULL,
  minIntensity = NULL,
  raw_chromatograms = FALSE,
  loaded_chromatograms = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

chromatograms

A character or integer vector with the ID (i.e. name) or the index of the chromatograms.

minIntensity

Numeric (length 1) with the minimum intensity.

raw_chromatograms

Logical of length one. Set to TRUE for parsing raw chromatograms not chromatograms results/processed.

loaded_chromatograms

Logical of length one. Set to TRUE for parsing loaded chromatograms not chromatograms from raw data files.

Returns

A data.table with chromatogram/s.


Method get_feature_list()

Gets the list of features for each analysis.

Usage

MassSpecEngine$get_feature_list(analyses = NULL, filtered = FALSE)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

Returns

A list of data.table objects for each analysis.


Method get_features()

Gets a data.table with all features in analyses or as selected by the arguments.

Usage

MassSpecEngine$get_features(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.


Method get_features_eic()

Gets a data.table with feature EICs following the targets from the arguments.

Usage

MassSpecEngine$get_features_eic(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtExpand = 120,
  mzExpand = NULL,
  filtered = FALSE,
  loaded = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtExpand

Numeric (length 1) with the retention time values (in seconds) for expanding left and right the retention time range.

mzExpand

Numeric (length 1) with the mass or mass-to-charge ratio (m/z) (in Da) for expanding left and right the mass range.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.


Method get_features_ms1()

Gets a data.table of averaged MS1 spectrum for features in the analyses or as selected from the arguments.

Usage

MassSpecEngine$get_features_ms1(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtWindow = c(-2, 2),
  mzWindow = c(-5, 100),
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 1000,
  filtered = FALSE,
  loaded = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtWindow

Numeric (length 2) with the retention time values (in seconds) for expanding left and right the retention time range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzWindow

Numeric (length 2) with the mass or mass-to-charge ratio (m/z) values (in Da) for expanding left and right the mass range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.


Method get_features_ms2()

Gets a data.table of averaged MS2 spectrum for features in the analyses or as selected from the arguments.

Usage

MassSpecEngine$get_features_ms2(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  isolationWindow = 1.3,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 0,
  filtered = FALSE,
  loaded = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.


Method get_groups()

Gets a data.table with feature groups from the analyses.

Usage

MassSpecEngine$get_groups(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE,
  intensities = TRUE,
  average = FALSE,
  sdValues = FALSE,
  metadata = FALSE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

intensities

Logical (length 1). When TRUE, feature intensity values are returned.

average

Logical (length 1). When TRUE, feature intensities from each group are averaged and returned for each analysis replicate group.

sdValues

Logical (length 1). Set to TRUE for returning the sd values when averaging the intensity within analysis replicates.

metadata

Logical (length 1). Set to TRUE for returning extra metadata from feature groups (e.g., presence in each analysis replicate and mass and time widths).


Method get_groups_ms1()

Gets a data.table of averaged MS1 spectrum for feature groups in the analyses.

Usage

MassSpecEngine$get_groups_ms1(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtWindow = c(-2, 2),
  mzWindow = c(-5, 90),
  mzClustFeatures = 0.003,
  presenceFeatures = 0.8,
  minIntensityFeatures = 1000,
  loaded = TRUE,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 1000,
  groupBy = "groups",
  filtered = FALSE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtWindow

Numeric (length 2) with the retention time values (in seconds) for expanding left and right the retention time range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzWindow

Numeric (length 2) with the mass or mass-to-charge ratio (m/z) values (in Da) for expanding left and right the mass range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzClustFeatures

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces for features. Highly dependent on the mass resolution of the MS data.

presenceFeatures

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensityFeatures

Numeric (length 1) with the minimum intensity for features.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

groupBy

String with the way of grouping. Possible values are groups and replicates to group by feature groups or feature groups and replicates, respectively.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.


Method get_groups_ms2()

Gets a data.table of averaged MS2 spectrum for feature groups in the analyses.

Usage

MassSpecEngine$get_groups_ms2(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  isolationWindow = 1.3,
  mzClustFeatures = 0.003,
  presenceFeatures = 0.8,
  minIntensityFeatures = 100,
  loaded = TRUE,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 100,
  groupBy = "groups",
  filtered = FALSE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClustFeatures

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces for features. Highly dependent on the mass resolution of the MS data.

presenceFeatures

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensityFeatures

Numeric (length 1) with the minimum intensity for features.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

groupBy

String with the way of grouping. Possible values are groups and replicates to group by feature groups or feature groups and replicates, respectively.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.


Method get_MSPeakLists()

Creates S4 class MSPeakLists. Note that feature groups are required. The MS and MSMS spectra of each feature are then average by patRoon to produce the feature group spectra using the parameters of the function getDefAvgPListParams.

Usage

MassSpecEngine$get_MSPeakLists(
  useLoaded = TRUE,
  maxMSRtWindow = 10,
  precursorMzWindow = 4,
  clusterMzWindow = 0.005,
  topMost = 100,
  minIntensityPre = 10,
  minIntensityPost = 10,
  avgFun = mean,
  method = "distance",
  retainPrecursorMSMS = TRUE
)

Arguments

useLoaded

Logical of length one. When TRUE and both MS1 and MS2 are loaded to features, these are used otherwise the native function generateMSPeakLists from patRoon is used instead.

maxMSRtWindow

Maximum chromatographic peak window used for spectrum averaging (in seconds, +/- retention time). If NULL all spectra from a feature will be taken into account. Lower to decrease processing time.

precursorMzWindow

The m/z window (in Da) to find MS/MS spectra of a precursor. This is typically used for Data-Dependent like MS/MS data and should correspond to the isolation m/z window (i.e. +/- the precursor m/z) that was used to collect the data. For Data-Independent MS/MS experiments, where precursor ions are not isolated prior to fragmentation (e.g. bbCID, MSe, all-ion, ...) the value should be NULL.

clusterMzWindow

m/z window (in Da) used for clustering m/z values when spectra are averaged. For method="hclust" this corresponds to the cluster height, while for method="distance" this value is used to find nearby masses (+/- window). Too small windows will prevent clustering m/z values (thus erroneously treating equal masses along spectra as different), whereas too big windows may cluster unrelated m/z values from different or even the same spectrum together.

topMost

Only retain this maximum number of MS peaks when generating averaged spectra. Lowering this number may exclude more irrelevant (noisy) MS peaks and decrease processing time, whereas higher values may avoid excluding lower intense MS peaks that may still be of interest.

minIntensityPre

MS peaks with intensities below this value will be removed (applied prior to selection by topMost) before averaging.

minIntensityPost

MS peaks with intensities below this value will be removed after averaging.

avgFun

Function that is used to calculate average m/z values.

method

Method used for producing averaged MS spectra. Valid values are "hclust", used for hierarchical clustering (using the fastcluster package), and "distance", to use the between peak distance. The latter method may reduces processing time and memory requirements, at the potential cost of reduced accuracy.

retainPrecursorMSMS

For MS/MS data only: if TRUE then always retain the precursor mass peak even if is not among the topMost peaks. Note that MS precursor mass peaks are always kept. Furthermore, note that precursor peaks in both MS and MS/MS data may still be removed by intensity thresholds (this is unlike the filter method function).

pruneMissingPrecursorMS

For MS data only: if TRUE then peak lists without a precursor peak are removed. Note that even when this is set to FALSE, functionality that relies on MS (not MS/MS) peak lists (e.g. formulae calculation) will still skip calculation if a precursor is not found.


Method get_isotopes()

Gets a data.table of feature isotopes (i.e., isotope clusters) in the analyses.

Usage

MassSpecEngine$get_isotopes(
  analyses = NULL,
  groups = NULL,
  features = NULL,
  clusters = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

groups

A numeric or character vector with the number or ID of feature groups, respectively.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

clusters

A numeric vector with the number/s of feature cluster/s.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.


Method get_suspects()

Gets a data.table of suspects from features according to a defined database and mass (ppm) and time (sec) deviations.

Usage

MassSpecEngine$get_suspects(
  analyses = NULL,
  database = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 5,
  sec = 10,
  millisec = 5,
  ppmMS2 = 10,
  minFragments = 3,
  isolationWindow = 1.3,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 0,
  filtered = FALSE,
  onGroups = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

database

A data.frame with at least the columns name and mass, indicating the name and neutral monoisotopic mass of the suspect targets.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

ppmMS2

Numeric (length 1) with the mass deviation for MS2, in ppm.

minFragments

Integer (length 1) with the minimum number of fragments.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

onGroups

Logical (length 1). When TRUE results are return based on feature groups not individual features.

Details

The ppm and sec which indicate the mass (im ppm) and time (in seconds) deviations applied during the screening.


Method get_internal_standards()

Gets a data.table with internal standards found by the find_internal_standards module.

Usage

MassSpecEngine$get_internal_standards(average = TRUE)

Arguments

average

Logical of length one. When TRUE and groups are present, internal standards are averaged per analysis replicate group.


Method add_analyses()

Adds analyses. Note that when adding new analyses, any existing results are removed.

Usage

MassSpecEngine$add_analyses(analyses = NULL)

Arguments

analyses

A MassSpecAnalysis S3 class object or a list with MassSpecAnalysis S3 class objects as elements (see ?MassSpecAnalysis for more information).

Returns

Invisible.


Method add_files()

Adds analyses based on mzML/mzXML files. Note that when adding new mzML/mzXML files, any existing grouping or features are removed.

Usage

MassSpecEngine$add_files(files = NULL)

Arguments

files

A character vector with full file path/s of mzML or mzXML file/s or a data.frame with the columns file, replicate and blank with the full file path of mzML or mzXML file/s (character), the replicate group name (character) and the associated blank replicate group name (character). Note the file paths must have the extension .mzML or .mzXML.

Returns

Invisible.


Method add_results()

Adds data from results to the engine.

Usage

MassSpecEngine$add_results(value = NULL)

Arguments

value

A named list with data from results.

Returns

Invisible.


Method load_spectra()

Loads all spectra from all analyses.

Usage

MassSpecEngine$load_spectra(
  analyses = NULL,
  levels = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  allTraces = TRUE,
  isolationWindow = 1.3,
  minIntensityMS1 = 0,
  minIntensityMS2 = 0
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

allTraces

Logical, when TRUE all level 2 data is returned. When FALSE and level has 2, only the MS2 traces of MS1 targets are returned, using the isolationWindow to calculate the mass window.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

minIntensityMS1

Numeric value with the minimum intensity of level 1 data (i.e., MS1 data).

minIntensityMS2

Numeric value with the minimum intensity of level 2 data (i.e., MS2 data).

Returns

Invisible.


Method load_chromatograms()

Loads all chromatograms from all analyses.

Usage

MassSpecEngine$load_chromatograms(chromatograms = NULL)

Arguments

chromatograms

A character or integer vector with the ID (i.e. name) or the index of the chromatograms.

Returns

Invisible.


Method remove_analyses()

Removes analyses.

Usage

MassSpecEngine$remove_analyses(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

Invisible.


Method remove_features()

Removes features. Note that feature groups are also removed when features is set to NULL

Usage

MassSpecEngine$remove_features(features = NULL, filtered = FALSE)

Arguments

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

Returns

Invisible.


Method remove_features_ms1()

Removes loaded MS1 spectra from features in the analyses. In practice, the column ms1 in the features data.table of each analysis object is removed.

Usage

MassSpecEngine$remove_features_ms1()

Returns

Invisible.


Method remove_features_ms2()

Removes loaded MS2 spectra from features in the analyses. In practice, the column ms2 in the features data.table of each analysis object is removed.

Usage

MassSpecEngine$remove_features_ms2()

Returns

Invisible.


Method remove_groups()

Removes feature groups.

Usage

MassSpecEngine$remove_groups(groups = NULL, filtered = FALSE)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

Returns

Invisible.


Method subset_analyses()

Subsets a MassSpecEngine object on analyses.

Usage

MassSpecEngine$subset_analyses(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

Returns

A new cloned MassSpecEngine object with only the analyses as defined by the analyses argument.


Method subset_features()

Subsets a MassSpecEngine object on features from analyses.

Usage

MassSpecEngine$subset_features(features = NULL)

Arguments

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

Returns

A new cloned MassSpecEngine object with only the features as defined by the features argument.


Method subset_groups()

Subsets a MassSpecEngine object on feature groups. Note that when sub-setting groups, features that lose correspondence are removed.

Usage

MassSpecEngine$subset_groups(groups = NULL)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

Returns

A new cloned MassSpecEngine object with only the groups as defined by the groups argument.


Method has_ion_mobility()

Checks if analyses have have drift time from ion mobility, returning TRUE or FALSE for each analysis.

Usage

MassSpecEngine$has_ion_mobility(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_loaded_spectra()

Checks for loaded spectra in given analyses names/indices, returning TRUE or FALSE for each analysis.

Usage

MassSpecEngine$has_loaded_spectra(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_loaded_chromatograms()

Checks for loaded chromatograms in given analyses names/indices, returning TRUE or FALSE for each analysis.

Usage

MassSpecEngine$has_loaded_chromatograms(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_features()

Checks if given analyses have features, returning TRUE or FALSE.

Usage

MassSpecEngine$has_features(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_groups()

Checks if there are feature groups from grouping features across analyses, returning TRUE or FALSE.

Usage

MassSpecEngine$has_groups(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_loaded_features_ms1()

Checks for loaded features MS1 in given analyses names/indices, returning TRUE or FALSE.

Usage

MassSpecEngine$has_loaded_features_ms1(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_loaded_features_ms2()

Checks for loaded features MS2 in given analyses names/indices, returning TRUE or FALSE.

Usage

MassSpecEngine$has_loaded_features_ms2(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_features_eic()

Checks for presence of feature extracted ion chromatograms (EICs) in given analyses names/indices, returning TRUE or FALSE.

Usage

MassSpecEngine$has_features_eic(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_suspects()

Checks for presence of suspects in given analyses names/indices, returning TRUE or FALSE.

Usage

MassSpecEngine$has_suspects(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_MSPeakLists()

Checks if there are MSPeakLists for analyses, returning TRUE or FALSE.

Usage

MassSpecEngine$has_MSPeakLists(analyses = NULL)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.


Method has_formulas()

Checks if there are formulas assigned to feature groups, returning TRUE or FALSE.

Usage

MassSpecEngine$has_formulas()


Method has_compounds()

Checks if there are compounds assigned to feature groups, returning TRUE or FALSE.

Usage

MassSpecEngine$has_compounds()


Method has_chromatograms()

Checks if there are chromatograms, returning TRUE or FALSE.

Usage

MassSpecEngine$has_chromatograms()


Method has_chromatograms_peaks()

Checks if there are integrated peaks from chromatograms, returning TRUE or FALSE.

Usage

MassSpecEngine$has_chromatograms_peaks()


Method has_spectra()

Checks if there are spectra, returning TRUE or FALSE.

Usage

MassSpecEngine$has_spectra()


Method has_spectra_peaks()

Checks if there are spectra peaks, returning TRUE or FALSE.

Usage

MassSpecEngine$has_spectra_peaks()


Method has_deconvoluted_spectra()

Checks if there are deconvoluted spectra, returning TRUE or FALSE.

Usage

MassSpecEngine$has_deconvoluted_spectra()


Method has_spectra_charges()

Checks if there are charges assigned to spectra, returning TRUE or FALSE.

Usage

MassSpecEngine$has_spectra_charges()


Method plot_raw_spectra()

Plots raw spectra in 3D for given MS analyses.

Usage

MassSpecEngine$plot_raw_spectra(
  analyses = NULL,
  levels = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  allTraces = TRUE,
  isolationWindow = 1.3,
  minIntensityMS1 = 0,
  minIntensityMS2 = 0,
  legendNames = TRUE,
  colorBy = "analyses",
  xVal = "rt",
  yVal = "mz",
  xLab = NULL,
  yLab = NULL,
  zLab = NULL
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

allTraces

Logical, when TRUE all level 2 data is returned. When FALSE and level has 2, only the MS2 traces of MS1 targets are returned, using the isolationWindow to calculate the mass window.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

minIntensityMS1

Numeric value with the minimum intensity of level 1 data (i.e., MS1 data).

minIntensityMS2

Numeric value with the minimum intensity of level 2 data (i.e., MS2 data).

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

xVal

Character length one. Possible values are "mz", "rt" or "drift".

yVal

Character length one. Possible values are "mz", "rt" or "drift".

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

zLab

A string with the title for the z axis.


Method plot_spectra()

Plots spectra given MS analyses.

Usage

MassSpecEngine$plot_spectra(
  analyses = NULL,
  levels = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  allTraces = TRUE,
  isolationWindow = 1.3,
  minIntensityMS1 = 0,
  minIntensityMS2 = 0,
  raw_spectra = FALSE,
  loaded_spectra = TRUE,
  averaged = TRUE,
  baseline = FALSE,
  legendNames = TRUE,
  colorBy = "analyses",
  xVal = "mz",
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  cex = 0.6,
  showLegend = TRUE,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

allTraces

Logical, when TRUE all level 2 data is returned. When FALSE and level has 2, only the MS2 traces of MS1 targets are returned, using the isolationWindow to calculate the mass window.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

minIntensityMS1

Numeric value with the minimum intensity of level 1 data (i.e., MS1 data).

minIntensityMS2

Numeric value with the minimum intensity of level 2 data (i.e., MS2 data).

raw_spectra

Logical of length one. Set to TRUE for plotting the spectra in results not the raw spectra.

loaded_spectra

Logical of length one. Set to TRUE for parsing loaded spectra not spectra from raw data files.

averaged

Logical of length one. Set to TRUE for plotting the averaged spectra.

baseline

Logical of length one. Set to TRUE for plotting the spectra with baseline corrected.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

xVal

Character length one. Possible values are "mz", "rt", "drift" or "mass".

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

title

A string with the title.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

showLegend

Logical (length 1). Set to TRUE to show legend.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_chromatograms()

Plots chromatograms in the analyses.

Usage

MassSpecEngine$plot_chromatograms(
  analyses = NULL,
  chromatograms = NULL,
  minIntensity = NULL,
  raw_chromatograms = FALSE,
  loaded_chromatograms = TRUE,
  title = NULL,
  colorBy = "targets",
  legendNames = NULL,
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

chromatograms

A character or integer vector with the ID (i.e. name) or the index of the chromatograms.

minIntensity

Numeric (length 1) with the minimum intensity.

raw_chromatograms

Logical of length one. Set to TRUE for parsing raw chromatograms not chromatograms results/processed.

loaded_chromatograms

Logical of length one. Set to TRUE for parsing loaded chromatograms not chromatograms from raw data files.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_chromatograms_baseline()

Plots chromatograms corrected baseline for given analyses.

Usage

MassSpecEngine$plot_chromatograms_baseline(
  analyses = NULL,
  chromatograms = NULL,
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  cex = 0.6,
  showLegend = TRUE,
  colorBy = "analyses",
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

chromatograms

A character or integer vector with the ID (i.e. name) or the index of the chromatograms.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

title

A string with the title.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

showLegend

Logical (length 1). Set to TRUE to show legend.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.

Returns

A plot.


Method plot_spectra_xic()

Plots spectra extract ion chromatograms (EIC) and m/z vs retention time from the analyses.

Usage

MassSpecEngine$plot_spectra_xic(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  legendNames = NULL,
  plotTargetMark = TRUE,
  targetsMark = NULL,
  ppmMark = 5,
  secMark = 10,
  numberRows = 1
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

plotTargetMark

Logical (length 1), set to TRUE to plot a target mark.

targetsMark

A data.frame with columns mz and rt, defining the m/z and retention time values of each target. Note that the number of rows should match with the number of targets.

ppmMark

A numeric vector of length one to define the mass deviation, in ppm, of the target mark. The default is 5 ppm.

secMark

A numeric vector of length one to define the time deviation, in seconds, of the target mark. The default is 10 ppm.

numberRows

An integer vector of length one to define the number of rows to grid the plots. Note that each target is always plotted in one row for all selected analyses.


Method plot_spectra_eic()

Plots spectra extract ion chromatograms (EIC) from the analyses based on targets.

Usage

MassSpecEngine$plot_spectra_eic(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_spectra_tic()

Plots the spectra total ion chromatogram (TIC) of each analysis.

Usage

MassSpecEngine$plot_spectra_tic(
  analyses = NULL,
  levels = c(1, 2),
  rt = NULL,
  title = NULL,
  colorBy = "analyses",
  legendNames = NULL,
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_spectra_bpc()

Plots the spectra base peak chromatogram (BPC) of each analysis.

Usage

MassSpecEngine$plot_spectra_bpc(
  analyses = NULL,
  levels = c(1, 2),
  rt = NULL,
  title = NULL,
  colorBy = "analyses",
  legendNames = NULL,
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

levels

Integer vector with the levels of MS data.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.

Returns

A plot.


Method plot_spectra_ms2()

Plots level 2 spectra from the analyses based on targets.

Usage

MassSpecEngine$plot_spectra_ms2(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  isolationWindow = 1.3,
  mzClust = 0.005,
  presence = 0.8,
  minIntensity = 0,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_spectra_ms1()

Plots level 1 spectra from the analyses based on targets.

Usage

MassSpecEngine$plot_spectra_ms1(
  analyses = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  id = NULL,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 1000,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showText = FALSE,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

id

Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showText

Logical (length 1), set to TRUE to show the text annotations.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_features()

Plots features from analyses.

Usage

MassSpecEngine$plot_features(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtExpand = 120,
  mzExpand = NULL,
  loaded = TRUE,
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtExpand

Numeric (length 1) with the retention time values (in seconds) for expanding left and right the retention time range.

mzExpand

Numeric (length 1) with the mass or mass-to-charge ratio (m/z) (in Da) for expanding left and right the mass range.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method map_features()

Plots a map of the retention time vs m/z of features from analyses.

Usage

MassSpecEngine$map_features(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showLegend = TRUE,
  xlim = 30,
  ylim = 0.05,
  cex = 0.6,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_features_ms1()

Plots level 1 spectra from features in the analyses.

Usage

MassSpecEngine$plot_features_ms1(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtWindow = c(-2, 2),
  mzWindow = c(-5, 100),
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 1000,
  filtered = FALSE,
  loaded = TRUE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtWindow

Numeric (length 2) with the retention time values (in seconds) for expanding left and right the retention time range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzWindow

Numeric (length 2) with the mass or mass-to-charge ratio (m/z) values (in Da) for expanding left and right the mass range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_features_ms2()

Plots level 2 spectra from features in the analyses.

Usage

MassSpecEngine$plot_features_ms2(
  analyses = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  isolationWindow = 1.3,
  mzClust = 0.005,
  presence = 0.8,
  minIntensity = 0,
  filtered = FALSE,
  loaded = TRUE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_groups()

Plots feature groups EIC.

Usage

MassSpecEngine$plot_groups(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtExpand = 15,
  mzExpand = 0.005,
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  interactive = TRUE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtExpand

Numeric (length 1) with the retention time values (in seconds) for expanding left and right the retention time range.

mzExpand

Numeric (length 1) with the mass or mass-to-charge ratio (m/z) (in Da) for expanding left and right the mass range.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_groups_ms1()

Plots level 1 spectra from feature groups in the analyses.

Usage

MassSpecEngine$plot_groups_ms1(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtWindow = c(-2, 2),
  mzWindow = c(-5, 90),
  mzClustFeatures = 0.005,
  presenceFeatures = 0.8,
  minIntensityFeatures = 1000,
  loaded = TRUE,
  mzClust = 0.005,
  presence = 0.8,
  minIntensity = 1000,
  groupBy = "groups",
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtWindow

Numeric (length 2) with the retention time values (in seconds) for expanding left and right the retention time range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzWindow

Numeric (length 2) with the mass or mass-to-charge ratio (m/z) values (in Da) for expanding left and right the mass range. The first element expands left and the second expands right. Note that the first element should be negative to expand to the left.

mzClustFeatures

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces for features. Highly dependent on the mass resolution of the MS data.

presenceFeatures

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensityFeatures

Numeric (length 1) with the minimum intensity for features.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

groupBy

String with the way of grouping. Possible values are groups and replicates to group by feature groups or feature groups and replicates, respectively.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_groups_ms2()

Plots level 1 spectra from feature groups in the analyses.

Usage

MassSpecEngine$plot_groups_ms2(
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  isolationWindow = 1.3,
  mzClustFeatures = 0.003,
  presenceFeatures = 0.8,
  minIntensityFeatures = 100,
  loaded = TRUE,
  mzClust = 0.003,
  presence = TRUE,
  minIntensity = 100,
  groupBy = "groups",
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClustFeatures

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces for features. Highly dependent on the mass resolution of the MS data.

presenceFeatures

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensityFeatures

Numeric (length 1) with the minimum intensity for features.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

groupBy

String with the way of grouping. Possible values are groups and replicates to group by feature groups or feature groups and replicates, respectively.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_groups_overview()

Method to give an overview of the EIC, alignment and intensity variance from features within target feature groups.

Usage

MassSpecEngine$plot_groups_overview(
  analyses = NULL,
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  rtExpand = 120,
  mzExpand = 0.005,
  loaded = TRUE,
  filtered = FALSE,
  legendNames = NULL,
  title = NULL,
  heights = c(0.35, 0.5, 0.15)
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

rtExpand

Numeric (length 1) with the retention time values (in seconds) for expanding left and right the retention time range.

mzExpand

Numeric (length 1) with the mass or mass-to-charge ratio (m/z) (in Da) for expanding left and right the mass range.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

heights

A numeric vector of length 3 to control the height of the first, second and third plot, respectively.


Method plot_groups_profile()

Method to plot the intensity profile of feature groups across the analyses.

Usage

MassSpecEngine$plot_groups_profile(
  analyses = NULL,
  groups = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE,
  normalized = TRUE,
  legendNames = NULL,
  title = NULL
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

groups

A numeric or character vector with the number or ID of feature groups, respectively.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

normalized

Logical (length 1). When TRUE the profile intensities are normalized.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.


Method plot_internal_standards_qc()

Plots the quality control assessment of the internal standards.

Usage

MassSpecEngine$plot_internal_standards_qc()


Method plot_suspects()

Plots suspects.

Usage

MassSpecEngine$plot_suspects(
  analyses = NULL,
  database = NULL,
  features = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 4,
  sec = 10,
  millisec = 5,
  ppmMS2 = 10,
  minFragments = 3,
  isolationWindow = 1.3,
  mzClust = 0.003,
  presence = 0.8,
  minIntensity = 0,
  filtered = FALSE,
  rtExpand = 120,
  mzExpand = 0.005,
  loaded = TRUE,
  colorBy = "targets"
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

database

A data.frame with at least the columns name and mass, indicating the name and neutral monoisotopic mass of the suspect targets.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

ppmMS2

Numeric (length 1) with the mass deviation for MS2, in ppm.

minFragments

Integer (length 1) with the minimum number of fragments.

isolationWindow

Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).

mzClust

Numeric (length 1) with the mass deviation threshold (in Da) to cluster mass traces. Highly dependent on the mass resolution of the MS data.

presence

Numeric (length 1) with the required presence ratio from 0 (i.e., doesn't need to be present in any spectra) to 1 (i.e., must be present in all spectra) for traces during clustering of spectra.

minIntensity

Numeric (length 1) with the minimum intensity.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

rtExpand

Numeric (length 1) with the retention time values (in seconds) for expanding left and right the retention time range.

mzExpand

Numeric (length 1) with the mass or mass-to-charge ratio (m/z) (in Da) for expanding left and right the mass range.

loaded

Logical (length 1). When TRUE and if available, loaded data will be used instead of raw data.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

Details

The ppm and sec which indicate the mass (im ppm) and time (in seconds) deviations applied during the screening.


Method map_isotopes()

Maps isotopic clusters in the analyses.

Usage

MassSpecEngine$map_isotopes(
  analyses = NULL,
  groups = NULL,
  features = NULL,
  clusters = NULL,
  mass = NULL,
  mz = NULL,
  rt = NULL,
  drift = NULL,
  ppm = 20,
  sec = 60,
  millisec = 5,
  filtered = FALSE,
  xlim = 30,
  ylim = 0.05,
  showLegend = TRUE,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

groups

A numeric or character vector with the number or ID of feature groups, respectively.

features

A character vector with the feature IDs or a data.frame or data.table with a column named feature with the feature IDs. A column named analysis can be given to specify from which analyses the features matched.

clusters

A numeric vector with the number/s of feature cluster/s.

mass

A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named min and max with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns named mass and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must be min, max, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

mz

A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named mzmin and mzmax with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns named mz and rt and/or drift. Then, the deviations given in the ppm, sec and millisec arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must be mzmin, mzmax, rtmin, rtmax, driftmin and driftmax. Note that when mass/time ranges are given, the ppm, sec and millisec arguments are not used.

rt

A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).

drift

A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).

ppm

Numeric of length one with the mass deviation, in ppm.

sec

Numeric of length one with the time deviation, in seconds.

millisec

Numeric of length one with the drift time deviation, in milliseconds.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

showLegend

Logical (length 1). Set to TRUE to show legend.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_chromatograms_peaks()

Plots peaks from chromatograms from analyses.

Usage

MassSpecEngine$plot_chromatograms_peaks(
  analyses = NULL,
  chromatograms = NULL,
  legendNames = NULL,
  title = NULL,
  colorBy = "targets",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  xLab = NULL,
  yLab = NULL,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

chromatograms

A character or integer vector with the ID (i.e. name) or the index of the chromatograms.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_spectra_charges()

Plots charge assignment of deconvoluted spectra from analyses.

Usage

MassSpecEngine$plot_spectra_charges(
  analyses = NULL,
  legendNames = NULL,
  title = NULL,
  colorBy = "analyses",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  xLab = NULL,
  yLab = NULL,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_deconvoluted_spectra()

Plots deconvoluted spectra in given MS analyses.

Usage

MassSpecEngine$plot_deconvoluted_spectra(
  analyses = NULL,
  legendNames = NULL,
  colorBy = "analyses",
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  cex = 0.6,
  showLegend = TRUE,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

title

A string with the title.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

showLegend

Logical (length 1). Set to TRUE to show legend.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method plot_spectra_peaks()

Plots peaks from spectra from analyses.

Usage

MassSpecEngine$plot_spectra_peaks(
  analyses = NULL,
  legendNames = NULL,
  title = NULL,
  colorBy = "analyses",
  showLegend = TRUE,
  xlim = NULL,
  ylim = NULL,
  cex = 0.6,
  xLab = NULL,
  yLab = NULL,
  interactive = TRUE
)

Arguments

analyses

A numeric/character vector with the number/name of the analyses.

legendNames

A character vector with the same length as the targets or TRUE or FALSE for using the name in the added targets as legend of the plot.

title

A string with the title.

colorBy

Character (length 1). One of analyses (the default), polarities, levels, targets or replicates. Mixed use (e.g. analyses+polarities) is also possible.

showLegend

Logical (length 1). Set to TRUE to show legend.

xlim

A length one or two numeric vector for setting the x limits of the plot.

ylim

A length one or two numeric vector for setting the y limits of the plot.

cex

Numeric (length 1) defining the scale of the legend for non interactive plotting.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

interactive

Logical (length 1). When TRUE, the data is plotted interactively using plotly.


Method check_correspondence()

Checks the correspondence of features within feature groups, returning TRUE or FALSE.

Usage

MassSpecEngine$check_correspondence()


Method report()

Saves the HTML report from the function report from the package patRoon. The interface is exactly the same and the arguments description are taken from the documentation in patRoon. Therefore, for further information, we recommend to consult directly the function report in patRoon.

Usage

MassSpecEngine$report(
  path = paste0(getwd(), "/report"),
  filtered = FALSE,
  settingsFile = system.file("report", "settings.yml", package = "patRoon"),
  EICParams = patRoon::getDefEICParams(topMost = 1, topMostByRGroup = TRUE),
  specSimParams = patRoon::getDefSpecSimParams(),
  clearPath = FALSE,
  openReport = TRUE,
  parallel = TRUE,
  overrideSettings = list()
)

Arguments

path

Character (length 1) with the path to the report destination.

filtered

Logical (length 1). When TRUE, filtered features/groups are considered.

settingsFile

The path to the report settings file used for report configuration (see Report settings in report).

EICParams

A named list with parameters used for extracted ion chromatogram (EIC) creation. See getDefEICParams.

specSimParams

A named list with parameters that influence the calculation of MS spectra similarities. See getDefSpecSimParams.

clearPath

If TRUE then the report destination path will be (recursively) removed prior to reporting.

openReport

If set to TRUE then the output report file will be opened with the system browser.

parallel

If set to TRUE then code is executed in parallel.

overrideSettings

A list with settings that override those from the report settings file. See report.

Returns

An interactive HTML report from the package patRoon.


Method processing_methods()

A data.table with available data processing methods.

Usage

MassSpecEngine$processing_methods()


Method clone()

The objects of this class are cloneable with this method.

Usage

MassSpecEngine$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.