Clustering Mass Spectra from Low Resolution LC-MS/MS Data Using CluMSID

Tobias Depke

October 27, 2020

Introduction

As described in the GC-EI-MS tutorial, CluMSID can also be used to analyse low resolution data – although using low resolution data comes at a cost.

In this example, we will use a similar sample (1uL Pseudomonas aeruginosa PA14 cell extract) as in the General Tutorial, measured with similar chromatography but on a different mass spectrometer, a Bruker amaZon ion trap instrument operated in ESI-(+) mode with auto-MS/MS. In addition to introducing a workflow for low resolution LC-MS/MS data, this example also demonstrates that CluMSID can work with data from different types of mass spectrometers.

Data import

We load the file from the CluMSIDdata package:

library(CluMSID)
library(CluMSIDdata)

lowresfile <- system.file("extdata", 
                        "PA14_amazon_lowres.mzXML",
                        package = "CluMSIDdata")

Data preprocessing

The extraction of spectra works the same way as with high resolution LC-MS/MS data:

ms2list <- extractMS2spectra(lowresfile)
length(ms2list)
#> [1] 1989

Like in the GC-EI-MS example, we have to adjust mz_tolerance to a much higher value compared to high resolution data, while the retention time tolerance can remain unchanged.

featlist <- mergeMS2spectra(ms2list, mz_tolerance = 0.02)
length(featlist)
#> [1] 525

We see that we have similar numbers of spectra as in the General Tutorial, because we tried to keep all parameters except for the mass spectrometer type comparable.

Generation of distance matrix

As we do not have low resolution spectral libraries at hand, we skip the integration of previous knowledge on feature identities in this example and generate a distance matrix right away:

distmat <- distanceMatrix(featlist)

Data exploration

Starting from this distance matrix, we can use all the data exploration functions that CluMSID offers.

When we now make an MDS plot, we learn that the similarity data is very different from the comparable high resolution data:

MDSplot(distmat)
Figure 1: Multidimensional scaling plot as a visualisation of MS2 spectra similarities of the low resolution LC-MS/MS example data set. Black dots signify spectra from unknown metabolites.

Figure 1: Multidimensional scaling plot as a visualisation of MS2 spectra similarities of the low resolution LC-MS/MS example data set. Black dots signify spectra from unknown metabolites.

To get a better overview of the data and the general similarity behaviour, we create a heat map of the distance matrix:

HCplot(distmat, type = "heatmap", 
                cexRow = 0.1, cexCol = 0.1,
                margins = c(6,6))
Figure 2: Symmetric heat map of the distance matrix displaying MS2 spectra similarities of the low resolution LC-MS/MS example data set. along with dendrograms resulting from hierarchical clustering based on the distance matrix. The colour encoding is shown in the top-left insert.

Figure 2: Symmetric heat map of the distance matrix displaying MS2 spectra similarities of the low resolution LC-MS/MS example data set. along with dendrograms resulting from hierarchical clustering based on the distance matrix. The colour encoding is shown in the top-left insert.

We clearly see that the heat map is generally a lot “warmer” than in the General Tutorial (an intuition that is supported by the histogram in the top-left corner), i.e. we have a higher general degree of similarity between spectra. That is not surprising as the m/z information has much fewer levels than in high resolution data and fragments of different sum formula are more likely to have indistinguishable mass-to-charge ratios.

We also see that some more or less compact clusters can be identified. This is easier to inspect in the dendrogram visualisation:

HCplot(distmat, h = 0.8, cex = 0.3)
Figure 3: Circularised dendrogram as a result of agglomerative hierarchical clustering with average linkage as agglomeration criterion based on MS2 spectra similarities of the low resolution LC-MS/MS example data set. Each leaf represents one feature and colours encode cluster affiliation of the features. Leaf labels display feature IDs. Distance from the central point is indicative of the height of the dendrogram.

Figure 3: Circularised dendrogram as a result of agglomerative hierarchical clustering with average linkage as agglomeration criterion based on MS2 spectra similarities of the low resolution LC-MS/MS example data set. Each leaf represents one feature and colours encode cluster affiliation of the features. Leaf labels display feature IDs. Distance from the central point is indicative of the height of the dendrogram.

In conclusion, CluMSID is capable of processing low resolution LC-MS/MS data and if high resolution data is not available, it can be very useful to provide an overview of spectral similarities in low resolution data, thereby helping metabolite annotation if some individual metabolites can be identified by comparison to authentic standards. However, concerning feature annotation, high resolution methods should always be favoured for the many benefits they provide.

Session Info

sessionInfo()
#> R Under development (unstable) (2020-10-17 r79346)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.13-bioc/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats4    parallel  stats     graphics  grDevices utils     datasets 
#> [8] methods   base     
#> 
#> other attached packages:
#>  [1] magrittr_1.5        metaMSdata_1.25.0   metaMS_1.27.0      
#>  [4] CAMERA_1.47.0       xcms_3.13.0         MSnbase_2.17.0     
#>  [7] ProtGenerics_1.23.0 S4Vectors_0.29.0    mzR_2.25.0         
#> [10] Rcpp_1.0.5          BiocParallel_1.25.0 Biobase_2.51.0     
#> [13] BiocGenerics_0.37.0 CluMSIDdata_1.5.0   CluMSID_1.7.0      
#> 
#> loaded via a namespace (and not attached):
#>   [1] colorspace_1.4-1            ellipsis_0.3.1             
#>   [3] htmlTable_2.1.0             XVector_0.31.0             
#>   [5] GenomicRanges_1.43.0        base64enc_0.1-3            
#>   [7] rstudioapi_0.11             farver_2.0.3               
#>   [9] affyio_1.61.0               fansi_0.4.1                
#>  [11] codetools_0.2-16            splines_4.1.0              
#>  [13] ncdf4_1.17                  doParallel_1.0.16          
#>  [15] impute_1.65.0               robustbase_0.93-6          
#>  [17] knitr_1.30                  Formula_1.2-4              
#>  [19] jsonlite_1.7.1              cluster_2.1.0              
#>  [21] vsn_3.59.0                  png_0.1-7                  
#>  [23] graph_1.69.0                readr_1.4.0                
#>  [25] BiocManager_1.30.10         compiler_4.1.0             
#>  [27] httr_1.4.2                  backports_1.1.10           
#>  [29] assertthat_0.2.1            Matrix_1.2-18              
#>  [31] lazyeval_0.2.2              cli_2.1.0                  
#>  [33] limma_3.47.0                htmltools_0.5.0            
#>  [35] tools_4.1.0                 igraph_1.2.6               
#>  [37] coda_0.19-4                 gtable_0.3.0               
#>  [39] glue_1.4.2                  GenomeInfoDbData_1.2.4     
#>  [41] affy_1.69.0                 RANN_2.6.1                 
#>  [43] dplyr_1.0.2                 MALDIquant_1.19.3          
#>  [45] rle_0.9.2                   statnet.common_4.4.1       
#>  [47] vctrs_0.3.4                 ape_5.4-1                  
#>  [49] preprocessCore_1.53.0       nlme_3.1-150               
#>  [51] iterators_1.0.13            xfun_0.18                  
#>  [53] stringr_1.4.0               ps_1.4.0                   
#>  [55] network_1.16.1              lifecycle_0.2.0            
#>  [57] gtools_3.8.2                XML_3.99-0.5               
#>  [59] DEoptimR_1.0-8              zlibbioc_1.37.0            
#>  [61] MASS_7.3-53                 scales_1.1.1               
#>  [63] hms_0.5.3                   pcaMethods_1.83.0          
#>  [65] MatrixGenerics_1.3.0        SummarizedExperiment_1.21.0
#>  [67] RBGL_1.67.0                 MassSpecWavelet_1.57.0     
#>  [69] RColorBrewer_1.1-2          yaml_2.2.1                 
#>  [71] gridExtra_2.3               ggplot2_3.3.2              
#>  [73] rpart_4.1-15                reshape_0.8.8              
#>  [75] latticeExtra_0.6-29         stringi_1.5.3              
#>  [77] highr_0.8                   foreach_1.5.1              
#>  [79] checkmate_2.0.0             caTools_1.18.0             
#>  [81] GenomeInfoDb_1.27.0         rlang_0.4.8                
#>  [83] pkgconfig_2.0.3             matrixStats_0.57.0         
#>  [85] bitops_1.0-6                mzID_1.29.0                
#>  [87] evaluate_0.14               lattice_0.20-41            
#>  [89] purrr_0.3.4                 labeling_0.4.2             
#>  [91] htmlwidgets_1.5.2           tidyselect_1.1.0           
#>  [93] GGally_2.0.0                plyr_1.8.6                 
#>  [95] R6_2.4.1                    IRanges_2.25.0             
#>  [97] gplots_3.1.0                generics_0.0.2             
#>  [99] Hmisc_4.4-1                 sna_2.6                    
#> [101] DelayedArray_0.17.0         foreign_0.8-80             
#> [103] pillar_1.4.6                MsCoreUtils_1.3.0          
#> [105] nnet_7.3-14                 survival_3.2-7             
#> [107] RCurl_1.98-1.2              tibble_3.0.4               
#> [109] crayon_1.3.4                KernSmooth_2.23-17         
#> [111] plotly_4.9.2.1              rmarkdown_2.5              
#> [113] jpeg_0.1-8.1                grid_4.1.0                 
#> [115] data.table_1.13.2           digest_0.6.27              
#> [117] tidyr_1.1.2                 dbscan_1.1-5               
#> [119] munsell_0.5.0               viridisLite_0.3.0