Loading...
Searching...
No Matches
psmproteinmap.h
Go to the documentation of this file.
/**
* \file pappsomspp/processing/cbor/psm/psmproteinmap.h
* \date 05/07/2025
* \author Olivier Langella
* \brief PAPPSO CBOR protein map
*/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "pappsomspp/export-import-config.h"
#include <map>
#include <QString>
#include "pappsomspp/core/protein/protein.h"
#include "pappsomspp/core/processing/cbor/cborstreamwriter.h"
#include "pappsomspp/core/processing/cbor/cborstreamreader.h"
namespace pappso
{
namespace cbor
{
namespace psm
{
struct PsmProtein
{
std::shared_ptr<Protein> protein_sp = nullptr;
bool isTarget = true;
bool isContaminant = false;
QCborMap cborEval;
};
/** @brief store PsmProtein in a map with accession as key
*
*/
class PMSPP_LIB_DECL PsmProteinMap
{
public:
/**
* Default constructor
*/
PsmProteinMap();
/**
* Destructor
*/
virtual ~PsmProteinMap();
/** @brief standard map insert of a PsmProtein (accession is the key)
*
* @return standard C++ insert iterator on a map
*/
std::pair<std::map<QString, PsmProtein>::iterator, bool> insert(const PsmProtein &psm_protein);
/** @brief writes the protein map in a cbor output stream
* this output a CborMap structure directly in the output stream
*
* @param writer the cbor output stream
*/
void writeMap(CborStreamWriter &writer) const;
/** @brief reads the protein map from a cbor input stream
*
* @param reader the cbor intput stream
*/
void readMap(CborStreamReader &reader);
/** @brief get protein map size
*/
std::size_t size() const;
/** @brief retrieve a PsmProtein with its accession
* @return PsmProtein const reference
*/
const pappso::cbor::psm::PsmProtein &getByAccession(const QString &accession) const;
/** @brief merge with other protein map
*/
void merge(const PsmProteinMap &other_protein_map);
/** @brief reduce to protein accessions listed in input
*/
void reduce(const QStringList &accession_list);
std::map<QString, PsmProtein> &getProteinMap();
private:
std::map<QString, PsmProtein> m_proteinMap;
};
} // namespace psm
} // namespace cbor
} // namespace pappso
cborstreamreader.h
cborstreamwriter.h
pappso::cbor::CborStreamReader
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
Definition cborstreamreader.h:46
pappso::cbor::CborStreamWriter
overrides QCborStreamWriter base class to provide convenient functions
Definition cborstreamwriter.h:45
pappso::cbor::psm::PsmProteinMap::reduce
void reduce(const QStringList &accession_list)
reduce to protein accessions listed in input
Definition psmproteinmap.cpp:185
pappso::cbor::psm::PsmProteinMap::size
std::size_t size() const
get protein map size
Definition psmproteinmap.cpp:158
pappso::cbor::psm::PsmProteinMap::merge
void merge(const PsmProteinMap &other_protein_map)
merge with other protein map
Definition psmproteinmap.cpp:176
pappso::cbor::psm::PsmProteinMap::m_proteinMap
std::map< QString, PsmProtein > m_proteinMap
Definition psmproteinmap.h:111
pappso::cbor::psm::PsmProteinMap::getByAccession
const pappso::cbor::psm::PsmProtein & getByAccession(const QString &accession) const
retrieve a PsmProtein with its accession
Definition psmproteinmap.cpp:164
pappso::cbor::psm::PsmProteinMap::getProteinMap
std::map< QString, PsmProtein > & getProteinMap()
Definition psmproteinmap.cpp:43
pappso::cbor::psm::PsmProteinMap::insert
std::pair< std::map< QString, PsmProtein >::iterator, bool > insert(const PsmProtein &psm_protein)
standard map insert of a PsmProtein (accession is the key)
Definition psmproteinmap.cpp:50
pappso::cbor::psm::PsmProteinMap::readMap
void readMap(CborStreamReader &reader)
reads the protein map from a cbor input stream
Definition psmproteinmap.cpp:88
pappso::cbor::psm::PsmProteinMap::PsmProteinMap
PsmProteinMap()
Definition psmproteinmap.cpp:33
pappso::cbor::psm::PsmProteinMap::writeMap
void writeMap(CborStreamWriter &writer) const
writes the protein map in a cbor output stream this output a CborMap structure directly in the output...
Definition psmproteinmap.cpp:57
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::cbor::psm
Definition cborscanmapbase.h:40
pappso::cbor
Definition cborstreamreader.cpp:35
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
protein.h
pappso::cbor::psm::PsmProtein
Definition psmproteinmap.h:46
pappso::cbor::psm::PsmProtein::cborEval
QCborMap cborEval
Definition psmproteinmap.h:50
pappso::cbor::psm::PsmProtein::isTarget
bool isTarget
Definition psmproteinmap.h:48
pappso::cbor::psm::PsmProtein::isContaminant
bool isContaminant
Definition psmproteinmap.h:49
pappso::cbor::psm::PsmProtein::protein_sp
std::shared_ptr< Protein > protein_sp
Definition psmproteinmap.h:47