Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4755ebb
Änderungen MzMLFile (cpp&h)
Apr 14, 2025
eba901b
Änderungen MzMLFile (cpp&h)
Apr 14, 2025
fd2eb79
Änderungen an MzMLFile.cpp
Apr 14, 2025
8065e66
Änderungen MzMLFile.h
Apr 14, 2025
59f22b4
Boost implement & Ergänzung Test.cpp
Apr 22, 2025
35f3b67
Anpassung XMLHanlder.h Doxygen & MzMLHandler.cpp
Apr 28, 2025
9e8048b
Änderungen MzMLHandler
Apr 29, 2025
bdd89ef
Änderungen MzMLHandler
Apr 29, 2025
4346c0c
Anpassung Handler
Apr 29, 2025
b883d4d
Changes in MzMLHandler.h reverted, MzMLFile_test reverted and Test_TR…
Apr 29, 2025
30bb285
Lambda entfernt, Pointer
Apr 30, 2025
d7191d7
rm Int64 offset = os.tellp(); no =0
May 2, 2025
2a0fc3c
Anpassung mit counter
May 2, 2025
4f35175
Anpassungen MzMLHandler, MzXMLHandler, MzMLFile, MzMLHandlerHelper
May 4, 2025
81632e2
index wird immer geschrieben, egal ob compress oder nicht
May 4, 2025
1747431
strategic pattern mit pointer
May 4, 2025
e960d3e
will revert this
May 5, 2025
8c574ef
Strategic pattern with tellp
May 5, 2025
80307d0
added level compression
May 6, 2025
28a214a
pgiz erweiterung, tmp file wird noch nicht richtig gelesen
May 6, 2025
d337a9b
Änderungen an pigz, jetzt Segmentation fault
May 6, 2025
9afbbc9
Anpassung pigz
May 6, 2025
31e2bb8
Process für pigz via windows, stream error
May 7, 2025
7822ce9
Schreibe direkt in output_file
May 8, 2025
6024686
best_speed
May 8, 2025
c993a4a
_popen implement, Code funktioniert
May 8, 2025
31b48c3
Fix Segmentation fault & changed logger_.endProgess position
May 8, 2025
95cad5a
-threads für pigzs eingefügt
May 9, 2025
fcba693
removed MzMLFile_test_XXX files
May 9, 2025
82382c6
reverted Changes
May 9, 2025
79367dc
reverted Changes
May 9, 2025
5af91be
Änderungen aus Kommentaren eingefügt
May 11, 2025
7ced510
pimpl implement
May 13, 2025
48afa16
Dynamic compression Level 1-9
May 13, 2025
cd3bf12
Fixed Pointer Errors
May 13, 2025
82167a7
Abgabe MzML
May 14, 2025
63b9d99
added comments
May 16, 2025
510dc23
Changes based on comments
May 20, 2025
b1fe74b
Update src/openms/include/OpenMS/FORMAT/HANDLERS/MzMLHandler.h
ncbender May 20, 2025
d1df9c7
Update MzMLHandler.h
ncbender May 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ cmake-*-build
_CPack_Packages
_deps
Modules
src/openms_gui/OpenMS_GUI_autogen
src/openms/OpenMS_autogen
src/openms_gui/OpenMS_GUI_autogen
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"develop"
]
],
}
44 changes: 42 additions & 2 deletions src/openms/include/OpenMS/FORMAT/HANDLERS/MzMLHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// $Authors: Marc Sturm, Chris Bielow, Hannes Roest $
// --------------------------------------------------------------------------


#pragma once

#include <OpenMS/CONCEPT/Helpers.h>
Expand All @@ -22,6 +23,14 @@
#include <OpenMS/FORMAT/OPTIONS/PeakFileOptions.h>
#include <OpenMS/FORMAT/ControlledVocabulary.h>
#include <OpenMS/FORMAT/VALIDATORS/SemanticValidator.h>
#include <vector>
#include <string>
#include <utility>
#include <OpenMS/CONCEPT/Types.h> // for Int64
#include <memory>




#include <map>

Expand Down Expand Up @@ -122,9 +131,34 @@ namespace OpenMS
/// Docu in base class XMLHandler::characters
void characters(const XMLCh* const chars, const XMLSize_t length) override;

/// Docu in base class XMLHandler::writeTo
/**
This function serializes the mzML data structure to the provided `std::ostream`.
If the filename (stored in `file_`) ends with `.gz`, the output will be **gzip-compressed**.

### Compression Behavior
- Uses **zlib** (via `boost::iostreams`) with **fastest compression level** by default.
- If **pigz** (parallel implementation of gzip) is **installed and available**, it will be used for faster compression.
- Falls back to **Boost**-based compression if `pigz` is not available.
- **Requires seekable streams** (e.g., file streams).
- Use `storeBuffer()` for non-seekable targets (e.g., network streams).

### Error Handling
@exception Exception::ConversionError
- If **compression fails** (e.g., `boost::iostreams::gzip_error`).
- If the **stream is non-seekable** but compression was requested.
- If **writing/flushing** fails (`std::ios_base::failure`).

@note
- Compression is **determined solely by `file_`'s extension**, not the stream's state.

@see MzMLHandlerHelper::writeFooter_
@see storeBuffer()
@see writeHeader_, writeSpectrum_, writeChromatogram_
*/

void writeTo(std::ostream& os) override;


//@}

/**@name PeakFileOptions setters/getters
Expand Down Expand Up @@ -185,6 +219,12 @@ namespace OpenMS

typedef MzMLHandlerHelper::BinaryData BinaryData;

const bool compress;
struct MzMLHandlerInternalState; // forward declaration
std::unique_ptr<MzMLHandlerInternalState> internal_state_;



/**@name Helper functions for storing data in memory
* @anchor helper_read
*/
Expand Down Expand Up @@ -380,6 +420,7 @@ namespace OpenMS
/// map pointer for writing
const MapType* cexp_{ nullptr };


/// Options that can be set for loading/storing
PeakFileOptions options_;

Expand Down Expand Up @@ -492,4 +533,3 @@ namespace OpenMS

} // namespace Internal
} // namespace OpenMS

28 changes: 26 additions & 2 deletions src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,32 @@ namespace OpenMS
/// Parsing method for closing tags
void endElement(const XMLCh * const uri, const XMLCh * const localname, const XMLCh * const qname) override;

/// Writes the contents to a stream.
virtual void writeTo(std::ostream & /*os*/);
/**
@brief Writes the mzML contents to a given output stream.

This function serializes the mzML data structure to the provided `std::ostream`.
If the filename (stored in `file_`) ends with `.gz`, the output will be **gzip-compressed**.

### Compression Behavior
- Uses **zlib** (via `boost::iostreams`) with **fastest compression level** by default.
- **Requires seekable streams** (e.g., file streams).
- Use `storeBuffer()` for non-seekable targets (e.g., network streams).

### Error Handling
@exception Exception::ConversionError
- If **compression fails** (e.g., `boost::iostreams::gzip_error`).
- If the **stream is non-seekable** but compression was requested.
- If **writing/flushing** fails (`std::ios_base::failure`).

@note
- Compression is **determined solely by `file_`'s extension**, not the stream's state.


@see MzMLHandlerHelper::writeFooter_
@see storeBuffer()
@see writeHeader_, writeSpectrum_, writeChromatogram_
*/
virtual void writeTo(std::ostream& os);

/// handler which support partial loading, implement this method
virtual LOADDETAIL getLoadDetail() const;
Expand Down
23 changes: 16 additions & 7 deletions src/openms/include/OpenMS/FORMAT/MzMLFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,22 @@ namespace OpenMS
void loadSize(const String & filename, Size& scount, Size& ccount);

/**
@brief Stores a map in an MzML file.

@p map has to be an MSExperiment or have the same interface.

@exception Exception::UnableToCreateFile is thrown if the file could not be created
*/
void store(const String& filename, const PeakMap& map) const;
@brief Stores a map in an MzML file with gzip compression.

The method writes the data in gzip-compressed format using Boost Iostreams.

@p map has to be an MSExperiment or have the same interface.

@note The output is automatically compressed using gzip (boost::iostreams::gzip_compressor).
All data is flushed and files are properly closed after writing.

@param filename The name of the output file (will be created or overwritten)
@param map The PeakMap data to be stored

@exception Exception::UnableToCreateFile is thrown if the file could not be created
@exception Exception::IOException may be thrown if writing or compression fails
*/
void store(const String& filename, const PeakMap& map) const;

/**
@brief Stores a map in an output string.
Expand Down
Loading