libpappsomspp
Library for mass spectrometry
psmfilescanprocessandcopy.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/psm/psmfilescanprocessandcopy.cpp
3 * \date 15/07/2025
4 * \author Olivier Langella
5 * \brief PSM file reader designed to parallelize scan process and then copy the results in PSM cbor
6 * output stream
7 */
8
9/*******************************************************************************
10 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of PAPPSOms-tools.
13 *
14 * PAPPSOms-tools is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms-tools is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
30#include "../../../pappsoexception.h"
31#include "../../../utils.h"
32
34 std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p, const QString &operation)
35 : PsmFileScanProcess(buffer_scan_size)
36{
37 mp_cborOutput = cbor_output_p;
38 m_operation = operation;
39
40
41 mp_cborOutput->startMap();
42}
43
44
46{
47}
48
49void
51{
52 mp_cborOutput->endMap();
53}
54
55void
57{
58 mp_cborOutput->writeInformations("pappsomspp_copy", Utils::getVersion(), "psm", m_operation);
59}
60
61
62void
64{
65 m_cborLog.append(m_cborInformations);
66 mp_cborOutput->append("log");
67 mp_cborOutput->writeCborArray(m_cborLog);
68}
69
70void
72{
73 mp_cborOutput->append("parameter_map");
74 mp_cborOutput->writeCborMap(m_cborParameterMap);
75}
76
77void
79{
80 // "target_fasta_files": ["zea_mays.fasta", "contaminant.fasta"],
81 if(!m_targetFastaFiles.isEmpty())
82 {
83 mp_cborOutput->append("target_fasta_files");
84 mp_cborOutput->writeArray(m_targetFastaFiles);
85 }
86 //"decoy_fasta_files" : ["rev_zea_mays.fasta", "rev_contaminant.fasta"],
87
88 if(!m_decoyFastaFiles.isEmpty())
89 {
90 mp_cborOutput->append("decoy_fasta_files");
91 mp_cborOutput->writeArray(m_decoyFastaFiles);
92 }
93}
94
95void
97{
98
99 mp_cborOutput->append("protein_map");
100 m_proteinMap.writeMap(*mp_cborOutput);
101}
102
103
104void
107{
108 for(const pappso::cbor::psm::CborScanMapBase *cbor_scan_p : m_cborScanList)
109 {
110 // qDebug() << cbor_scan_p->keys();
111
112
113 mp_cborOutput->writeCborMap(*cbor_scan_p);
114
115 if(!cbor_scan_p->keys().contains("id"))
116 {
118 QObject::tr("missing scan id %1").arg(cbor_scan_p->keys().size()));
119 }
120 }
121}
122
123void
125 [[maybe_unused]])
126{
127 mp_cborOutput->startMap();
128 mp_cborOutput->append("name");
129 mp_cborOutput->append(m_currentSampleName);
130 if(m_currentIdentificationFileList.size() > 0)
131 {
132 mp_cborOutput->append("identification_file_list");
133 writePsmFileList(*mp_cborOutput, m_currentIdentificationFileList);
134 }
135 mp_cborOutput->append("peaklist_file");
136 writePsmFile(*mp_cborOutput, m_currentPeaklistFile);
137
138 mp_cborOutput->append("scan_list");
139 mp_cborOutput->startArray();
140}
141
142void
144 [[maybe_unused]])
145{
146
147 mp_cborOutput->endArray();
148 mp_cborOutput->endMap();
149}
150
151void
153 [[maybe_unused]])
154{
155 mp_cborOutput->append("sample_list");
156 mp_cborOutput->startArray();
157}
158
159void
161 [[maybe_unused]])
162{
163 mp_cborOutput->endArray();
164}
static QString getVersion()
Definition: utils.cpp:623
void sampleStarted(pappso::UiMonitorInterface &monitor) override
void fastaFilesReady(pappso::UiMonitorInterface &monitor) override
void sampleFinished(pappso::UiMonitorInterface &monitor) override
PsmFileScanProcessAndCopy(std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p, const QString &operation)
void sampleListStarted(pappso::UiMonitorInterface &monitor) override
void sampleListFinished(pappso::UiMonitorInterface &monitor) override
void proteinMapReady(pappso::UiMonitorInterface &monitor) override
void informationsReady(pappso::UiMonitorInterface &monitor) override
void processBufferScanDone(pappso::UiMonitorInterface &monitor) override
void parameterMapReady(pappso::UiMonitorInterface &monitor) override
void logReady(pappso::UiMonitorInterface &monitor) override
Basic PSM file reader to process scan (parallelized scan processing)
PSM file reader designed to parallelize scan process and then copy the results in PSM cbor output str...