pymzml / pymzML

pymzML - an interface between Python and mzML Mass spectrometry Files
https://pymzml.readthedocs.io/en/latest/
MIT License
163 stars 92 forks source link

run.Writer issue #112

Closed mukils15 closed 5 years ago

mukils15 commented 5 years ago

I am relatively new to using pyzMZML, and am trying to write average spectra to a new file using run.Writer, which I found on the pyMZML documentation. However, I get an error that the pymzml.run module has no attribute Writer:

AttributeError Traceback (most recent call last)

in () 52 #plt.savefig('ESI-MS2.png') 53 ---> 54 getSpectralAverageAndWriteToFile("ESI-MS1.mzML") 55 56 ##if __name__ == '__main__': in getSpectralAverageAndWriteToFile(filepath) 40 # write spectra to another file 41 run = pymzml.run.Reader(filepath, MS1_Precision = 5e-6, MSn_Precision = 20e-6) ---> 42 write_run = pymzml.run.Writer(filename='write_test.mzML', run=run , overwrite=True) 43 44 #msrun3 = pymzml.run.Run(filepath, precisionMSn = 250e-6) **AttributeError: module 'pymzml.run' has no attribute 'Writer'** Can anybody help with this? Do I need a newer version of pymzml? It seems to me that I have the most up-to-date version.
k7shanmugam commented 5 years ago

Documentation seems to be wrong. See https://github.com/pymzml/pymzML/blob/master/pymzml/run.py where Reader is implemented and Writer is not. Documentation seems to be optimistic about the availability of Writer method

@fu - doc states 'Writer' is still in development. Do you know if anyone has a working version of the writer method. Any other way of saving the processed spectra would be helpful too. Thanks.

JB-MS commented 5 years ago

Hi,

indeed the mzML writing is currently not supported.

But have a look at this module for mzML and mzIdemtML writing: psims

Cheers, Johannes

k7shanmugam commented 5 years ago

Thanks @JB-MS.

@mukils15 - take a look at the psims module. You should be able to import it and use it as described in the documentation: writing MZML

MKoesters commented 5 years ago

The documentation linked at github is deprecated, thats true. The newest docu can be found here: https://pymzml.readthedocs.io/en/latest/index.html We removed the writer after version 0.7 since it was a very simple implementation with a lot of shortcomings. I'll link the new docu and add a link to psims for people that need to write mzMLs