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 and .sif 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

raw_spectra

Named list of raw spectra data.table objects for each analysis.

spectra

Named list of spectra data.table objects for each analysis or replicate.

Methods

Inherited methods


Method new()

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

Usage

RamanEngine$new(file = NULL, headers = NULL, workflow = NULL, analyses = NULL)

Arguments

file

Character of length one with the full path to the sqlite save file of the engine.

headers

A ProjectHeaders S7 class object.

workflow

A Workflow S7 class object.

analyses

A RamanAnalyses S7 class object or a character vector with full file paths to .asc and/or .sif 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 path to .asc and/or .sif files.


Method get_analysis_names()

Gets the analysis replicate names.

Usage

RamanEngine$get_analysis_names(analyses = NULL)

Arguments

analyses

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


Method get_replicate_names()

Gets the analysis replicate names.

Usage

RamanEngine$get_replicate_names(analyses = NULL)

Arguments

analyses

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


Method get_blank_names()

Gets the analysis blank replicate names.

Usage

RamanEngine$get_blank_names(analyses = NULL)

Arguments

analyses

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


Method get_files()

Gets the full file paths of each analysis.

Usage

RamanEngine$get_files(analyses = NULL)

Arguments

analyses

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


Method get_overview()

Gets an overview data.frame of all the analyses.

Usage

RamanEngine$get_overview()


Method get_spectra()

Gets a data.table with spectra from analyses.

Usage

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

Arguments

analyses

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

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 spectra not spectra results/processed.


Method get_spectra_matrix()

Gets a matrix with spectra from analyses.

Usage

RamanEngine$get_spectra_matrix(analyses = NULL)

Arguments

analyses

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


Method add_analyses()

Adds analyses based on asc files. Note that when adding new files, any existing results are removed.

Usage

RamanEngine$add_analyses(analyses = NULL)

Arguments

analyses

A RamanAnalysis S3 class object or a list with RamanAnalysis S3 class objects as elements (see ?RamanAnalysis for more information) or a character vector with with full paths of .asc files from Raman analyses.

Returns

Invisible.


Method remove_analyses()

Removes analyses.

Usage

RamanEngine$remove_analyses(analyses = NULL)

Arguments

analyses

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

Returns

Invisible.


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 results, returning TRUE or FALSE.

Usage

RamanEngine$has_spectra()


Method plot_spectra()

Plots spectra for given RamanAnalyses.

Usage

RamanEngine$plot_spectra(
  analyses = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = 0,
  useRawData = FALSE,
  xVal = "shift",
  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.

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 spectra not spectra results/processed.

xVal

Character of length one. Possible are "rt" or "shift" for using the retention time or the shift as x axis, respectively.

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

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.

Returns

A plot.


Method plot_spectra_baseline()

Plots spectra corrected for given RamanAnalyses.

Usage

RamanEngine$plot_spectra_baseline(
  analyses = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = 0,
  xVal = "shift",
  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.

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.

xVal

Character of length one. Possible are "rt" or "shift" for using the retention time or the shift as x axis, respectively.

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

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.

Returns

A plot.


Method plot_spectra_peaks()

Plots peaks from spectra from analyses.

Usage

RamanEngine$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

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

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_chromatograms()

Plots chromatograms from analyses with spectra coupled to LC.

Usage

RamanEngine$plot_chromatograms(
  analyses = NULL,
  rt = NULL,
  shift = NULL,
  minIntensity = 0,
  useRawData = FALSE,
  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.

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 spectra not spectra 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.

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

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.

Returns

A plot.


Method plot_chromatograms_peaks()

Plots peaks from chromatograms from analyses.

Usage

RamanEngine$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

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

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 clone()

The objects of this class are cloneable with this method.

Usage

RamanEngine$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.