OpenMS
Loading...
Searching...
No Matches
QPXFile.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/config.h>
12
19
20#include <memory>
21#include <vector>
22
23// Forward declarations
24namespace arrow
25{
26 class Table;
27}
28
29namespace OpenMS
30{
31
43class OPENMS_DLLAPI QPXFile
44{
45public:
53 static std::shared_ptr<arrow::Table> exportToArrow(
54 const std::vector<ProteinIdentification>& protein_identifications,
55 const PeptideIdentificationList& peptide_identifications,
56 bool export_all_psms = false);
57
74 static std::shared_ptr<arrow::Table> exportPSMsToQPXArrow(
75 const std::vector<ProteinIdentification>& protein_identifications,
76 const PeptideIdentificationList& peptide_identifications,
77 bool export_all_psms = false,
78 const QPXIdentity::FeatureLinks* feature_links = nullptr);
79
91 static bool exportToParquet(
92 const std::vector<ProteinIdentification>& protein_identifications,
93 const PeptideIdentificationList& peptide_identifications,
94 const std::string& filename,
95 bool export_all_psms = false,
96 const ParquetWriteConfig& config = ParquetWriteConfig{},
97 const QPXIdentity::FeatureLinks* feature_links = nullptr);
98
116 static bool exportToParquet(
117 const std::shared_ptr<arrow::Table>& table,
118 const std::string& filename,
119 const ParquetWriteConfig& config = ParquetWriteConfig{},
120 const std::string& scan_format = "");
121
157 const std::vector<ProteinIdentification>& protein_identifications,
158 const std::vector<const PeptideIdentification*>& peptide_identification_ptrs,
159 const std::string& filename,
160 bool export_all_psms = false,
161 size_t batch_size = 1000000,
162 const ParquetWriteConfig& config = ParquetWriteConfig{},
163 int n_threads = 1,
164 const QPXIdentity::FeatureLinks* feature_links = nullptr);
165
183 const std::vector<ProteinIdentification>& protein_identifications,
184 const PeptideIdentificationList& peptide_identifications);
185
198 const std::vector<ProteinIdentification>& protein_identifications,
199 const std::vector<const PeptideIdentification*>& peptide_identifications);
200
215 static bool importFromArrow(
216 const std::shared_ptr<arrow::Table>& table,
217 std::vector<ProteinIdentification>& protein_identifications,
218 PeptideIdentificationList& peptide_identifications);
219};
220
221} // namespace OpenMS
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Export PSM (Peptide Spectrum Match) data to Apache Arrow format following QPX PSM schema.
Definition QPXFile.h:44
static std::shared_ptr< arrow::Table > exportToArrow(const std::vector< ProteinIdentification > &protein_identifications, const PeptideIdentificationList &peptide_identifications, bool export_all_psms=false)
Export PSMs to Arrow table using PSMSchema for lossless round-trips.
static bool exportToParquet(const std::vector< ProteinIdentification > &protein_identifications, const PeptideIdentificationList &peptide_identifications, const std::string &filename, bool export_all_psms=false, const ParquetWriteConfig &config=ParquetWriteConfig{}, const QPXIdentity::FeatureLinks *feature_links=nullptr)
Export PSM data to Parquet file.
static bool exportToParquet(const std::shared_ptr< arrow::Table > &table, const std::string &filename, const ParquetWriteConfig &config=ParquetWriteConfig{}, const std::string &scan_format="")
Write a pre-built QPX PSM Arrow table to a Parquet file.
static void requireResolvableMergeIndices(const std::vector< ProteinIdentification > &protein_identifications, const std::vector< const PeptideIdentification * > &peptide_identifications)
Pointer-based overload of requireResolvableMergeIndices()
static bool importFromArrow(const std::shared_ptr< arrow::Table > &table, std::vector< ProteinIdentification > &protein_identifications, PeptideIdentificationList &peptide_identifications)
Import PSMs from a PSMSchema Arrow table.
static std::shared_ptr< arrow::Table > exportPSMsToQPXArrow(const std::vector< ProteinIdentification > &protein_identifications, const PeptideIdentificationList &peptide_identifications, bool export_all_psms=false, const QPXIdentity::FeatureLinks *feature_links=nullptr)
Export PSMs to QPX Parquet eXchange format Arrow table (QPXPSMSchema).
static void requireResolvableMergeIndices(const std::vector< ProteinIdentification > &protein_identifications, const PeptideIdentificationList &peptide_identifications)
Refuse PSMs of a merged run that carry no usable id_merge_index.
static bool exportToParquetStreaming(const std::vector< ProteinIdentification > &protein_identifications, const std::vector< const PeptideIdentification * > &peptide_identification_ptrs, const std::string &filename, bool export_all_psms=false, size_t batch_size=1000000, const ParquetWriteConfig &config=ParquetWriteConfig{}, int n_threads=1, const QPXIdentity::FeatureLinks *feature_links=nullptr)
Stream PSMs to a QPX Parquet file in row-batches to cap peak memory.
std::unordered_map< Int64, Int64 > FeatureLinks
The feature↔PSM edge of one QPX collection, as psm_id → feature_id.
Definition QPXIdentity.h:64
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Definition ArrowIOHelpers.h:26
Configuration for Parquet file writing.
Definition MSExperimentArrowExport.h:136