#ensure you have mzR installed
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("mzR", version = "3.8")
# install the package directly from Github
library(devtools)
devtools::install_github("JosieLHayes/adductomicsR")
#install the data package containing the data
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("ExperimentHub", version = "3.9")
#or download the packages and install from source
library(devtools)
devtools::install("path_to_dir/adductomicsR")
devtools::install("path_to_dir/adductData")
After installation of the adductomics package and all dependencies attach the adductomics package by typing (copying and pasting) this line of code into the R console and hitting enter:
We have provided 2 mzXML files for use in this vignette in adductData.
Mass drift correction: Usually mass drift is corrected using lock
masses on the mass spectrometer. If this has not been done a python
script is provided in the directory in which the package is saved on
your computer at /inst/extdata/thermo_MassDriftCalc.py and can be
launched from within python using (replace the path to the python script
in your system):
exec(open(“thermo_MassDriftCalc.py“).read())
Each sample is corrected for retention time drift using the rtDevModeling function. To run this with the default parameters enter the path of the directory containing your mzXML files and the run order file (order in which samples were run). For further information on parameters see ??rtDevModelling. An example run order file is available in inst/extdata (within the directory where the package is saved on your computer) and 2 mzXML files are available in adductData/ExperimentHub.These files will be used in this vignette automatically.
Download the mzXML files from ExperimentHub for use in this vignette. They must have .mzXML to be recognized by the package so they are renamed as well.
eh = suppressMessages(suppressWarnings(ExperimentHub::ExperimentHub()))
temp = suppressMessages(suppressWarnings(
AnnotationHub::query(eh, 'adductData')))
## EH1957
## "/github/home/.cache/R/ExperimentHub/1aec608ddc83_1957"
## [1] TRUE
## see ?adductData and browseVignettes('adductData') for documentation
## downloading 1 resources
## retrieving 1 resource
## loading from cache
## EH1958
## "/github/home/.cache/R/ExperimentHub/1aec3f6720e7_1958"
## [1] TRUE
The specSimPepId function detects adducts present on the peptide. To run this with the default parameters (the largest triply charged peptide of human serum albumin) enter the path of your mzxml files and rtDevModels object. For further information on running this with different peptides see ??specSimPepId. This produces MS2 spectra plots, each in a separate directory for each sample. A plot of the model spectrum is also saved in the mzXML files directory for comparison. The spectra are grouped based on the mz and RT windows, and plots of these groups are also provided based on the raw RT and adjusted RT. These plots can be used to determine whether multiple groups pertain to the same peak.
A list of the adducts for quantification and their monoisotopic mass (MIM), retention time (RT), peptide and charge is generated using the following command. Substitute the file path of the allResults file to the location of your allResults file from the previous step.
generateTargTable(
allresultsFile=paste0(system.file("extdata",package =
"adductomicsR"),'/allResults_ALVLIAFAQYLQQCPFEDHVK_example.csv'),
csvDir=tempdir(check = FALSE)
)
It is recommended that the allGroups plot ( m/z vs RT) is used to ensure that the adducts in the target table do not pertain to the same peak, as the quantification step can be computationally intensive.
See ??adductQuant for an explanation on the parameters for this function. To use your target table produced in the previous step, alter the value in the ‘targTable’ option to the path of your target table. Similarly replaced the path to the directory of your own mzXML files in filePaths (set as “Users/Documents/mzXMLfiles” here.
adductQuant(
nCores=2,
targTable=paste0(system.file("extdata",
package="adductomicsR"),
'/exampletargTable2.csv'),
intStdRtDrift=30,
rtDevModels= paste0(hubCache(temp),'/rtDevModels.RData'),
filePaths=list.files(hubCache(temp),pattern=".mzXML",
all.files=FALSE,full.names=TRUE),
quantObject=NULL,
indivAdduct=NULL,
maxPpm=5,
minSimScore=0.8,
spikeScans=1,
minPeakHeight=100,
maxRtDrift=20,
maxRtWindow=240,
isoWindow=80,
hkPeptide='LVNEVTEFAK',
gaussAlpha=16
)
It is recommended that spectra for each of the adducts found are checked manually using LC-MS software, either at this step or before quantification.
To load your adductquantif object set the path to the file on your system. In the example it assumes the file is present in your working directory.
Mass spectrometry data is inherently noisy, and the filterAdductTable() function will filter out samples and adducts based on set thresholds. It is recommended to use this filter function to remove adducts that have many missing values and samples where the housekeeping peptide is weak, suggestive of misintegration. Substitute the name of the peaklist file with the path and the name of your peaklist file produced in the previous step.
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## 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
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] adductomicsR_1.23.0 ExperimentHub_2.13.1 AnnotationHub_3.13.3
## [4] BiocFileCache_2.13.2 dbplyr_2.5.0 BiocGenerics_0.51.3
## [7] adductData_1.21.0 rmarkdown_2.28
##
## loaded via a namespace (and not attached):
## [1] ade4_1.7-22 tidyselect_1.2.1 dplyr_1.1.4
## [4] blob_1.2.4 filelock_1.0.3 Biostrings_2.73.2
## [7] fastmap_1.2.0 digest_0.6.37 mime_0.12
## [10] lifecycle_1.0.4 cluster_2.1.6 KEGGREST_1.45.1
## [13] RSQLite_2.3.7 magrittr_2.0.3 kernlab_0.9-33
## [16] compiler_4.4.1 rlang_1.1.4 sass_0.4.9
## [19] tools_4.4.1 utf8_1.2.4 yaml_2.3.10
## [22] knitr_1.48 htmlwidgets_1.6.4 bit_4.5.0
## [25] mclust_6.1.1 curl_5.2.3 xml2_1.3.6
## [28] plyr_1.8.9 withr_3.0.2 purrr_1.0.2
## [31] sys_3.4.3 nnet_7.3-19 grid_4.4.1
## [34] stats4_4.4.1 fansi_1.0.6 pastecs_1.4.2
## [37] iterators_1.0.14 fpc_2.2-13 MASS_7.3-61
## [40] prabclus_2.3-4 cli_3.6.3 crayon_1.5.3
## [43] generics_0.1.3 robustbase_0.99-4-1 reshape2_1.4.4
## [46] httr_1.4.7 DBI_1.2.3 cachem_1.1.0
## [49] stringr_1.5.1 zlibbioc_1.51.2 modeltools_0.2-23
## [52] rvest_1.0.4 parallel_4.4.1 AnnotationDbi_1.67.0
## [55] BiocManager_1.30.25 XVector_0.45.0 vctrs_0.6.5
## [58] boot_1.3-31 jsonlite_1.8.9 IRanges_2.39.2
## [61] S4Vectors_0.43.2 bit64_4.5.2 maketools_1.3.1
## [64] foreach_1.5.2 diptest_0.77-1 jquerylib_0.1.4
## [67] glue_1.8.0 DEoptimR_1.1-3 codetools_0.2-20
## [70] DT_0.33 stringi_1.8.4 BiocVersion_3.20.0
## [73] GenomeInfoDb_1.41.2 UCSC.utils_1.1.0 tibble_3.2.1
## [76] pillar_1.9.0 rappdirs_0.3.3 htmltools_0.5.8.1
## [79] GenomeInfoDbData_1.2.13 R6_2.5.1 evaluate_1.0.1
## [82] Biobase_2.65.1 lattice_0.22-6 png_0.1-8
## [85] memoise_2.0.1 bslib_0.8.0 class_7.3-22
## [88] Rcpp_1.0.13 flexmix_2.3-19 xfun_0.48
## [91] buildtools_1.0.0 pkgconfig_2.0.3