Any alternative to readstruct to accelerate large XML file importation?

17 次查看(过去 30 天)
I often import large mzXML files in MATLAB using the mzxmlread function of the Bioinformatics Toolbox, that is based on the readstruct function. Note that mzXML files are basically XML files.
My files typically each take 1 to 3 GB of disk space, and the importation consequently takes time (3-10 minutes).
Are there any tricks or any alternatives to the readstruct function, that could use parallel calculation for example, in order to import one single mzXML files faster?
Regards.
  3 个评论

请先登录,再进行评论。

回答(1 个)

Pratyush
Pratyush 2023-10-23
Hi phenan08,
I understand that you work with large mzXML files. These files take a long time to import in MATLAB, and you want some workaround that is less time-consuming to work with these files.
Here are a few suggestions that may help:
  1. Memory Mapping: Instead of loading the entire mzXML file into memory, you can consider using memory mapping techniques. MATLAB provides functions like 'memmapfile' that allow you to access the data in the file without loading it entirely. This can help reduce memory usage and improve performance. Refer to the following documentation for details on 'memmapfile': Create memory map to a file - MATLAB memmapfile - MathWorks India
  2. Read Subset of Data: If you only need to work with a subset of the data in the mzXML file, you can consider reading only the required portions. This can be achieved by modifying the readstruct function or using lower-level XML parsing functions in MATLAB, such as xmlread, to extract only the necessary data.Refer to the following documentation for details on 'xmlread': Read XML document and return Document Object Model node - MATLAB xmlread - MathWorks India
  3. External Libraries: MATLAB provides the ability to call external libraries using the mex interface. You can explore libraries specifically designed for efficient XML parsing, such as "libxml2" or "Xerces-C++", and create a custom MEX function to import the mzXML files faster.

类别

Help CenterFile Exchange 中查找有关 Live Scripts and Functions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by