xcmsRaw not reading data files in: invalid class “xcmsFileSource” object
1
0
Entering edit mode
garfield320 ▴ 30
@garfield320-18805
Last seen 21 months ago

I'm trying to read in a mzXML file to R using the xcms package and I keep on getting this error.

> mzxcms <- xcmsRaw("datafile.mzXML",profstep=0.01,profmethod="bin",profparam=list(),includeMSn=FALSE,mslevel=NULL, scanrange=NULL)
Error in validObject(.Object) : 
  invalid class “xcmsFileSource” object: superclass "characterORconnection" not defined in the environment of the object's class

I'm not sure if this has to do anything with the warnings I get when I load xcms (I'm getting warning messages that I haven't seen before, and I'm worried if some of the packages I've updated for different things are colliding). These are the warnings I get when I call xcms.

> library(xcms)
Warning messages:
1: package ‘BiocGenerics’ was built under R version 4.0.3 
2: package ‘Biobase’ was built under R version 4.0.3 
3: 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.
4: package ‘S4Vectors’ was built under R version 4.0.3 
5: multiple methods tables found for ‘which’

And below is my sessionInfo:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

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 
[8] methods   base     

other attached packages:
[1] xcms_3.10.2         MSnbase_2.14.2      ProtGenerics_1.20.0
[4] S4Vectors_0.28.0    mzR_2.22.0          Rcpp_1.0.5         
[7] BiocParallel_1.22.0 Biobase_2.50.0      BiocGenerics_0.36.0

loaded via a namespace (and not attached):
 [1] SummarizedExperiment_1.18.2 tidyselect_1.1.0           
 [3] purrr_0.3.4                 lattice_0.20-41            
 [5] colorspace_2.0-0            vctrs_0.3.4                
 [7] generics_0.1.0              vsn_3.56.0                 
 [9] XML_3.99-0.5                rlang_0.4.8                
[11] pillar_1.4.6                glue_1.4.2                 
[13] affy_1.66.0                 RColorBrewer_1.1-2         
[15] matrixStats_0.57.0          GenomeInfoDbData_1.2.3     
[17] affyio_1.58.0               foreach_1.5.1              
[19] lifecycle_0.2.0             plyr_1.8.6                 
[21] mzID_1.26.0                 robustbase_0.93-6          
[23] zlibbioc_1.36.0             munsell_0.5.0              
[25] pcaMethods_1.80.0           gtable_0.3.0               
[27] codetools_0.2-16            IRanges_2.24.0             
[29] doParallel_1.0.16           GenomeInfoDb_1.24.2        
[31] MassSpecWavelet_1.54.0      preprocessCore_1.50.0      
[33] DEoptimR_1.0-8              scales_1.1.1               
[35] BiocManager_1.30.10         DelayedArray_0.14.1        
[37] limma_3.44.3                XVector_0.30.0             
[39] RANN_2.6.1                  impute_1.62.0              
[41] ggplot2_3.3.2               digest_0.6.27              
[43] dplyr_1.0.2                 ncdf4_1.17                 
[45] GenomicRanges_1.40.0        grid_4.0.2                 
[47] tools_4.0.2                 bitops_1.0-6               
[49] magrittr_1.5                RCurl_1.98-1.2             
[51] tibble_3.0.4                crayon_1.3.4               
[53] pkgconfig_2.0.3             MASS_7.3-53                
[55] ellipsis_0.3.1              Matrix_1.2-18              
[57] rstudioapi_0.12             iterators_1.0.13           
[59] R6_2.5.0                    MALDIquant_1.19.3          
[61] compiler_4.0.2

Can anyone give me suggestions on why I can't read my data files in?

xcms • 679 views
ADD COMMENT
1
Entering edit mode

I highly discourage the use of the xcmsRaw function or any other function from the original xcms package. We partially rewrote the package to re-use functionality for MS data handling from the MSnbase package - and the new functionality is stable and being further developed while I don't fix or update the old code base anymore.

I would suggest to use:

mzxcms <- readMSData("datafile.mzXML", mode = "onDisk")

to read the raw MS data into R. Please have a look at the package vignette (here) or to the small tutorial on MS data handling and processing with MSnbase and xcms here to get some more information on the new functionality.

ADD REPLY
0
Entering edit mode

Hi, I have the same issue. I am trying to read netCDF data converted from Agilent Chemstation .D files. With xcmsRaw(), I got a similar error @garfield320, while using readMSData(), I got the following:

Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method. Error in readInMemMSData(files, pdata = pdata, msLevel. = msLevel., verbose = verbose, : No MS(n>1) spectra in fileC:\Users\qizhi\Documents\R\win-library\4.0\faahKO\cdf\KO\ko15.CDF

Any idea about how to read netCDF data?

Best regards, Qizhi Su

ADD REPLY
0
Entering edit mode

According to the error message you don't have MS level 2 data in the CDF file. I would suggest to load the data with readMSData(<file name>, mode = "onDisk") i.e. in on-disk mode, which will also import MS1 and MS2 spectra (if there were any). The in-memory mode reads by default only MS2 data. If you want to read the data with that you need to specify that you want specifically MS1 spectra: readMSData(<file name>, msLevel = 1, mode = "inMem").

ADD REPLY
0
Entering edit mode
jiahui • 0
@75bd1a7d
Last seen 13 days ago
Hong Kong

To solve the same issue, I changed to the newest version of R (4.2.0), and it finally worked.

ADD COMMENT

Login before adding your answer.

Traffic: 205 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6