levitsky / pyteomics

Pyteomics is a collection of lightweight and handy tools for Python that help to handle various sorts of proteomics data. Pyteomics provides a growing set of modules to facilitate the most common tasks in proteomics data analysis.
http://pyteomics.readthedocs.io
Apache License 2.0
105 stars 34 forks source link

Error with version 4.6 when trying to open mzML or mzXML files. #112

Closed sorenwacker closed 1 year ago

sorenwacker commented 1 year ago

Maybe the syntax has been changed in 4.6? But I am running into this with both mzML and mzXML files:

  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/ms_mint/io.py", line 158, in mzml_to_df
    with mzml.read(str(fn)) as reader:
         ^^^^^^^^^^^^^^^^^^
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/mzml.py", line 405, in read
    return MzML(source, read_schema=read_schema, iterative=iterative,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/mzml.py", line 133, in __init__
    super(MzML, self).__init__(*args, **kwargs)
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/auxiliary/utils.py", line 136, in __init__
    super(ArrayConversionMixin, self).__init__(*args, **kwargs)
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/auxiliary/file_helpers.py", line 380, in __init__
    super(TimeOrderedIndexedReaderMixin, self).__init__(*args, **kwargs)
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/xml.py", line 1075, in __init__
    super(IndexedXML, self).__init__(source, read_schema, iterative, build_id_cache, *args, **kwargs)
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/xml.py", line 260, in __init__
    self.version_info = self._get_version_info()
                        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/auxiliary/file_helpers.py", line 84, in wrapped
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/swacker/miniconda3/envs/ms-mint-staging/lib/python3.11/site-packages/pyteomics/xml.py", line 298, in _get_version_info
    for _, elem in etree.iterparse(
  File "src/lxml/iterparse.pxi", line 210, in lxml.etree.iterparse.__next__
  File "src/lxml/iterparse.pxi", line 195, in lxml.etree.iterparse.__next__
  File "src/lxml/iterparse.pxi", line 230, in lxml.etree.iterparse._read_more_events
  File "src/lxml/parser.pxi", line 1379, in lxml.etree._FeedParser.feed
  File "src/lxml/parser.pxi", line 609, in lxml.etree._ParserContext._handleParseResult
  File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
  File "/home/swacker/MINT/Local/workspaces/test/ms_files/SA_B4.mzML", line 2
lxml.etree.XMLSyntaxError: XML declaration allowed only at the start of the document, line 2, column 6
sorenwacker commented 1 year ago

This is a problem with the dash-uploader, changing the file content of the XML files.