sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
183 stars 80 forks source link

Query about writeMSData #524

Closed BaylorSci closed 3 years ago

BaylorSci commented 3 years ago

This may be a bug unrelated to xcms (3.12.0) or is may be me doing something odd, but I am playing around in XCMS for proteomics data and I wanted to export my retention aligned samples out as mzml and mzxml format. The mzml works absolutely fine (xcms::writeMSData(data, outformat="mzml") however, when i provide outformat as "mzxml", it ignores this and instead just outputs mzml. Interestingly, I have tried this with mzR::writeMSData as well, with the same result (mzR 2.23.1).

Is this because mzxml is no longer supported or do all XCMSnExp default force exportation via mzml?

R version is 4.0.2

sneumann commented 3 years ago

Hi, I can't tell for sure, but I can't recall anyone putting an effort into writing mzXML. What we could do at least is give a proper error for any format != mzML. Yours, Steffen

jorainer commented 3 years ago

Hm, it should be possible to export to both mzML and mzXML. I'll have a look.

jorainer commented 3 years ago

Firstly, please don't use xcms:: and mzR:: - it's saver to load the package (xcms) and simply call writeMSData and let R decide which function should be used (and in which package the function is defined - writeMSData is actually a method from the MSnbase package).

Also, I just tried and can not reproduce the error:

> library(xcms)
> f <- msdata::proteomics(full.names = TRUE,
+                         pattern = "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz")
> data <- readMSData(f, mode = "onDisk")
> writeMSData(data, "test.mzML", outformat = "mzml")
> writeMSData(data, "test.mzXML", outformat = "mzxml")
Warning messages:
1: In .local(object, file, ...) :
  mzXML export does not support writing ion injection time
2: In .local(object, file, ...) :
  mzXML export does not support writing filter string

and the first lines of the test.mzML file are:

<?xml version="1.0" encoding="utf-8"?>
<indexedmzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan
ce" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.2_
idx.xsd">
  <mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x
si:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd"
id="" version="1.1.0">

and of the test.mzXML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<mzXML xmlns="http://sashimi.sourceforge.net/schema_revision/mzXML_3.2"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://sashimi.sourceforge.net/schema_revision/mzXML_3.2 http://sashimi.
sourceforge.net/schema_revision/mzXML_3.2/mzXML_idx_3.2.xsd">
  <msRun scanCount="509" startTime="PT1108.3S" endTime="PT1322.95S">

So, it seems to work properly.

My sessionInfo:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] xcms_3.12.0         MSnbase_2.16.0      ProtGenerics_1.22.0
[4] S4Vectors_0.28.0    mzR_2.24.0          Rcpp_1.0.5         
[7] BiocParallel_1.24.1 Biobase_2.50.0      BiocGenerics_0.36.0

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

Many thanks for your reply. It turns out it was something to do with an update that I was refusing to install on windows. Once it installed, everything reverted back to normal.