Introducing eemR

The eemR package implements various functions used calculate metrics from excitation-emission matrix (EEM) as well as to preform pre-processing corrections before PARAFAC analysis. All functions from this package start with the eem_ prefix. Please note this is a very alpha version of the package for testing purpose only.

library(eemR)
ls("package:eemR")
##  [1] "absorbance"              "eem_bind"               
##  [3] "eem_biological_index"    "eem_coble_peaks"        
##  [5] "eem_cut"                 "eem_export_matlab"      
##  [7] "eem_extract"             "eem_fluorescence_index" 
##  [9] "eem_humification_index"  "eem_inner_filter_effect"
## [11] "eem_names"               "eem_names<-"            
## [13] "eem_raman_normalisation" "eem_read"               
## [15] "eem_remove_blank"        "eem_remove_scattering"  
## [17] "eem_set_wavelengths"

The package can be installed using the following command.

devtools::install_github("PMassicotte/eemR")

Reading excitation-emission

At the moment, to following EEM types are supported:

  • Cary Eclipse .csv files
  • Aqualog .dat files

EEM can be read using the eem_read() function. Please fill an issue if you have other file formats you would like to add to the package.

library(eemR)

## Reading a single eem
file <- system.file("extdata/cary/scans_day_1", "sample1.csv", package = "eemR")
eem <- eem_read(file)

plot(eem)

Implemented metrics

The current implemented metrics are:

  1. The fluorescence index (FI).

  2. The fluorescence peaks.

  3. The fluorescence humification index (HIX).

  4. The biological fluorescence index (BIX).

library(eemR)

folder <- system.file("extdata/cary/scans_day_1", package = "eemR")
eem <- eem_read(folder)

eem_fluorescence_index(eem)
##    sample         fi
## 1    nano -0.5932057
## 2 sample1  1.2647823
## 3 sample2  1.4553330
## 4 sample3  1.3294132
eem_coble_peaks(eem)
##    sample         b         t        a          m         c
## 1    nano 0.8745673 0.1401188 0.140175 0.09653326 0.1255788
## 2 sample1 1.5452981 1.0603312 3.731836 2.42409567 1.8149415
## 3 sample2 1.2629968 0.6647042 1.583489 1.02359302 0.7709074
## 4 sample3 1.4740862 1.3162812 8.416034 6.06335506 6.3179129
eem_humification_index(eem)
##    sample        hix
## 1    nano  0.5568136
## 2 sample1  6.3795618
## 3 sample2  4.2548483
## 4 sample3 13.0246234
eem_biological_index(eem)
##    sample       bix
## 1    nano 2.6812045
## 2 sample1 0.7062640
## 3 sample2 0.8535423
## 4 sample3 0.4867927

PARAFAC pre-processing

Three types of correction are currently supported:

  1. eem_remove_blank() which subtract a water blank from the eem.

  2. eem_remove_scattering() which remove both Raman and Rayleigh scattering.

  3. eem_raman_normalisation() which normalize EEM fluoresence intensities.

  4. eem_inner_filter() which correct for both primary and secondary inner-filter effect.

Removing Raman and Rayleigh scattering (1st and 2nd order)

The eem_remove_scattering() function removes both Raman and Rayleigh scattering from EEMs.

file <- system.file("extdata/cary/scans_day_1", "sample1.csv", package = "eemR")
eem <- eem_read(file)

res <- eem_remove_scattering(eem = eem, type = "raman", order = 1, width = 10)
res <- eem_remove_scattering(eem = res, type = "rayleigh", order = 1, width = 10)

plot(eem)
plot(res)

Blank removal

The eem_remove_blank() function subtract blank (miliq) water from eem. Scatter bands can often be reduced by subtracting water blank.

file <- system.file("extdata/cary/scans_day_1", "nano.csv", package = "eemR")
blank <- eem_read(file)

res <- eem_remove_blank(res, blank)

plot(res)

Raman normalization

The eem_raman_normalisation() function implement a simple calibration method for fluorescence intensity using only the integrated area of a water Raman peak.

res <- eem_raman_normalisation(res, blank)
## Raman area: 9.540904
plot(res)

Inner-filter effect correction

To account for reabsorption of the light emitted by fluorophores in the water, absorbance spectra are used for correction of both primary and secondary inner filtering effects in the EEMs.

data("absorbance")

res <- eem_inner_filter_effect(res, absorbance, 1)
## sample1 
## Range of IFE correction factors: 1.0112 1.5546 
## Range of total absorbance (Atotal) : 0.0096 0.3832
plot(res)

Export to Matlab

PARAFAC analysis was made easy with the fantastic Matlab drEEM toolbox. The function eem_export_matlab() can be used to export the EEMs into a m-file directly usable in Matlab by the drEEM toolbox.

folder <- system.file("extdata/cary/scans_day_1", package = "eemR")
eem <- eem_read(folder)

filename <- paste(tempfile(), ".mat", sep = "")

eem_export_matlab(filename, eem)
## Successfully exported 4 EEMs to /tmp/RtmpTafTVu/file247d3d75d94a.mat.

Note that the name of the structure generated by the function will be OriginalData to complement with PARAFAC standard. Then, the importation into Matlab is made easy using the load() function.

load('FileName.mat');