lgatto / MSnbase

Base Classes and Functions for Mass Spectrometry and Proteomics
http://lgatto.github.io/MSnbase/
123 stars 50 forks source link

Default values in calculateFragments #537

Closed plbaldoni closed 3 years ago

plbaldoni commented 3 years ago

Hi there,

What are the default values for tolerance and relative in calculateFragments?

My understanding from the man docs is that tolerance = 25e-6 and relative = TRUE. But it does not seem to be the case.

Thanks, Pedro

> calculateFragments(sequence = peptide_dt$peptide,
+                    object = mgf,
+                    z = peptide_dt$charge)
       mz intensity ion type pos z      seq    error
1 431.149       118  b8    b   8 2 VVTDTDET 0.046481
> 
> calculateFragments(sequence = peptide_dt$peptide,
+                    object = mgf,
+                    tolerance = 25e-6, # shouldn't it be the default?
+                    relative = TRUE, # shouldn't it be the default?
+                    z = peptide_dt$charge)
[1] mz        intensity ion       type      pos       z         seq      
[8] error    
<0 rows> (or 0-length row.names)
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /stornext/System/data/apps/R/R-4.0.3/lib64/R/lib/libRblas.so
LAPACK: /stornext/System/data/apps/R/R-4.0.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [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_2.0.1      MSnbase_2.16.0      ProtGenerics_1.23.1
 [4] S4Vectors_0.28.1    mzR_2.24.1          Rcpp_1.0.6         
 [7] Biobase_2.50.0      BiocGenerics_0.36.0 viridis_0.5.1      
[10] viridisLite_0.3.0   data.table_1.13.6   ggplot2_3.3.3      
[13] opentimsr_1.0.2     devtools_2.3.2      usethis_2.0.0      

loaded via a namespace (and not attached):
 [1] vsn_3.58.0            pkgload_1.1.0         bit64_4.0.5          
 [4] foreach_1.5.1         assertthat_0.2.1      BiocManager_1.30.10  
 [7] affy_1.68.0           blob_1.2.1            remotes_2.2.0        
[10] impute_1.64.0         sessioninfo_1.1.1     RSQLite_2.2.2        
[13] pillar_1.4.7          lattice_0.20-41       glue_1.4.2           
[16] limma_3.46.0          digest_0.6.27         colorspace_2.0-0     
[19] preprocessCore_1.52.1 plyr_1.8.6            MALDIquant_1.19.3    
[22] XML_3.99-0.5          pkgconfig_2.0.3       zlibbioc_1.36.0      
[25] purrr_0.3.4           scales_1.1.1          processx_3.4.5       
[28] affyio_1.60.0         BiocParallel_1.24.1   tibble_3.0.5         
[31] generics_0.1.0        IRanges_2.24.1        ellipsis_0.3.1       
[34] withr_2.3.0           cli_2.2.0             crayon_1.3.4         
[37] memoise_1.1.0         ps_1.5.0              fs_1.5.0             
[40] ncdf4_1.17            fansi_0.4.2           doParallel_1.0.16    
[43] MASS_7.3-53           pkgbuild_1.2.0        tools_4.0.3          
[46] prettyunits_1.1.1     lifecycle_0.2.0       munsell_0.5.0        
[49] callr_3.5.1           pcaMethods_1.82.0     compiler_4.0.3       
[52] mzID_1.28.0           rlang_0.4.10          grid_4.0.3           
[55] iterators_1.0.13      rstudioapi_0.13       testthat_3.0.1       
[58] gtable_0.3.0          codetools_0.2-16      DBI_1.1.1            
[61] R6_2.5.0              gridExtra_2.3         dplyr_1.0.3          
[64] bit_4.0.4             rprojroot_2.0.2       desc_1.2.0           
[67] vctrs_0.3.6           tidyselect_1.1.0 
lgatto commented 3 years ago

Hi Pedro - thank you for the report.

It looks like the documentation is wrong. The code for calculateFragments,character,Spectrum2 calls calculateFragments_Spectrum2:

calculateFragments_Spectrum2 <- function(sequence, object, tolerance=0.1,
                                         method=c("highest", "closest", "all"),
                                         relative=FALSE, ...) 

which indicates that the defaults are 0.1 and FALSE.

I will check with @sgibb to see if there's anything I'm missing, otherwise this will need to be fixed.