1 Introduction

The MsCoreUtils package low-level functions for mass spectrometry data and is independent of any high-level data structures [@rainer_modular_2022]. These functions include mass spectra processing functions (noise estimation, smoothing, binning), quantitative aggregation functions (median polish, robust summarisation, …), missing data imputation, data normalisation (quantiles, vsn, …) as well as misc helper functions, that are used across high level data structure within the R for Mass Spectrometry packages.

For a full list of function, see

library("MsCoreUtils")
ls(pos = "package:MsCoreUtils")
##  [1] "%between%"                  "aggregate_by_matrix"       
##  [3] "aggregate_by_vector"        "asInteger"                 
##  [5] "between"                    "bin"                       
##  [7] "breaks_ppm"                 "closest"                   
##  [9] "coefMA"                     "coefSG"                    
## [11] "coefWMA"                    "colCounts"                 
## [13] "colMeansMat"                "colSumsMat"                
## [15] "common"                     "common_path"               
## [17] "entropy"                    "estimateBaseline"          
## [19] "estimateBaselineConvexHull" "estimateBaselineMedian"    
## [21] "estimateBaselineSnip"       "estimateBaselineTopHat"    
## [23] "force_sorted"               "formatRt"                  
## [25] "getImputeMargin"            "gnps"                      
## [27] "group"                      "i2index"                   
## [29] "imputeMethods"              "impute_MinDet"             
## [31] "impute_MinProb"             "impute_QRILC"              
## [33] "impute_RF"                  "impute_bpca"               
## [35] "impute_fun"                 "impute_knn"                
## [37] "impute_matrix"              "impute_min"                
## [39] "impute_mixed"               "impute_mle"                
## [41] "impute_neighbour_average"   "impute_with"               
## [43] "impute_zero"                "isPeaksMatrix"             
## [45] "join"                       "join_gnps"                 
## [47] "localMaxima"                "maxi"                      
## [49] "medianPolish"               "navdist"                   
## [51] "ndotproduct"                "nentropy"                  
## [53] "neuclidean"                 "noise"                     
## [55] "normalizeMethods"           "normalize_matrix"          
## [57] "nspectraangle"              "ppm"                       
## [59] "rbindFill"                  "refineCentroids"           
## [61] "rla"                        "robustSummary"             
## [63] "rowRla"                     "rt2character"              
## [65] "rt2numeric"                 "smooth"                    
## [67] "sumi"                       "validPeaksMatrix"          
## [69] "valleys"                    "vapply1c"                  
## [71] "vapply1d"                   "vapply1l"                  
## [73] "which.first"                "which.last"

or the reference page on the package webpage.

2 Examples

The functions defined in this package utilise basic classes with the aim of being reused in packages that provide a more formal, high-level interface.

As an examples, let’s take the robustSummary() function, that calculates the robust summary of the columns of a matrix:

x <- matrix(rnorm(30), nrow = 3)
colnames(x) <- letters[1:10]
rownames(x) <- LETTERS[1:3]
x
##             a            b           c         d          e         f
## A  1.24186495 -1.201883801 -1.49897101 0.4998923  1.4492743 0.3946454
## B -0.33877853  0.005139019 -0.02322501 0.2214646  0.4477827 1.1626158
## C  0.04003893 -0.315321953  0.52261794 0.8759629 -1.6615802 0.5494048
##            g          h          i          j
## A -1.5651521  0.6522520  0.3409826 0.08188111
## B  0.4171657 -0.0241502 -1.4686564 0.39106207
## C  1.1216186 -0.3147211 -1.2512753 1.30903346
robustSummary(x)
##          a          b          c          d          e          f          g 
##  0.3143751 -0.5040222 -0.2631884  0.5324399  0.4802629  0.7022220  0.2565030 
##          h          i          j 
##  0.1044602 -0.8636009  0.5939922

This function is typicall to be used to summarise peptide quantitation values into protein intensities1 See Sticker et al. Robust summarization and inference in proteome-wide label-free quantification. https://doi.org/10.1101/668863.. This functionality is available in

3 Contributions

If you would like to contribute any low-level functionality, please open a GitHub issue to discuss it. Please note that any contributions should follow the style guide and will require an appropriate unit test.

If you wish to reuse any functions in this package, please just go ahead. If you would like any advice or seek help, please either open a GitHub issue.

Session information

## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] MsCoreUtils_1.16.1 BiocStyle_2.32.1  
## 
## loaded via a namespace (and not attached):
##  [1] digest_0.6.36       R6_2.5.1            bookdown_0.40      
##  [4] fastmap_1.2.0       xfun_0.46           clue_0.3-65        
##  [7] cachem_1.1.0        knitr_1.48          BiocGenerics_0.50.0
## [10] htmltools_0.5.8.1   rmarkdown_2.27      stats4_4.4.1       
## [13] lifecycle_1.0.4     cli_3.6.3           sass_0.4.9         
## [16] jquerylib_0.1.4     compiler_4.4.1      tools_4.4.1        
## [19] cluster_2.1.6       evaluate_0.24.0     bslib_0.8.0        
## [22] yaml_2.3.10         BiocManager_1.30.23 S4Vectors_0.42.1   
## [25] jsonlite_1.8.8      rlang_1.1.4         MASS_7.3-61

References