sneumann / mzR

This is the git repository matching the Bioconductor package mzR: parser for netCDF, mzXML, mzData and mzML files (mass spectrometry data)
40 stars 26 forks source link

Rccp and Error in pwizModule #226

Open mjw77 opened 3 years ago

mjw77 commented 3 years ago

Hi, Wanting to use eRah package, going through tutorial and got two errors:

ex1 <- deconvolveComp(ex, ex.dec.par)

Deconvolving compounds from CONTROL/CON5.mzXML ... Processing 1 / 4 Error: Can not open file C:/Users/limpi/OneDrive/Documents/R/PCOS/CONTROL/CON5.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error In addition: Warning message: In fun(libname, pkgname) : mzR has been built against a different Rcpp version (1.0.4.6) than is installed on your system (1.0.5). This might lead to errors when loading mzR. If you encounter such issues, please send a report, including the output of sessionInfo() to the Bioc support forum at https://support.bioconductor.org/. For details see also https://github.com/sneumann/mzR/wiki/mzR-Rcpp-compiler-linker-issue.

I then tried to install latest mzR using BiocManager::install("mzR")

This removed the mzR warning message but I still get the following:

ex1 <- deconvolveComp(ex, ex.dec.par)

Deconvolving compounds from CONTROL/CON5.mzXML ... Processing 1 / 4 Error: Can not open file C:/Users/limpi/OneDrive/Documents/R/PCOS/CONTROL/CON5.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

Previous error message said to leave a comment so am doing so, any advice is greatly appreciated. sessionInfo() attached.

sessionInfo.txt

sneumann commented 3 years ago

Hi, yes, writing the issue is the correct one. The Warning for Rcpp is harmless in many cases, Rcpp was less stable in its early days, hence that warning. Can you please try deconvolveComp() with a different filename ? Start with a filename without path in your working directory. Can you also try with an mzML file insetad of mzXML ? The error message seems to be some unhappiness about the Path string, but it does not look weird, but I have no experience with Windows English_United Kingdom.1252 encoding. Yours, Steffen

lgatto commented 3 years ago

In addition, to test whether the issue is an mzR issue, you could try to create the file handle manually with

openMSfile("CON5.mzXML")

(adapt the flle name with the full path if its not in your working directory)

MonicaCalSan commented 2 years ago

I'm having the same error and I'm also working inside OneDrive, maybe this is the problem?

jorainer commented 2 years ago

I would suggest to copy the file to some local folder and try the same code again - you should then see if this is related to OneDrive.

peterjwatkins commented 1 year ago

I am also trying the eRah package, and the tutorial, with the same issue emerging.

I have directly tried 'pwizModule$open(filename)', which results in the same message as well.

_> ex <- deconvolveComp(ex, ex.dec.par )

Deconvolving compounds from CONTROL/CON_BASA_567795.mzXML ... Processing 1 / 4 Error: Can not open file C:/PCOS/CONTROL/CON_BASA_567795.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

mzR::openMSfile("C:/PCOS/CONTROL/CON_BASA_567795.mzXML") Error: Can not open file C:/PCOS/CONTROL/CON_BASA567795.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

Any advice/guidance would be appreciated.

Thanks in advance.

sneumann commented 1 year ago

Hi Peter, can you try the above suggestions and report back ? Try a local file in your working directory to rule out any path issues ? Try an mzML file ? Use openMSfile() from mzR on these files to see if that gives the same error ? Can we have your sessionInfo() to see if there is any weird encoding issues ? There us a post on something else https://forum.openmw.org/viewtopic.php?t=6772&sid=dc885704e43afd93ef27389d4337fdf7&start=10 that hints this could be an installation issue. Yours, Steffen

peterjwatkins commented 1 year ago

Hi Steffen, thanks for the reply and apologies for the delay.

For reprex, I downloaded some eg files for github - address in the comments below - introduced other error messages (see below) - session info follows.

As an FYI, this was done under RStudio, and I had noted the path/instal issues. I added R 4.2.2 to the global path, then installed mzR before eRah, just in case there was install issues, etc.

Hope this helps. Cheers, Peter

library(mzR)

mzMLs downloaded from https://github.com/HUPO-PSI/mzML/tree/master/examples

to local HD -> C:/mzML

fn <- c("C:/mzML/tiny.pwiz.mzML0.99.9.mzML") openMSfile(fn) Error: Can not open file C:/mzML/tiny.pwiz.mzML0.99.9.mzML! Original error was: Error in pwizModule$open(filename): [IO::HandlerParamContainer] Unknown element softwareParam

fn <- c("C:/mzML/tiny.msdata.mzML0.99.10.mzML") openMSfile(fn) Error: Can not open file C:/mzML/tiny.msdata.mzML0.99.10.mzML! Original error was: Error in pwizModule$open(filename): [MSDataFile::readFile()] Unsupported file format.

sessionInfo() R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8 LC_MONETARY=English_Australia.utf8 [4] LC_NUMERIC=C LC_TIME=English_Australia.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] mzR_2.32.0 Rcpp_1.0.9

loaded via a namespace (and not attached): [1] compiler_4.2.2 ProtGenerics_1.30.0 tools_4.2.2 Biobase_2.58.0 codetools_0.2-18 ncdf4_1.19
[7] BiocGenerics_0.44.0

caronteh commented 1 year ago

Hi Steffen. I am also trying Erah and checking all the comments in this post. Same issue with the test dataset MTBL321. It seems problem is not a path issue due to mzR works properly with other dataset files with the same path structure. It should be a config problem. I try the same dataset on Ubuntu OS with the same repository structure and it works nice. OpenMSfile can acces to mzXML information in this case, so i can assume that is not a format file problem. Suprisingly SessionInfo on both OS (Windows-Ubuntu) shows same version of packages mzR and pwiz. I can´t find where is locate the error exactly. I´ll appreciate some feedback to this post so i am working as erah-codeveloper and i´ll like to fix this kind of issues. Thanks!

sneumann commented 1 year ago

Hi Pedro, thanks for helping to get this solved. So MTBLS321 works on Linux, but fails on Windows. Erah seems to be using a plain mzR::openMSfile() and not weird arguments: https://github.com/cran/erah/blob/be0a44d57341919c3e9d2bb8a74d55a8b4e8374c/R/file.R#L29 -> Can you post a traceback() on the error ? -> To rule out Erah, can you confirm xmlO <- mzR::openMSfile("MTBLS312/filename.mzXML") works on your windows ? Yours, Steffen

caronteh commented 1 year ago

Error output running Erah with MTBLS321 on Windows Deconvolving compounds from CONTROL/CON_BASA_567795_50.mzXML ... Processing 1 / 2

Error: Can not open file CONTROL/CON_BASA_567795_50.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

> traceback() 12: stop(condition) 11: signalConditions(obj, exclude = getOption("future.relay.immediate", "immediateCondition"), resignal = resignal, ...) 10: signalConditionsASAP(obj, resignal = FALSE, pos = ii) 9: resolve.list(y, result = TRUE, stdout = stdout, signal = signal, force = TRUE) 8: resolve(y, result = TRUE, stdout = stdout, signal = signal, force = TRUE) 7: value.list(futures) 6: future::value(futures) 5: furrr_template(args = x, fn = fn, dots = dots, n = n, options = options, progress = progress, type = type, map_fn = map_fn, names = names, env_globals = env_globals, expr = expr, extract = furrr_map_extract) 4: furrr_map_template(x = .x, fn = .f, dots = list(...), options = .options, progress = .progress, type = "list", map_fn = purrr::map, env_globals = .env_globals) 3: future_map(samples.to.process, ~{ k <- which(samples.to.process == .x) message(paste("\n Deconvolving compounds from", as.character(Experiment@MetaData@Instrumental$filename[k]), "... Processing", k, "/", length(samples.to.process), "\n")) processSample(Experiment, .x, plotting, down.sample, virtualScansPerSecond) }, .options = furrr_options(seed = TRUE)) at erah.R#235 2: deconvolveComp(ex, ex.dec.par) at allGenerics.R#29 1: deconvolveComp(ex, ex.dec.par)

Running openMSfile locally out of Erah on Windows

setwd("D:/") xmlO <- mzR::openMSfile("D:/CON_BASA_574488.mzXML") Error: Can not open file D:/CON_BASA_574488.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

sessionInfo() Windows

sessionInfo() R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22621)

Matrix products: default locale: [1] LC_COLLATE=Spanish_Spain.utf8 LC_CTYPE=Spanish_Spain.utf8 LC_MONETARY=Spanish_Spain.utf8 [4] LC_NUMERIC=C LC_TIME=Spanish_Spain.utf8

attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] purrr_0.3.5 erah_2.0.0 SummarizedExperiment_1.28.0 [4] Biobase_2.58.0 GenomicRanges_1.50.1 GenomeInfoDb_1.34.3
[7] IRanges_2.32.0 S4Vectors_0.36.0 BiocGenerics_0.44.0
[10] MatrixGenerics_1.10.0 matrixStats_0.63.0 ggfortify_0.4.15
[13] ggplot2_3.4.0

loaded via a namespace (and not attached): [1] colorspace_2.0-3 ellipsis_0.3.2 rprojroot_2.0.3
[4] XVector_0.38.0 fs_1.5.2 clue_0.3-63
[7] rstudioapi_0.14 mzR_2.32.0 listenv_0.8.0
[10] furrr_0.3.1 MatrixModels_0.5-1 remotes_2.4.2
[13] MultiAssayExperiment_1.24.0 fansi_1.0.3 codetools_0.2-18
[16] splines_4.2.2 ncdf4_1.19 doParallel_1.0.17
[19] cachem_1.0.6 pkgload_1.3.2 cluster_2.1.4
[22] shiny_1.7.3 compiler_4.2.2 backports_1.4.1
[25] assertthat_0.2.1 Matrix_1.5-3 fastmap_1.1.0
[28] cli_3.4.1 later_1.3.0 htmltools_0.5.3
[31] quantreg_5.94 prettyunits_1.1.1 tools_4.2.2
[34] igraph_1.3.5 gtable_0.3.1 glue_1.6.2
[37] GenomeInfoDbData_1.2.9 dplyr_1.0.10 Rcpp_1.0.9
[40] vctrs_0.5.1 JADE_2.0-3 iterators_1.0.14
[43] stringr_1.4.1 globals_0.16.2 ps_1.7.2
[46] mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.3
[49] devtools_2.4.5 future_1.29.0 zlibbioc_1.44.0
[52] MASS_7.3-58.1 scales_1.2.1 ProtGenerics_1.30.0
[55] hms_1.1.2 promises_1.2.0.1 parallel_4.2.2
[58] SparseM_1.81 curl_4.3.3 memoise_2.0.1
[61] gridExtra_2.3 stringi_1.7.8 desc_1.4.2
[64] foreach_1.5.2 checkmate_2.1.0 HiClimR_2.2.1
[67] osd_0.1 pkgbuild_1.4.0 rlang_1.0.6
[70] pkgconfig_2.0.3 bitops_1.0-7 lattice_0.20-45
[73] htmlwidgets_1.5.4 processx_3.8.0 tidyselect_1.2.0
[76] parallelly_1.32.1 magrittr_2.0.3 R6_2.5.1
[79] generics_0.1.3 nnls_1.4 profvis_0.3.7
[82] DelayedArray_0.24.0 DBI_1.1.3 pillar_1.8.1
[85] withr_2.5.0 survival_3.4-0 RCurl_1.98-1.9
[88] tibble_3.1.8 crayon_1.5.2 utf8_1.2.2
[91] urlchecker_1.0.1 progress_1.2.2 usethis_2.1.6
[94] grid_4.2.2 callr_3.7.3 digest_0.6.30
[97] xtable_1.8-4 tidyr_1.2.1 httpuv_1.6.6
[100] signal_0.7-7 munsell_0.5.0 sessioninfo_1.2.2

sessionInfo() Ubuntu

sessionInfo() R version 4.2.2 Patched (2022-11-10 r83330) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.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.20.so

locale: [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 LC_MONETARY=es_ES.UTF-8
[6] LC_MESSAGES=es_ES.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] purrr_0.3.5 erah_2.0.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 pillar_1.8.1 compiler_4.2.2 ProtGenerics_1.30.0 prettyunits_1.1.1 tools_4.2.2 progress_1.2.2
[8] ncdf4_1.19 digest_0.6.30 tibble_3.1.8 lifecycle_1.0.3 clue_0.3-63 lattice_0.20-45 pkgconfig_2.0.3
[15] rlang_1.0.6 Matrix_1.5-1 igraph_1.3.5 cli_3.4.1 rstudioapi_0.14 parallel_4.2.2 SparseM_1.81
[22] furrr_0.3.1 HiClimR_2.2.1 cluster_2.1.4 MatrixModels_0.5-1 vctrs_0.5.1 globals_0.16.2 hms_1.1.2
[29] osd_0.1 grid_4.2.2 Biobase_2.58.0 glue_1.6.2 JADE_2.0-3 listenv_0.8.0 R6_2.5.1
[36] fansi_1.0.3 parallelly_1.32.1 survival_3.4-0 mzR_2.32.0 magrittr_2.0.3 BiocGenerics_0.44.0 splines_4.2.2
[43] MASS_7.3-58 codetools_0.2-18 ellipsis_0.3.2 nnls_1.4 future_1.29.0 quantreg_5.94 utf8_1.2.2
[50] signal_0.7-7 crayon_1.5.2

jjoseenrique commented 1 year ago

Hi all,

I've been trying to use the erah package, but I haven't managed to make it work yet. I get the same error that has been mentioned before:

> ex=deconvolveComp(ex,ex.dec.par)

Deconvolving compounds from CONTROL/CON_BASA_567795_50.mzXML ... Processing 1 / 4 
Error: Can not open file CONTROL/CON_BASA_567795_50.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

I've also run mzR::openMSfile("folder/filename.mzXML") as @sneumann said in in the previous comment, unsuccesfuly:

> mzR::openMSfile("CONTROL/CON_BASA_567795_50.mzXML")
Error: Can not open file CONTROL/CON_BASA_567795_50.mzXML! Original error was: Error in pwizModule$open(filename): boost::filesystem::path codecvt to wstring: error

Thanks!

sneumann commented 1 year ago

Hm, tricky. Can @jjoseenrique try 1) a known good mzXML 2) convert your mzXML to mzML and see if that works on windows ? I still have no clue about the underlying issue. Yours, Steffen

jjoseenrique commented 1 year ago

Hm, tricky. Can @jjoseenrique try 1) a known good mzXML 2) convert your mzXML to mzML and see if that works on windows ? I still have no clue about the underlying issue. Yours, Steffen

Hi Steffen, thanks for the reply. I've tried both two suggestions:

1) I've used the mzXML attached to the article Domingo-Almenara, X., Brezmes, J., Vinaixa, M., Samino, S., Ramirez, N., Ramon-Krauel, M., ... & Yanes, O. (2016). eRah: a computational tool integrating spectral deconvolution and alignment with quantification and identification of metabolites in GC/MS-based metabolomics. Analytical Chemistry, 88(19), 9821-9829. as a "positive control", but it didn't succeed.

2) I've converted those files to mzML, and run the following code: openMSfile("CONTROL/CON_BASA_567795_50.mzML"), and it seemed to work right, as I got the following lines:

Mass Spectrometry file handle.
Filename:  CON_BASA_567795_50.mzML 
Number of scans:  9542

However, when I run ex=deconvolveComp(ex,ex.dec.par) with those files, I get the same error that I got with the .mzXML files

Deconvolving compounds from CONTROL/CON_BASA_567795_50.mzML ... Processing 1 / 4 
Error in load.file(filename) : 
File extension not recognized. Avalible extensions are: .cdf, .mzXML and .xml

Thanks again!

Sincerely, José Enrique

jjoseenrique commented 1 year ago

Hm, tricky. Can @jjoseenrique try 1) a known good mzXML 2) convert your mzXML to mzML and see if that works on windows ? I still have no clue about the underlying issue. Yours, Steffen

Hello again, I've just discovered something about the issue! I've noticed that the codification of the mzXML files is different to UTF-8, UTF-16 or UTF-32. I've changed it to UTF-8, and now I can open them with openMSfile("CONTROL/CON_BASA_567795_50.mzML"). I'm doing some tests yet, but finally I've a breakthrough!

Sincerely, José Enrique

sneumann commented 1 year ago

1) EXCELLENT ! That means we might be able to put that in a simple test case.

2) About the File extension not recognized. Avalible extensions are: .cdf, .mzXML and .xml => That seems to be fixed in erah: https://github.com/xdomingoal/erah-devel/blob/4c71a5ef7050ae901c645ae5f15e5239e6ddd9f2/R/file.R#L10

Yours, Steffen

jjoseenrique commented 1 year ago
  1. EXCELLENT ! That means we might be able to put that in a simple test case.
  2. About the File extension not recognized. Avalible extensions are: .cdf, .mzXML and .xml => That seems to be fixed in erah: https://github.com/xdomingoal/erah-devel/blob/4c71a5ef7050ae901c645ae5f15e5239e6ddd9f2/R/file.R#L10

Yours, Steffen

I have tried opening .xml extension again, generating new files, and there is no way... I've checked how it is imported by erah, and as you told me, it might be solved... However, I get again and again the File extension not recognized. Avalible extensions are: .cdf, .mzXML and .xml message... I will keep on investigating to find the reason of the error.

Thanks again Steffen!

SIncerely, José Enrique

sneumann commented 1 year ago

The github version needs to be installed via install_github("xdomingoal/erah-devel"), not via BioC or CRAN.

jjoseenrique commented 1 year ago

The github version needs to be installed via install_github("xdomingoal/erah-devel"), not via BioC or CRAN.

Oh... what a fail. It worked! Thank you Steffen!

Sincerely,

José Enrique