Skip to contents




Introduction

In this article, we demonstrate how the StreamFind R package can be used to evaluate ozonation of secondary wastewater effluent (i.e., effluent of the aerated biological treatment) using mass spectrometry (MS). A set of 18 mzML files, representing blank, influent and effluent measurements in triplicate for both positive and negative ionization mode, are used.

basename(files)
 [1] "01_tof_ww_is_neg_blank-r001.mzML"        
 [2] "01_tof_ww_is_neg_blank-r002.mzML"        
 [3] "01_tof_ww_is_neg_blank-r003.mzML"        
 [4] "01_tof_ww_is_pos_blank-r001.mzML"        
 [5] "01_tof_ww_is_pos_blank-r002.mzML"        
 [6] "01_tof_ww_is_pos_blank-r003.mzML"        
 [7] "02_tof_ww_is_neg_influent-r001.mzML"     
 [8] "02_tof_ww_is_neg_influent-r002.mzML"     
 [9] "02_tof_ww_is_neg_influent-r003.mzML"     
[10] "02_tof_ww_is_pos_influent-r001.mzML"     
[11] "02_tof_ww_is_pos_influent-r002.mzML"     
[12] "02_tof_ww_is_pos_influent-r003.mzML"     
[13] "03_tof_ww_is_neg_o3sw_effluent-r001.mzML"
[14] "03_tof_ww_is_neg_o3sw_effluent-r002.mzML"
[15] "03_tof_ww_is_neg_o3sw_effluent-r003.mzML"
[16] "03_tof_ww_is_pos_o3sw_effluent-r001.mzML"
[17] "03_tof_ww_is_pos_o3sw_effluent-r002.mzML"
[18] "03_tof_ww_is_pos_o3sw_effluent-r003.mzML"

The showcase will use the StreamFind main class MassSpecEngine, which encapsulates all tools required for parsing, storing, processing and visualizing MS data. Note that not all methods/functions will be shown as the demonstration focuses of the workflow to assess wastewater ozonation. For a complete overview of the StreamFind R package for mass spectrometry, the article StreamFind for mass spectrometry is recommended.

MassSpecEngine

The main R6 MassSpecEngine class object is created using the MassSpecEngine$new(), as shown below. The argument files can be used to add directly the set of mzML files. Note that the original vendor files were converted to mzML format using the convert_ms_files() function, which uses the msConvert command line from ProteoWizard.

# Create a MassSpecEngine from mzML files
ms <- MassSpecEngine$new(files = files)
# Print in console a summary of the MassSpecEngine
ms

MassSpecEngine
name          NA
author        NA
file          NA
date          2024-08-01 10:04:40.137931

Workflow empty 

Analyses
                               analysis                      replicate  blank
                                 <char>                         <char> <char>
 1:         01_tof_ww_is_neg_blank-r001         01_tof_ww_is_neg_blank   <NA>
 2:         01_tof_ww_is_neg_blank-r002         01_tof_ww_is_neg_blank   <NA>
 3:         01_tof_ww_is_neg_blank-r003         01_tof_ww_is_neg_blank   <NA>
 4:         01_tof_ww_is_pos_blank-r001         01_tof_ww_is_pos_blank   <NA>
 5:         01_tof_ww_is_pos_blank-r002         01_tof_ww_is_pos_blank   <NA>
 6:         01_tof_ww_is_pos_blank-r003         01_tof_ww_is_pos_blank   <NA>
 7:      02_tof_ww_is_neg_influent-r001      02_tof_ww_is_neg_influent   <NA>
 8:      02_tof_ww_is_neg_influent-r002      02_tof_ww_is_neg_influent   <NA>
 9:      02_tof_ww_is_neg_influent-r003      02_tof_ww_is_neg_influent   <NA>
10:      02_tof_ww_is_pos_influent-r001      02_tof_ww_is_pos_influent   <NA>
11:      02_tof_ww_is_pos_influent-r002      02_tof_ww_is_pos_influent   <NA>
12:      02_tof_ww_is_pos_influent-r003      02_tof_ww_is_pos_influent   <NA>
13: 03_tof_ww_is_neg_o3sw_effluent-r001 03_tof_ww_is_neg_o3sw_effluent   <NA>
14: 03_tof_ww_is_neg_o3sw_effluent-r002 03_tof_ww_is_neg_o3sw_effluent   <NA>
15: 03_tof_ww_is_neg_o3sw_effluent-r003 03_tof_ww_is_neg_o3sw_effluent   <NA>
16: 03_tof_ww_is_pos_o3sw_effluent-r001 03_tof_ww_is_pos_o3sw_effluent   <NA>
17: 03_tof_ww_is_pos_o3sw_effluent-r002 03_tof_ww_is_pos_o3sw_effluent   <NA>
18: 03_tof_ww_is_pos_o3sw_effluent-r003 03_tof_ww_is_pos_o3sw_effluent   <NA>
         type polarity spectra
       <char>   <char>   <num>
 1: MS/MS-DDA negative    1914
 2: MS/MS-DDA negative    1932
 3: MS/MS-DDA negative    1941
 4: MS/MS-DDA positive    2504
 5: MS/MS-DDA positive    2491
 6: MS/MS-DDA positive    2504
 7: MS/MS-DDA negative    1984
 8: MS/MS-DDA negative    1995
 9: MS/MS-DDA negative    1993
10: MS/MS-DDA positive    2131
11: MS/MS-DDA positive    2126
12: MS/MS-DDA positive    2124
13: MS/MS-DDA negative    1909
14: MS/MS-DDA negative    1921
15: MS/MS-DDA negative    1924
16: MS/MS-DDA positive    2046
17: MS/MS-DDA positive    2052
18: MS/MS-DDA positive    2048

Results empty 

ProjectHeaders

Project headers (e.g., name, author and description) can be added to the MassSpecEngine using the MassSpecEngine$add_headers(). The headers are converted to an S3 ProjectHeaders class object in the MassSpecEngine, where it goes through a validation to ensure conformity (more details here).

# Add headers to the MassSpecEngine
ms$add_headers(
  name = "Wastewater Ozonation Showcase",
  author = "Ricardo Cunha",
  description = "Demonstration project"
)

# Get the headers as ProjectHeaders
ms$get_headers()

  ProjectHeaders 
  file: NA
  date: 2024-08-01 10:04:40.137931
  name: Wastewater Ozonation Showcase
  author: Ricardo Cunha
  description: Demonstration project
# Get the MassSpecEngine date
ms$get_headers(value = "date")
$date
[1] "2024-08-01 10:04:40 CEST"

Replicates and blanks

The analysis replicate names and the associated blank replicate name can be amended in the MassSpecEngine, as shown below. Alternatively, a data.frame with column names file, replicate and blank could be added as the files argument in MassSpecEngine$new(files = files) to have directly the replicate and blank replicate names assigned (more details here).

# Character vector with analysis replicate names
rpls <- c(
  rep("blank_neg", 3),
  rep("blank_pos", 3),
  rep("influent_neg", 3),
  rep("influent_pos", 3),
  rep("effluent_neg", 3),
  rep("effluent_pos", 3)
)

# Character vector with associated blank replicate names
# Note that the order should match the respective replicate
blks <- c(
  rep("blank_neg", 3),
  rep("blank_pos", 3),
  rep("blank_neg", 3),
  rep("blank_pos", 3),
  rep("blank_neg", 3),
  rep("blank_pos", 3)
)

# Chaining add replicates and blanks
ms$add_replicate_names(rpls)$add_blank_names(blks)

# Replicates and blanks were amended
ms$get_overview()[, 1:5]
                               analysis    replicate     blank      type
                                 <char>       <char>    <char>    <char>
 1:         01_tof_ww_is_neg_blank-r001    blank_neg blank_neg MS/MS-DDA
 2:         01_tof_ww_is_neg_blank-r002    blank_neg blank_neg MS/MS-DDA
 3:         01_tof_ww_is_neg_blank-r003    blank_neg blank_neg MS/MS-DDA
 4:         01_tof_ww_is_pos_blank-r001    blank_pos blank_pos MS/MS-DDA
 5:         01_tof_ww_is_pos_blank-r002    blank_pos blank_pos MS/MS-DDA
 6:         01_tof_ww_is_pos_blank-r003    blank_pos blank_pos MS/MS-DDA
 7:      02_tof_ww_is_neg_influent-r001 influent_neg blank_neg MS/MS-DDA
 8:      02_tof_ww_is_neg_influent-r002 influent_neg blank_neg MS/MS-DDA
 9:      02_tof_ww_is_neg_influent-r003 influent_neg blank_neg MS/MS-DDA
10:      02_tof_ww_is_pos_influent-r001 influent_pos blank_pos MS/MS-DDA
11:      02_tof_ww_is_pos_influent-r002 influent_pos blank_pos MS/MS-DDA
12:      02_tof_ww_is_pos_influent-r003 influent_pos blank_pos MS/MS-DDA
13: 03_tof_ww_is_neg_o3sw_effluent-r001 effluent_neg blank_neg MS/MS-DDA
14: 03_tof_ww_is_neg_o3sw_effluent-r002 effluent_neg blank_neg MS/MS-DDA
15: 03_tof_ww_is_neg_o3sw_effluent-r003 effluent_neg blank_neg MS/MS-DDA
16: 03_tof_ww_is_pos_o3sw_effluent-r001 effluent_pos blank_pos MS/MS-DDA
17: 03_tof_ww_is_pos_o3sw_effluent-r002 effluent_pos blank_pos MS/MS-DDA
18: 03_tof_ww_is_pos_o3sw_effluent-r003 effluent_pos blank_pos MS/MS-DDA
    polarity
      <char>
 1: negative
 2: negative
 3: negative
 4: positive
 5: positive
 6: positive
 7: negative
 8: negative
 9: negative
10: positive
11: positive
12: positive
13: negative
14: negative
15: negative
16: positive
17: positive
18: positive

ProcessingSettings

Data processing is performed by modules according to ProcessingSettings. The S3 ProcessingSettings class objects are obtained via the respective Settings_[module name]_[algorithm name] constructor functions, attributing the respective subclass. Below we obtain the ProcessingSettings for the module find_features() using the algorithm openms. The parameters for each processing module can be changed via the constructor arguments. Documentation for each ProcessingSettings subclass can be found in the StreamFind reference documentation.

# Get ProcessingSettings for finding features using the openms algorithm
ffs <- MassSpecSettings_FindFeatures_openms()

# Print in console the details of the ProcessingSettings
ffs

 ProcessingSettings 
 engine       MassSpec
 call         FindFeatures
 algorithm    openms
 version      0.2.0
 software     openms
 developer    Oliver Kohlbacher
 contact      oliver.kohlbacher@uni-tuebingen.de
 link         https://openms.de/
 doi          https://doi.org/10.1038/nmeth.3959

 parameters: 
  -  noiseThrInt 1000 
  -  chromSNR 3 
  -  chromFWHM 7 
  -  mzPPM 15 
  -  reEstimateMTSD TRUE 
  -  traceTermCriterion sample_rate 
  -  traceTermOutliers 5 
  -  minSampleRate 1 
  -  minTraceLength 4 
  -  maxTraceLength 70 
  -  widthFiltering fixed 
  -  minFWHM 4 
  -  maxFWHM 35 
  -  traceSNRFiltering TRUE 
  -  localRTRange 0 
  -  localMZRange 0 
  -  isotopeFilteringModel none 
  -  MZScoring13C FALSE 
  -  useSmoothedInts FALSE 
  -  extraOpts 
  -  intSearchRTWindow 3 
  -  useFFMIntensities FALSE 
  -  verbose FALSE 
# List with other workflow module settings
other_settings <- list(
  MassSpecSettings_AnnotateFeatures_StreamFind(),

  MassSpecSettings_GroupFeatures_openms(),
  
  # Modifying the parameters with the constructor arguments
  # db_is is a data.table with the name, mass and expected retention time of spiked internal standards, as shown below
  MassSpecSettings_FindInternalStandards_StreamFind(
    database = db_is,
    ppm = 8,
    sec = 10
  ),
  
  MassSpecSettings_FilterFeatures_StreamFind(excludeIsotopes = TRUE),
  
  MassSpecSettings_FilterFeatures_patRoon(
    absMinIntensity = 5000,
    maxReplicateIntRSD = 30,
    blankThreshold = 10,
    absMinReplicateAbundance = 3
  ),

  MassSpecSettings_LoadFeaturesEIC_StreamFind(
    rtExpand = 60,
    mzExpand = 0.0005
  ),

  MassSpecSettings_LoadFeaturesMS1_StreamFind(),

  MassSpecSettings_LoadFeaturesMS2_StreamFind(),

  MassSpecSettings_CalculateQuality_StreamFind(),
  
  MassSpecSettings_FilterFeatures_StreamFind(minSnRatio = 5),
  
  # db_with_ms2 is a database with suspect chemical standards
  # includes MS2 data (i.e., fragmentation pattern) from standards
  MassSpecSettings_SuspectScreening_StreamFind(
    database = db_with_ms2,
    ppm = 10,
    sec = 15,
    ppmMS2 = 10,
    minFragments = 3
  )
)

# Printing the third ProcessingSettings object from the list
other_settings[[3]]

 ProcessingSettings 
 engine       MassSpec
 call         FindInternalStandards
 algorithm    StreamFind
 version      0.2.0
 software     StreamFind
 developer    Ricardo Cunha
 contact      cunha@iuta.de
 link         https://odea-project.github.io/StreamFind
 doi          NA

 parameters: 
  -  database  (only head rows) 

                  name           formula     mass    rt    tag
                <char>            <char>    <num> <int> <char>
1: Cyclophosphamide-D6 C7[2]H6H9Cl2N2O2P 266.0625  1007     IS
2:        Ibuprofen-D3     C13[2]H3H15O2 209.1495  1150     IS
3:      Diclophenac-D4  C14[2]H4H7Cl2NO2 299.0418  1253     IS
4:       Metoprolol-D7    C15[2]H7H18NO3 274.2274   915     IS
5:  Sulfamethoxazol-D4   C10[2]H4H7N3O3S 257.0772  1015     IS
6:      Isoproturon-D6    C12[2]H6H12N2O 212.1796  1149     IS

  -  ppm 8 
  -  sec 10 

Then, all created ProcessingSettings can be added to the MassSpecEngine. The order will matter when the workflow is applied!

# Add the settings as a list. The order matters!
ms$add_settings(settings = c(list(ffs), other_settings))

# Printing the data processing workflow
ms$print_workflow()

Workflow
 1: FindFeatures (openms)
 2: AnnotateFeatures (StreamFind)
 3: GroupFeatures (openms)
 4: FindInternalStandards (StreamFind)
 5: FilterFeatures (StreamFind)
 6: FilterFeatures (patRoon)
 7: LoadFeaturesEIC (StreamFind)
 8: LoadFeaturesMS1 (StreamFind)
 9: LoadFeaturesMS2 (StreamFind)
 10: CalculateQuality (StreamFind)
 11: FilterFeatures (StreamFind)
 12: SuspectScreening (StreamFind)

run_workflow()

The modules assigned by the added ProcessingSettings can be processed by run_workflow(), as demonstrated below. Note that with run_workflow(), the processing modules are applied with the same order as they were added.

# Run all ProcessingSettings added to the MassSpecEngine
ms$run_workflow()
Verifying if your data is centroided... Done!
Applying replicate abundance filter... Done! Filtered 2968 (30.68%) features and 1432 (49.88%) feature groups. Remaining: 6705 features in 1439 groups.
Applying blank filter... Done! Filtered 4634 (69.11%) features and 888 (61.71%) feature groups. Remaining: 2071 features in 551 groups.
Applying intensity filter... Done! Filtered 509 (24.58%) features and 107 (19.42%) feature groups. Remaining: 1562 features in 444 groups.
Applying replicate abundance filter... Done! Filtered 179 (11.46%) features and 93 (20.95%) feature groups. Remaining: 1383 features in 351 groups.

Results

The created features and feature groups can be inspected as data.table objects or plotted by dedicated modules in the MassSpecEngine.

data.table objects

The features and feature groups can be obtained as data.table with the MassSpecEngine$get_features() and MassSpecEngine$get_groups() methods. The methods also allow to look for specific features/feature groups using mass, mass-to-charge ratio, retention time and drift time targets, as show below for a small set of compound targets where mass and retention time expected value are known. Note that drift time is only applicable for MS data with ion mobility separation.

db
                         name       formula     mass    rt    tag
                       <char>        <char>    <num> <int> <char>
 1:     4N-Acetylsulfadiazine   C12H12N4O3S 292.0630   905      S
 2:                Metoprolol     C15H25NO3 267.1834   915      S
 3:          Sulfamethoxazole   C10H11N3O3S 253.0521  1015      S
 4:                Bisoprolol     C18H31NO4 325.2253   955      S
 5: 4N-Acetylsulfamethoxazole   C12H13N3O4S 295.0627  1011      S
 6:             Carbamazepine     C15H12N2O 236.0950  1079      S
 7:                 Terbutryn     C10H19N5S 241.1361  1126      S
 8:                  Losartan   C22H23ClN6O 422.1622  1095      S
 9:               Candesartan    C24H20N6O3 440.1597  1097      S
10:               Isoproturon     C12H18N2O 206.1419  1152      S
11:                    Diuron   C9H10Cl2N2O 232.0170  1160      S
12:                Bezafibrat   C19H20ClNO4 361.1081  1164      S
13:                 Valsartan    C24H29N5O3 435.2270  1177      S
14:              Tebuconazole   C16H22ClN3O 307.1451  1267      S
15:                Diclofenac  C14H11Cl2NO2 295.0167  1255      S
16:             Propiconazole C15H17Cl2N3O2 341.0698  1308      S
17:                Flufenacet C14H13F4N3O2S 363.0665  1296      S
18:                 Ibuprofen      C13H18O2 206.1307  1152      S
19:                      CBZD    C15H14N2O3 270.1004   936      S
# Compounds are searched by monoisotopic mass and retention time
# ppm and sec set the mass (im ppm) and time (in seconds) allowed deviation, respectively
# average applies a mean to the intensities in each analysis replicate group
ms$get_groups(mass = db, ppm = 5, sec = 10, average = TRUE)
             group             name effluent_neg effluent_pos influent_neg
            <char>           <char>        <num>        <num>        <num>
1:  M236_R1079_324    Carbamazepine        0.000         0.00        0.000
2:  M253_R1015_555 Sulfamethoxazole        0.000         0.00        0.000
3:   M267_R916_735       Metoprolol        0.000     15409.08        0.000
4: M295_R1256_1274       Diclofenac        0.000         0.00     7786.458
5:  M325_R957_1778       Bisoprolol        0.000     13762.82        0.000
6: M440_R1097_3164      Candesartan     6750.804     22512.84    34920.953
   influent_pos
          <num>
1:    66019.721
2:     9679.874
3:    49655.948
4:    19602.254
5:    48375.419
6:   112540.651

Already by inspection of the data.table, it is possible to see compounds detected in the influent but not in the effluent (e.g., Carbamazepine) or compounds that are appear to be reduced during ozonation (e.g., Metoprolol). Since positive and negative ionization mode were combined, there are compounds that appear in both polarities and are grouped by neutral monoisotopic mass (e.g., Diclofenac).

plot_groups methods

For a better overview of the results, the method MassSpecEngine$plot_groups() or even more detailed the method MassSpecEngine$plot_groups_overview() can be used.

# set legendNames to TRUE for using the names in db as legend
ms$plot_groups(mass = db, ppm = 5, sec = 10, legendNames = TRUE)
ms$plot_groups_overview(mass = db, ppm = 5, sec = 10, legendNames = TRUE)

Filtered not removed

The FilterFeatures module was applied to filter features out according to defined conditions/thresholds. The filtered features were not removed but just tagged as filtered and a filter tag was assigned. For instance, when the method MassSpecEngine$get_features() is run with filtered argument set to TRUE, the filtered features are also shown. Below, we search for the internal standards added to each analysis that were filtered when applying the blank subtraction, receiving the tag blank in the filter column and TRUE in the filtered column.

db_is
                  name           formula     mass    rt    tag
                <char>            <char>    <num> <int> <char>
1: Cyclophosphamide-D6 C7[2]H6H9Cl2N2O2P 266.0625  1007     IS
2:        Ibuprofen-D3     C13[2]H3H15O2 209.1495  1150     IS
3:      Diclophenac-D4  C14[2]H4H7Cl2NO2 299.0418  1253     IS
4:       Metoprolol-D7    C15[2]H7H18NO3 274.2274   915     IS
5:  Sulfamethoxazol-D4   C10[2]H4H7N3O3S 257.0772  1015     IS
6:      Isoproturon-D6    C12[2]H6H12N2O 212.1796  1149     IS
7:           Diuron-D6   C9[2]H6H4Cl2N2O 238.0547  1157     IS
8:    Carbamazepin-D10    C15[2]H10H2N2O 246.1577  1075     IS
9:         Naproxen-D3     C14[2]H3H11O3 233.1131  1169     IS
# set filtered to TRUE for showing filtered features/feature groups
ms$get_groups(mass = db_is, ppm = 8, sec = 10, average = TRUE, filtered = TRUE)
             group                name blank_neg  blank_pos effluent_neg
            <char>              <char>     <num>      <num>        <num>
1:  M212_R1149_108      Isoproturon-D6      0.00 1198378.67        0.000
2:  M238_R1157_345           Diuron-D6  14884.04  120342.36    15530.309
3:  M246_R1075_442    Carbamazepin-D10      0.00  456753.78        0.000
4:  M257_R1014_594  Sulfamethoxazol-D4  10741.03  193813.88     7969.246
5:  M266_R1007_716 Cyclophosphamide-D6      0.00   51652.42        0.000
6:   M274_R915_852       Metoprolol-D7      0.00 1581149.46        0.000
7: M299_R1254_1361      Diclophenac-D4  24035.19   51904.34    19708.235
   effluent_pos influent_neg influent_pos
          <num>        <num>        <num>
1:   1322755.92        0.000   1269561.25
2:    139259.80    14521.777    130401.27
3:    510457.02        0.000    532430.03
4:    204772.06     7087.166    189112.69
5:     60848.79        0.000     56586.21
6:   1571304.96        0.000   1497131.38
7:     51395.04    18130.792     48452.52

Internal Stanards

The method FindInternalStandards was applied and the results can be obtained with the dedicated method MassSpecEngine$get_internal_standards() or plotted as a quality overview using the method MassSpecEngine$plot_internal_standards_qc(), as shown below. The plot gives an overview of the mass, retention time and intensity variance of the internal stadards across the analyses in the project.

ms$plot_internal_standards_qc()

Isotopes

The method AnnotateFeatures was applied to annotate the natural isotopes within the MS data. Implementation of adducts and in source fragments annotation is planned but not yet available with the StreamFind algorithm. The method MassSpecEngine$get_isotopes() can be used to search for isotopes, as shown below for the analysis number 11. Because the filter excludeIsotopes was applied, the isotopic features are filtered out with tag isotope or minIntensity when filtered by minIntensity, which was applied first. Although the first isotope of Diclofenac (i.e., the 13C) was not found, the second was annotated as the maxGaps argument in settings was set to 1. This is a frequent case for compounds with halogens.

# Isotopes of Diclofenac and Candesartan in analysis 5
ms$get_isotopes(
  analyses = 5,
  mass = db[db$name %in% c("Diclofenac", "Candesartan"), ],
  ppm = 5, sec = 10
)
                         analysis                feature iso_cluster
                           <char>                 <char>       <int>
1: 02_tof_ww_is_pos_influent-r002 f_14378903822300977773         384
2: 02_tof_ww_is_pos_influent-r002   f_597963579288397561         933
3: 02_tof_ww_is_pos_influent-r002  f_8778520158543999941         384
4: 02_tof_ww_is_pos_influent-r002  f_4551345311938997883         933
5: 02_tof_ww_is_pos_influent-r002    f_98688234871004542         933
   iso_cluster_size    iso_cluster_feature iso_elements iso_carbons iso_charge
              <int>                 <char>       <char>       <num>      <int>
1:                2 f_14378903822300977773                        0          1
2:                3   f_597963579288397561                       24          1
3:                2 f_14378903822300977773         37Cl           0          1
4:                3   f_597963579288397561          13C          24          1
5:                3   f_597963579288397561      13C 13C          24          1
   iso_tag iso_step iso_md_diff iso_md_hit iso_md_error iso_mass_deviation
    <char>    <int>       <num>      <num>        <num>              <num>
1:     M+0        0    0.000000   0.000000 0.000000e+00        0.001028816
2:     M+0        0    0.000000   0.000000 0.000000e+00        0.000898936
3:     M+2        2    1.996954   1.997050 9.628567e-05        0.002194066
4:     M+1        1    1.002572   1.003355 7.832827e-04        0.002757634
5:     M+2        2    2.005729   2.006710 9.801857e-04        0.002757634
   iso_relative_intensity       rt     mass       mz  intensity    rtmin
                    <num>    <num>    <num>    <num>      <num>    <num>
1:             1.00000000 1255.604 295.0173 296.0246  18776.840 1251.924
2:             1.00000000 1096.581 440.1609 441.1681 109887.297 1091.918
3:             0.75621288 1255.604 297.0142 298.0215  14199.288 1251.924
4:             0.25861065 1096.581 441.1634 442.1707  28418.025 1093.570
5:             0.04135803 1096.581 442.1666 443.1739   4544.722 1093.570
      rtmax    mzmin    mzmax        name
      <num>    <num>    <num>      <char>
1: 1264.436 296.0238 296.0256  Diclofenac
2: 1105.248 441.1674 441.1690 Candesartan
3: 1263.002 298.0208 298.0230  Diclofenac
4: 1105.248 442.1691 442.1712 Candesartan
5: 1104.001 443.1711 443.1762 Candesartan

The isotopes can also be visualized with the method MassSpecEngine$map_isotopes(), as shown below for the internal standards added to analysis 11. Note that again the filtered argument was set to TRUE to return also filtered features.

ms$map_isotopes(
  analyses = 5,
  mass = db_is,
  ppm = 8, sec = 10,
  filtered = TRUE,
  legendNames = TRUE
)

Suspects

The method MassSpecEngine$plot_suspects() is used to inspect the suspect screening results. A second plot is added to compare the experimental fragmentation pattern (top) with the fragmentation pattern of the respective reference standard (down) added within the database. The colorBy argument can be set to targets+replicates to legend the plot with combined keys of suspect target names and analysis replicate names.

ms$plot_suspects(colorBy = "targets+replicates")

More to come

Future integration:

  • Correcting matrix for better comparison between influent and effluent
  • Annotation of adducts and in-source fragments
  • Formula/compound assignment via patRoon
  • Screening of transformation products using the biotransformer tool via patRoon
  • Fold-change and other statistic analysis for inter-sample correlation