xcms
xcms copied to clipboard
error when extracting MS2 spectra associated with features
Hi,
When I use featureSpectra()
function to extract MS2 features, I encountered an error:
Error in match.arg(return.type) : 'arg' should be one of “MSpectra”, “list”
I used the xcms script and example data from GNPS
Could you please help what the problem could be?
Thanks a lot.
Dong
Hi, I can confirm the error occurring at https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing_bacterial_samples.Rmd#L137 inside:
> traceback()
3: stop(gettextf("'arg' should be one of %s", paste(dQuote(choices),
collapse = ", ")), domain = NA)
2: match.arg(return.type)
1: featureSpectra(processedData, return.type = "Spectra")
changing the line to filteredMs2Spectra <- featureSpectra(processedData, return.type = "MSpectra")
the script continues. @YonghuiDong please try that, check the results and report back.
Ideally, create a Pull Request for https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing_bacterial_samples.Rmd with this change plus a check for the XCMS Version.
I haven't checked yet when the change Spectra
-> MSpectra
was introduced.
Yours, Steffen
@sneumann,
Thanks a lot for your kind help. It works now.
I need to evaluate the results of the example provided from https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing_bacterial_samples.Rmd. The precursor ions for MS2 data don't look correct.
Dong
@sneumann,
Thanks a lot for your kind help. It works now.
I need to evaluate the results of the example provided from https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing_bacterial_samples.Rmd. The precursor ions for MS2 data don't look correct.
Dong
Hi, how did you make it work in the end, I also had the same problem and I have not made it work
Best Tingting
I would suggest to adapt the https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing.Rmd file for your analyses. That is the most recent and complete file. The other two example Rmds seem to be outdated.
I would suggest to adapt the https://github.com/DorresteinLaboratory/XCMS3_FeatureBasedMN/blob/master/XCMS3_Preprocessing.Rmd file for your analyses. That is the most recent and complete file. The other two example Rmds seem to be outdated.
Hi Johnnes, I would like to use the codes here you created (https://bioconductor.org/packages/devel/bioc/vignettes/xcms/inst/doc/xcms-lcms-ms.html) to do MS/MS peak annotation for my DDA data, and I have the same problem as Dong had ('arg' should be one of “MSpectra”, “list”), but I am not going to use for GNPS. Even I changed "Spectra" to "MSpectra", it did not work in the next step when I extract the peak_id, I saw the codes on the websites seem already updated but it just not work for me, do you have any suggestions about it? Thank you very much!
Best regards Tingting
@tiwa1125 , could you please paste here the output of your sessionInfo()
and ideally also the command you used to extract the spectra as well as the error message? Could be that there is some problem with the xcms
version (too old?) - and this would also help me to look into the code of the specific version of xcms
to see where the error happens.
Dear Johannes, Thank you very much for your reply. I used the exactly same script and sample you uploaded in Github, and have not used my own samples. If I use the original code with return type of ”Spectra”, it did not work as shown in the following screenshot
@.***
Then I changed it to “MSpectra” , it worked in this step, but not in the next, as the peak_id is empty
@.***
@.***
@.***
Session information is here, I use XCMS 3.12, it is not the newest version, but maybe also not too old, so what do you think the possible reason for my error?
R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252
attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages: [1] magrittr_2.0.1 pander_0.6.4 Spectra_1.0.5 xcms_3.12.0 MSnbase_2.16.1 [6] ProtGenerics_1.24.0 S4Vectors_0.28.1 mzR_2.24.1 Rcpp_1.0.7 BiocParallel_1.24.1 [11] Biobase_2.50.0 BiocGenerics_0.36.0 BiocStyle_2.18.1
loaded via a namespace (and not attached): [1] MatrixGenerics_1.2.1 vsn_3.58.0 foreach_1.5.1 [4] assertthat_0.2.1 BiocManager_1.30.16 affy_1.68.0 [7] GenomeInfoDbData_1.2.4 yaml_2.2.1 robustbase_0.93-8 [10] impute_1.64.0 pillar_1.6.1 lattice_0.20-41 [13] glue_1.4.2 limma_3.46.0 digest_0.6.25 [16] GenomicRanges_1.42.0 RColorBrewer_1.1-2 XVector_0.30.0 [19] randomForest_4.6-14 colorspace_2.0-2 reprtree_0.6 [22] htmltools_0.5.1.1 preprocessCore_1.52.1 Matrix_1.2-18 [25] plyr_1.8.6 MALDIquant_1.19.3 XML_3.99-0.6 [28] pkgconfig_2.0.3 zlibbioc_1.36.0 purrr_0.3.4 [31] scales_1.1.1 RANN_2.6.1 tree_1.0-40 [34] affyio_1.60.0 tibble_3.1.3 generics_0.1.0 [37] IRanges_2.24.1 ggplot2_3.3.5 ellipsis_0.3.2 [40] SummarizedExperiment_1.20.0 MassSpecWavelet_1.56.0 crayon_1.4.1 [43] evaluate_0.14 fs_1.5.0 ncdf4_1.17 [46] fansi_0.5.0 doParallel_1.0.16 MASS_7.3-53.1 [49] tools_4.0.2 lifecycle_1.0.0 matrixStats_0.59.0 [52] munsell_0.5.0 cluster_2.1.0 DelayedArray_0.16.3 [55] pcaMethods_1.82.0 compiler_4.0.2 GenomeInfoDb_1.26.7 [58] mzID_1.28.0 rlang_0.4.10 grid_4.0.2 [61] RCurl_1.98-1.3 iterators_1.0.13 MsCoreUtils_1.4.0 [64] bitops_1.0-7 rmarkdown_2.9 gtable_0.3.0 [67] codetools_0.2-18 DBI_1.1.1 R6_2.5.0 [70] knitr_1.33 dplyr_1.0.7 utf8_1.2.2 [73] clue_0.3-59 vctrs_0.3.8 DEoptimR_1.0-9 [76] tidyselect_1.1.1 xfun_0.21
Best regards
Tingting Wang Post doc Department of Forensic Medicine Palle Juul-Jensens Boulevard 99 DK 8200 Aarhus N
Monile phone: +45-81927765 E-mail: @.@.>
[afsender_logo]
From: Johannes Rainer @.> Sent: Friday, August 20, 2021 10:11 AM To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
@tiwa1125https://github.com/tiwa1125 , could you please paste here the output of your sessionInfo() and ideally also the command you used to extract the spectra as well as the error message? Could be that there is some problem with the xcms version (too old?) - and this would also help me to look into the code of the specific version of xcms to see where the error happens.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-902517303, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBX5HEUXX7JT4IFKXPZTT5YE2ZANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Dear Tingting, great that you did this on publicly available data! This gives me the chance to replicate locally to exactly understand what is going on (wrongly). Unfortunately, the screenshots don't show up here - would it be possible for you to just copy and paste the R commands?
Dear Johannes, Okay, the codes I used are here library(BiocStyle) library(xcms) library(Spectra) library(pander) register(SerialParam()) library(xcms)
dda_file <- system.file("TripleTOF-SWATH", "PestMix1_DDA.mzML", package = "msdata") dda_data <- readMSData(dda_file, mode = "onDisk") dda_data <- filterRt(dda_data, rt = c(200, 600)) table(msLevel(dda_data))
1 2
1504 2238 library(magrittr)
dda_data %>% filterMsLevel(2L) %>% precursorMz() %>% head()
F1.S1570 F1.S1588 F1.S1592 F1.S1594 F1.S1595 F1.S1596
130.96578 388.25426 89.93779 83.99569 371.22409 388.25226 dda_data %>% filterMsLevel(2L) %>% precursorIntensity() %>% head()
F1.S1570 F1.S1588 F1.S1592 F1.S1594 F1.S1595 F1.S1596
0 0 0 0 0 0
prec_int <- estimatePrecursorIntensity(dda_data) fData(dda_data)$precursorIntensity <- prec_int
dda_data %>% filterMsLevel(2L) %>% precursorIntensity() %>% head()
F1.S1570 F1.S1588 F1.S1592 F1.S1594 F1.S1595 F1.S1596
0.9691072 3.0772917 0.3885723 0.3215049 1.6329483 4.4057989
cwp <- CentWaveParam(snthresh = 5, noise = 100, ppm = 10,
peakwidth = c(3, 30))
dda_data <- findChromPeaks(dda_data, param = cwp)
library(Spectra)
dda_spectra <- chromPeakSpectra(
dda_data, method = c("all"), msLevel = 2L, skipFilled = FALSE, return.type = c("Spectra")) ## if I use “Spectra”
###Error in match.arg(return.type) : 'arg' should be one of “MSpectra”, “list”
dda_data, method = c("all"), msLevel = 2L, skipFilled = FALSE, return.type = c("MSpectra")) ## then I changed to MSpectra, it can continue again
dda_spectra
dda_spectra <- chromPeakSpectra(dda_data)
##MSpectra with 150 spectra and 1 metadata column(s):
msLevel rtime peaksCount | peak_id
mz mzmin mzmax rt rtmin rtmax into intb maxo sn sample
CP057 304.1133 304.1126 304.1143 425.024 417.985 441.773 13040.8 12884.14 3978.987 79 1
ex_id <- rownames(chromPeaks(dda_data, mz = ex_mz, ppm = 20))
ex_spectra <- dda_spectra[dda_spectra$peak_id == ex_id]
dda_spectra
ex_spectra
#MSpectra with 150 spectra and 1 metadata column(s):
msLevel rtime peaksCount | peak_id
Best Tingting
From: Johannes Rainer @.> Sent: Friday, August 20, 2021 1:42 PM To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
Dear Tingting, great that you did this on publicly available data! This gives me the chance to replicate locally to exactly understand what is going on (wrongly). Unfortunately, the screenshots don't show up here - would it be possible for you to just copy and paste the R commands?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-902632920, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBX4ZNZ5FVPOGXSDFPR3T5Y5O7ANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Indeed, the version of xcms
that you are using is too old. Version 3.12.0
does not yet support to return MS2 data as a Spectra
. You have 2 options:
-
Install R version 4.1 and install
xcms
and other potentially needed packages withinstall.packages("BiocManager")
and thenBiocManager::install("xcms")
(repeat for other potentially missing/required packages). -
Use the R and
xcms
that you have and usereturn.type = "MSpectra"
as you did. You need then however to follow the examples of the LC-MS/MS vignette of thexcms
package that you have installed. You should be able to find/open that vignette by typingbrowseVignettes(package = "xcms")
in your R.
In the version of the xcms
package you have I was using the functionality from the MSnbase
package for the processing (combining etc) of the MS2 data. In the newer xcms
package version I'm using the new (and better) functionality from the Spectra
package instead.
Hi again, Thank you for your answer, I reinstalled R and the corresponding package, and now I came to another issue. library(BiocStyle) library(xcms) library(Spectra) library(pander) library(xcms)
dda_file <- system.file("TripleTOF-SWATH", "PestMix1_DDA.mzML", package = "msdata") dda_data <- readMSData(dda_file, mode = "onDisk") ##Error in FUN(X[[i]], ...) : inherits(x, "mzR") er ikke TRUE sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale: [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 [4] LC_NUMERIC=C LC_TIME=Danish_Denmark.1252
attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages: [1] pander_0.6.4 Spectra_1.2.0 xcms_3.14.1 MSnbase_2.18.0 ProtGenerics_1.24.0 [6] S4Vectors_0.30.0 mzR_2.26.1 Rcpp_1.0.7 Biobase_2.52.0 BiocGenerics_0.38.0 [11] BiocParallel_1.26.2 BiocStyle_2.20.2
loaded via a namespace (and not attached): [1] MatrixGenerics_1.4.2 vsn_3.60.0 foreach_1.5.1 [4] BiocManager_1.30.16 affy_1.70.0 GenomeInfoDbData_1.2.6 [7] yaml_2.2.1 robustbase_0.93-8 impute_1.66.0 [10] pillar_1.6.2 lattice_0.20-44 glue_1.4.2 [13] limma_3.48.3 digest_0.6.27 GenomicRanges_1.44.0 [16] RColorBrewer_1.1-2 XVector_0.32.0 colorspace_2.0-2 [19] htmltools_0.5.2 preprocessCore_1.54.0 Matrix_1.3-4 [22] plyr_1.8.6 MALDIquant_1.20 XML_3.99-0.7 [25] pkgconfig_2.0.3 zlibbioc_1.38.0 scales_1.1.1 [28] RANN_2.6.1 affyio_1.62.0 tibble_3.1.4 [31] IRanges_2.26.0 ggplot2_3.3.5 ellipsis_0.3.2 [34] SummarizedExperiment_1.22.0 MassSpecWavelet_1.58.0 magrittr_2.0.1 [37] crayon_1.4.1 evaluate_0.14 fs_1.5.0 [40] ncdf4_1.17 fansi_0.5.0 doParallel_1.0.16 [43] MASS_7.3-54 tools_4.1.1 lifecycle_1.0.0 [46] matrixStats_0.60.1 munsell_0.5.0 cluster_2.1.2 [49] DelayedArray_0.18.0 pcaMethods_1.84.0 compiler_4.1.1 [52] GenomeInfoDb_1.28.1 mzID_1.30.0 rlang_0.4.11 [55] grid_4.1.1 RCurl_1.98-1.4 iterators_1.0.13 [58] MsCoreUtils_1.4.0 bitops_1.0-7 rmarkdown_2.10 [61] gtable_0.3.0 codetools_0.2-18 R6_2.5.1 [64] knitr_1.33 fastmap_1.1.0 utf8_1.2.2 [67] clue_0.3-59 vctrs_0.3.8 DEoptimR_1.0-9 [70] xfun_0.25
So what is wrong now? Best Tingtring
From: Johannes Rainer @.> Sent: 20. august 2021 16:04 To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
Indeed, the version of xcms that you are using is too old. Version 3.12.0 does not yet support to return MS2 data as a Spectra. You have 2 options:
-
Install R version 4.1 and install xcms and other potentially needed packages with install.packages("BiocManager") and then BiocManager::install("xcms") (repeat for other potentially missing/required packages).
-
Use the R and xcms that you have and use return.type = "MSpectra" as you did. You need then however to follow the examples of the LC-MS/MS vignette of the xcms package that you have installed. You should be able to find/open that vignette by typing browseVignettes(package = "xcms") in your R.
In the version of the xcms package you have I was using the functionality from the MSnbase package for the processing (combining etc) of the MS2 data. In the newer xcms package version I'm using the new (and better) functionality from the Spectra package instead.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-902715789, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBX7MH6PPQC5F6N5HJ63T5ZOFHANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
I guess that package msdata
is not intalled. You can check that with library("msdata")
, if that throws an error you should install it with BiocManager::install("msdata")
Hi Johannes Thank you so much, it worked! It is very nice to use for my specific metabolites annotation. I just noticed that I still need to select the most relevant matches from database to do the further spectra match, now I have another huge data set and a lot of metabolites I would like to annotate. Then maybe I need to move to this tutorial you created here (https://github.com/jorainer/SpectraTutorials). It seems like I could do database match with many other big database such as HMDB and Massbank, sounds much more powerful. Unfortunately I stucked in the first step. The codes show like this:
- Get the docker imagehttps://hub.docker.com/r/jorainer/spectra_tutorials of this tutorial with docker pull jorainer/spectra_tutorials:latest.
- Start docker using
· docker run
· -e PASSWORD=bioc
· -p 8787:8787
jorainer/spectra_tutorials:latest I think I did not fully understand what does it mean since I input this codes in to R, it reported some errors. So I would like to kindly ask how should carry out this step to startup?
Best Ting
From: Johannes Rainer @.> Sent: 26. august 2021 14:46 To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
I guess that package msdata is not intalled. You can check that with library("msdata"), if that throws an error you should install it with BiocManager::install("msdata")
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-906375845, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBXYN3K3PJXHAF64OG4DT6YZPJANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Hi Ting, sorry for the late reply.
in order to run the tutorial you would need to have docker installed. Then, in the Windows cmd prompt you would need to run the commands:
-
docker pull jorainer/spectra_tutorials:latest
- and then also the
docker run...
command that you entered in R.
This will start a docker container with R (and RStudio) running inside of it.
Note that this is just to show how it would work in general. To use this on your own data you would need to install all required packages and you would also need a MassBank installation. For the MassBank installation - that is actually for more advanced users, as you would need a MySQL server running on your system and you would need to install the MassBank database into that. In case you want to work with MassBank I could try to convert the database to a SQLite database file, which would not require a MySQL installation...
Dear Johannes, Thanks for your reply, I already installed docker as you said and get your docker image. Sure I would like to work with Massbank if it is possible, and that would be great if you can convert the database to a SQLite database file, as I have not used MySQL before☺. Again, thank your very much!
Best Tingting
From: Johannes Rainer @.> Sent: Wednesday, September 1, 2021 1:44 PM To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
Hi Ting, sorry for the late reply.
in order to run the tutorial you would need to have dockerhttps://hub.docker.com/editions/community/docker-ce-desktop-windows installed. Then, in the Windows cmd prompt you would need to run the commands:
- docker pull jorainer/spectra_tutorials:latest
- and then also the docker run... command that you entered in R.
This will start a docker container with R (and RStudio) running inside of it.
Note that this is just to show how it would work in general. To use this on your own data you would need to install all required packages and you would also need a MassBank installation. For the MassBank installation - that is actually for more advanced users, as you would need a MySQL server running on your system and you would need to install the MassBank database into that. In case you want to work with MassBank I could try to convert the database to a SQLite database file, which would not require a MySQL installation...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-910204662, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBX4VKRUYOWFLTWBRGOLT7YGZNANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hi again, I made it work somehow, both with Docker on R studio server and on my own data of my computer
I work with HMDB in most time, and I noticed that this package still annotates features one by one, as it wrote, #' Define the m/z ratio for an ion of cystine mz <- 241.0311 #' Subset the dataset to MS2 spectra matching the m/z sps <- filterPrecursorMz(sps_all, mz = mz + ppm(c(-mz, mz), 10)) sps So I would also like to ask is that possible to annotate a list of selected features (e.g., 100 features) I want to identify in this package? That would be very beneficial for our project. Thank you in advance!
Best Tingting
From: Johannes Rainer @.> Sent: Wednesday, September 1, 2021 1:44 PM To: sneumann/xcms @.> Cc: Tingting Wang @.>; Mention @.> Subject: Re: [sneumann/xcms] error when extracting MS2 spectra associated with features (#534)
Hi Ting, sorry for the late reply.
in order to run the tutorial you would need to have dockerhttps://hub.docker.com/editions/community/docker-ce-desktop-windows installed. Then, in the Windows cmd prompt you would need to run the commands:
- docker pull jorainer/spectra_tutorials:latest
- and then also the docker run... command that you entered in R.
This will start a docker container with R (and RStudio) running inside of it.
Note that this is just to show how it would work in general. To use this on your own data you would need to install all required packages and you would also need a MassBank installation. For the MassBank installation - that is actually for more advanced users, as you would need a MySQL server running on your system and you would need to install the MassBank database into that. In case you want to work with MassBank I could try to convert the database to a SQLite database file, which would not require a MySQL installation...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sneumann/xcms/issues/534#issuecomment-910204662, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVISBX4VKRUYOWFLTWBRGOLT7YGZNANCNFSM4VV32SZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I have two updates: firstly, I've now created also an SQLite version of the MassBank data for the use with the MsBackendMassbankSql
. You can download that database file from here, it's called MassbankSql-2021-03.db. With that it is no longer required to have a MySQL server running. You can simply load this data with:
library(RSQLite)
con <- dbConnect(SQLite(), "MassbankSql-2021-03.db")
mbank <- Spectra(con, source = MsBackendMassbankSql())
This is now also described in the tutorial.
Regarding your question for a possibility to match multiple input spectra against MassBank. One possibility is to write your own R code, but we have also been working on a more user friendly solution which is available in the new MetaboAnnotation
package. You can install that package with BiocManager::install("RforMassSpectrometry/MetaboAnnotation")
. The documentation is also available online here (click on Get Started to see example use cases). Would be great if you could use this package. We would be very grateful for any input, bug report of feature request at https://github.com/RforMassSpectrometry/MetaboAnnotation/
@jorainer Is this something we could provide with our MassBank data releases? I think, it is always better to provide data on the provider side and avoid "wild typing". Enough "wild typing" around for the last 1.5 years, anyway :-).
@tsufz , that would be great! The only problem is that the tables needed for MsBackendMassbankSql
are actually only VIEW
s in the MySQL database, not real tables. I've tried to convert the MySQL dump to a SQLite, but it somehow failed to convert the views properly. Thus, what I've done was simply extracting the data from the views and stuffing that into SQLite - but now, of course, the SQLite does not contain the full data of the MassBank MySQL.
I'll have a second look at the conversion process - maybe I succeed. It would be easier on the user to have actually the possibility to load/use the data as an SQLite database...
@jorainer, yes, that is pity with the "SQL DB". However, with NFDI4chem something may change, and thus we would not touch the format by now before we know a roadmap.
IMHO, no problem to integrate some R code to the build process of the artifacts. I will discuss with Rene, if he is happy with that. I have some experience with the GitLab-CI to build artifacts, should also work on GitHub with some adjustment.