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.

#>  [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.


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.


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


plot of chunk unnamed-chunk-15

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).


folder <- system.file("extdata/cary/eem", package = "eemR")
eem <- eem_read(folder)
#> Error: file.exists(file) |$isdir is not TRUE
#>    sample       fi
#> 1 sample1 1.264782
#>    sample        b        t        a        m        c
#> 1 sample1 1.545298 1.060331 3.731836 2.424096 1.814941
#>    sample      hix
#> 1 sample1 6.379562
#>    sample      bix
#> 1 sample1 0.706264

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/eem", "sample1.csv", package = "eemR")
eem <- eem_read(file)
#> Error: file.exists(file) |$isdir is not TRUE
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 of chunk unnamed-chunk-17plot of chunk unnamed-chunk-17

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", "nano.csv", package = "eemR")
blank <- eem_read(file)
#> Error: file.exists(file) |$isdir is not TRUE
res <- eem_remove_blank(res, blank)
#> Error in ifelse(class(eem) == "eemlist", TRUE, FALSE): object 'blank' not found

plot of chunk unnamed-chunk-18

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)
#> Error in ifelse(class(eem) == "eemlist", TRUE, FALSE): object 'blank' not found

plot of chunk unnamed-chunk-19

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.


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 of chunk unnamed-chunk-20

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/eem", package = "eemR")
eem <- eem_read(folder)
#> Error: file.exists(file) |$isdir is not TRUE
filename <- paste(tempfile(), ".mat", sep = "")

eem_export_matlab(filename, eem)

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.