Skip to contents

The RamanEngine R6 class is a framework for parsing, processing, inspecting and storing Raman spectroscopic data. Raman data can be loaded from "asc", "sif", "json", "wdf", "sdf", "csv" and "txt" files.

References

Sheehy G, Picot F, Dallaire F, Ember K, Nguyen T, Petrecca K, Trudel D, Leblond F (2023). “Open-sourced Raman spectroscopy data processing package implementing a baseline removal algorithm validated from multiple datasets acquired in human tissue and biofluids.” Journal of Biomedical Optics, 28(2), 025002. doi:10.1117/1.JBO.28.2.025002 .

Super class

StreamFind::CoreEngine -> RamanEngine

Active bindings

Spectra

RamanSpectra results object for each analysis or replicate.

Methods

Inherited methods


Method new()

Creates an R6 class RamanEngine. Child of CoreEngine R6 class.

Usage

RamanEngine$new(metadata = NULL, workflow = NULL, analyses = NULL)

Arguments

metadata

A named list or a Metadata object. Each list element must have length one. There is no type restrictions except for name (must be type character), author (must be type character) and date (must be class POSIXct or POSIXt). A file entry must be a character string with a full path to a file.

workflow

A Workflow object, a list of ProcessingStep objects or a character string with a full path to a rds or json file containing a Workflow.

analyses

A RamanAnalyses S7 class object or a character vector with full file paths to "asc", "sif", "json", "wdf", "sdf", "csv" and/or "txt" raman files or a data.frame with colnames file, replicate and blank. The "replicate" column is used to group the analyses and the "blank" column is used to identify the blank samples. The "file" column is the full to the raman files.


Method get_analysis_names()

Gets the analysis replicate names.

Usage

RamanEngine$get_analysis_names(analyses = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.


Method get_replicate_names()

Gets the analysis replicate names.

Usage

RamanEngine$get_replicate_names(analyses = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.


Method get_blank_names()

Gets the analysis blank replicate names.

Usage

RamanEngine$get_blank_names(analyses = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.


Method get_files()

Gets the full file paths of each analysis.

Usage

RamanEngine$get_files(analyses = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.


Method get_overview()

Gets an overview data.frame of all the analyses.

Usage

RamanEngine$get_overview()


Method get_spectra()

Gets a list of spectra data.table objects for each analysis/replicate.

Usage

RamanEngine$get_spectra(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  useRawData = FALSE
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

useRawData

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


Method get_spectra_matrix()

Gets a matrix with spectra.

Usage

RamanEngine$get_spectra_matrix(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  useRawData = FALSE
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

useRawData

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


Method get_chromatograms_peaks()

Gets a data.table with chromatographic peaks.

Usage

RamanEngine$get_chromatograms_peaks(analyses = NULL, targets = NULL, rt = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.


Method add_analyses()

Adds analyses to the engine from Raman files. Note that when adding new files, any existing results are removed.

Usage

RamanEngine$add_analyses(analyses = NULL)

Arguments

analyses

A character vector with full file paths to "asc", "sif", "json", "wdf", "sdf", "csv" and/or "txt" raman files.


Method remove_analyses()

Removes analyses.

Usage

RamanEngine$remove_analyses(analyses = NULL)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.


Method add_replicate_names()

Adds replicate names to the analysis.

Usage

RamanEngine$add_replicate_names(value)

Arguments

value

Character vector with the replicate names. Must have the same length as the number of analyses.


Method add_blank_names()

Adds blank names to the analysis.

Usage

RamanEngine$add_blank_names(value)

Arguments

value

Character vector with the replicate names. Must have the same length as the number of analyses and must be one of replicate names.


Method has_spectra()

Checks if there are spectra, returning TRUE or FALSE.

Usage

RamanEngine$has_spectra()


Method plot_spectra()

Plots spectra.

Usage

RamanEngine$plot_spectra(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  useRawData = FALSE,
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  colorBy = "analyses",
  interactive = TRUE,
  renderEngine = "webgl"
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

useRawData

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

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.

colorBy

A string defining how to legend the plot. Possible values are analyses, targets (the default) or replicates.

interactive

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

renderEngine

The engine to render the data. The default is "webgl".


Method plot_spectra_3d()

Plots spectra in 3D, when a time dimension is available.

Usage

RamanEngine$plot_spectra_3d(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  useRawData = FALSE,
  legendNames = TRUE,
  colorBy = "analyses",
  xLab = NULL,
  yLab = NULL,
  zLab = NULL,
  renderEngine = "webgl"
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

useRawData

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

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

A string defining how to legend the plot. Possible values are analyses, targets (the default) or replicates.

xLab

A string with the title for the x axis.

yLab

A string with the title for the y axis.

zLab

Character (length 1). The label for the z-axis.

renderEngine

The engine to render the data. The default is "webgl".


Method plot_spectra_baseline()

Plots the spectra baseline correction.

Usage

RamanEngine$plot_spectra_baseline(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  colorBy = "analyses",
  interactive = TRUE,
  renderEngine = "webgl"
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

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.

colorBy

A string defining how to legend the plot. Possible values are analyses, targets (the default) or replicates.

interactive

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

renderEngine

The engine to render the data. The default is "webgl".


Method plot_chromatograms()

Plots chromatograms from each analysis/replicates by applying a cumulative sum of the spectrum signals for each time unit.

Usage

RamanEngine$plot_chromatograms(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = NULL,
  useRawData = FALSE,
  xLab = NULL,
  yLab = NULL,
  title = NULL,
  colorBy = "analyses",
  interactive = TRUE,
  renderEngine = "webgl"
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

shift

Numeric of length two with the minimum and maximum shift, in cm-1.

minIntensity

Numeric (length 1) with the minimum intensity.

useRawData

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

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.

colorBy

A string defining how to legend the plot. Possible values are analyses, targets (the default) or replicates.

interactive

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

renderEngine

The engine to render the data. The default is "webgl".


Method plot_chromatograms_peaks()

Plots peaks from chromatograms.

Usage

RamanEngine$plot_chromatograms_peaks(
  analyses = NULL,
  targets = NULL,
  rt = NULL,
  title = NULL,
  legendNames = TRUE,
  colorBy = "targets",
  xLab = NULL,
  yLab = NULL,
  interactive = TRUE,
  renderEngine = "webgl"
)

Arguments

analyses

Character or numeric vector with names or indexes of analyses in the Analyses object.

targets

character vector with names of chromatographic peaks for selective retrieval of data.

rt

Numeric of length two with the minimum and maximum retention time, in seconds.

title

A string with the title.

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

A string defining how to legend the plot. Possible values are analyses, targets (the default) or replicates.

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.

renderEngine

The engine to render the data. The default is "webgl".


Method clone()

The objects of this class are cloneable with this method.

Usage

RamanEngine$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.