Loading...
Searching...
No Matches
msrundatasettree.h
Go to the documentation of this file.
// GPL 3+
// Filippo Rusconi
#pragma once
/////////////////////// StdLib includes
/////////////////////// Qt includes
/////////////////////// Local includes
#include "msrundatasettreevisitor.h"
#include "msrundatasettreenode.h"
#include "msrunid.h"
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/processing/combiners/selectionpolygon.h"
namespace pappso
{
class MsRunDataSetTree;
typedef std::shared_ptr<MsRunDataSetTree> MsRunDataSetTreeSPtr;
typedef std::shared_ptr<const MsRunDataSetTree> MsRunDataSetTreeCstSPtr;
class PMSPP_LIB_DECL MsRunDataSetTree
{
public:
MsRunDataSetTree(MsRunIdCstSPtr ms_run_id_csp);
virtual ~MsRunDataSetTree();
MsRunDataSetTreeNode *
addMassSpectrum(QualifiedMassSpectrumCstSPtr mass_spectrum);
const std::map<std::size_t, MsRunDataSetTreeNode *> &getIndexNodeMap() const;
const std::vector<MsRunDataSetTreeNode *> &getRootNodes() const;
void accept(MsRunDataSetTreeNodeVisitorInterface &visitor);
void accept(MsRunDataSetTreeNodeVisitorInterface &visitor,
std::vector<pappso::MsRunDataSetTreeNode *>::const_iterator
nodes_begin_iterator,
std::vector<pappso::MsRunDataSetTreeNode *>::const_iterator
nodes_end_iterator);
MsRunDataSetTreeNode *
findNode(QualifiedMassSpectrumCstSPtr mass_spectrum_csp) const;
MsRunDataSetTreeNode *findNode(std::size_t spectrum_index) const;
std::size_t massSpectrumIndex(const MsRunDataSetTreeNode *node) const;
std::size_t massSpectrumIndex(
QualifiedMassSpectrumCstSPtr qualified_mass_spectrum_csp) const;
/****************** Flattened views ******************/
std::vector<MsRunDataSetTreeNode *> flattenedView();
std::vector<MsRunDataSetTreeNode *>
flattenedViewMsLevel(std::size_t ms_level, bool with_descendants = false);
/****************** Flattened views ******************/
MsRunDataSetTreeNode *
precursorNodeByProductSpectrumIndex(std::size_t product_spectrum_index);
std::vector<MsRunDataSetTreeNode *>
productNodesByPrecursorSpectrumIndex(std::size_t precursor_spectrum_index);
std::vector<MsRunDataSetTreeNode *>
precursorNodesByPrecursorMz(pappso_double mz, PrecisionPtr precision_ptr);
// Utility functions.
std::size_t depth() const;
// The tree size as computed by going down the tree nodes.
std::size_t size() const;
// The size of the flat index/node map as filled in during file loading.
std::size_t indexNodeMapSize() const;
std::size_t getSpectrumCount() const;
using NodeVector = std::vector<MsRunDataSetTreeNode *>;
using QualMassSpectraVector = std::vector<QualifiedMassSpectrumCstSPtr>;
using DoubleNodeVectorMap = std::map<double, NodeVector>;
std::size_t addDataSetTreeNodesInsideDtOrRtRange(double start,
double end,
NodeVector &nodes,
Enums::DataKind data_kind) const;
std::size_t removeDataSetTreeNodesOutsideDtOrRtRange(double start,
double end,
NodeVector &nodes,
Enums::DataKind data_kind) const;
std::size_t
addDataSetQualMassSpectraInsideDtOrRtRange(double start,
double end,
QualMassSpectraVector &mass_spectra,
Enums::DataKind data_kind) const;
std::size_t removeDataSetQualMassSpectraOutsideDtOrRtRange(
double start,
double end,
QualMassSpectraVector &mass_spectra,
Enums::DataKind data_kind) const;
private:
MsRunIdCstSPtr mcsp_msRunId;
std::size_t m_spectrumCount = std::numeric_limits<std::size_t>::min();
std::vector<MsRunDataSetTreeNode *> m_rootNodes;
std::map<std::size_t, MsRunDataSetTreeNode *> m_indexNodeMap;
// We want to be able to list easily all the mass spectra that were acquired
// at any given RT or DT.
DoubleNodeVectorMap m_dtDoubleNodeVectorMap;
DoubleNodeVectorMap m_rtDoubleNodeVectorMap;
// Beware for data_kind == ion mobility to use the right
// ion mobility value: 1/K0 for Bruker timsTOF data and
// m_dt for Agilent and Synapt data.
bool documentNodeInDtRtMap(double time,
MsRunDataSetTreeNode *node_p,
Enums::DataKind data_kind);
// These addMassSpectrum functions are for forensic science.
MsRunDataSetTreeNode *
addMassSpectrum(QualifiedMassSpectrumCstSPtr mass_spectrum,
MsRunDataSetTreeNode *parent);
MsRunDataSetTreeNode *
addMassSpectrum(QualifiedMassSpectrumCstSPtr mass_spectrum,
std::size_t precursor_spectrum_index);
};
} // namespace pappso
pappso::MsRunDataSetTreeNodeVisitorInterface
Definition msrundatasettreevisitor.h:25
pappso::MsRunDataSetTreeNode
Definition msrundatasettreenode.h:33
pappso::MsRunDataSetTree
Definition msrundatasettree.h:29
pappso::MsRunDataSetTree::findNode
MsRunDataSetTreeNode * findNode(QualifiedMassSpectrumCstSPtr mass_spectrum_csp) const
Definition msrundatasettree.cpp:303
pappso::MsRunDataSetTree::getRootNodes
const std::vector< MsRunDataSetTreeNode * > & getRootNodes() const
Definition msrundatasettree.cpp:244
pappso::MsRunDataSetTree::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition msrundatasettree.h:112
pappso::MsRunDataSetTree::QualMassSpectraVector
std::vector< QualifiedMassSpectrumCstSPtr > QualMassSpectraVector
Definition msrundatasettree.h:85
pappso::MsRunDataSetTree::flattenedViewMsLevel
std::vector< MsRunDataSetTreeNode * > flattenedViewMsLevel(std::size_t ms_level, bool with_descendants=false)
Definition msrundatasettree.cpp:353
pappso::MsRunDataSetTree::indexNodeMapSize
std::size_t indexNodeMapSize() const
Definition msrundatasettree.cpp:1200
pappso::MsRunDataSetTree::accept
void accept(MsRunDataSetTreeNodeVisitorInterface &visitor)
Definition msrundatasettree.cpp:250
pappso::MsRunDataSetTree::MsRunDataSetTree
MsRunDataSetTree(MsRunIdCstSPtr ms_run_id_csp)
Definition msrundatasettree.cpp:18
pappso::MsRunDataSetTree::flattenedView
std::vector< MsRunDataSetTreeNode * > flattenedView()
Definition msrundatasettree.cpp:337
pappso::MsRunDataSetTree::addDataSetQualMassSpectraInsideDtOrRtRange
std::size_t addDataSetQualMassSpectraInsideDtOrRtRange(double start, double end, QualMassSpectraVector &mass_spectra, Enums::DataKind data_kind) const
Definition msrundatasettree.cpp:862
pappso::MsRunDataSetTree::documentNodeInDtRtMap
bool documentNodeInDtRtMap(double time, MsRunDataSetTreeNode *node_p, Enums::DataKind data_kind)
Definition msrundatasettree.cpp:489
pappso::MsRunDataSetTree::removeDataSetTreeNodesOutsideDtOrRtRange
std::size_t removeDataSetTreeNodesOutsideDtOrRtRange(double start, double end, NodeVector &nodes, Enums::DataKind data_kind) const
Definition msrundatasettree.cpp:753
pappso::MsRunDataSetTree::getSpectrumCount
std::size_t getSpectrumCount() const
Definition msrundatasettree.cpp:1206
pappso::MsRunDataSetTree::m_indexNodeMap
std::map< std::size_t, MsRunDataSetTreeNode * > m_indexNodeMap
Definition msrundatasettree.h:117
pappso::MsRunDataSetTree::m_rootNodes
std::vector< MsRunDataSetTreeNode * > m_rootNodes
Definition msrundatasettree.h:116
pappso::MsRunDataSetTree::DoubleNodeVectorMap
std::map< double, NodeVector > DoubleNodeVectorMap
Definition msrundatasettree.h:87
pappso::MsRunDataSetTree::precursorNodesByPrecursorMz
std::vector< MsRunDataSetTreeNode * > precursorNodesByPrecursorMz(pappso_double mz, PrecisionPtr precision_ptr)
Definition msrundatasettree.cpp:453
pappso::MsRunDataSetTree::NodeVector
std::vector< MsRunDataSetTreeNode * > NodeVector
Definition msrundatasettree.h:84
pappso::MsRunDataSetTree::depth
std::size_t depth() const
Definition msrundatasettree.cpp:1152
pappso::MsRunDataSetTree::precursorNodeByProductSpectrumIndex
MsRunDataSetTreeNode * precursorNodeByProductSpectrumIndex(std::size_t product_spectrum_index)
Definition msrundatasettree.cpp:415
pappso::MsRunDataSetTree::getIndexNodeMap
const std::map< std::size_t, MsRunDataSetTreeNode * > & getIndexNodeMap() const
Definition msrundatasettree.cpp:207
pappso::MsRunDataSetTree::addMassSpectrum
MsRunDataSetTreeNode * addMassSpectrum(QualifiedMassSpectrumCstSPtr mass_spectrum)
Definition msrundatasettree.cpp:50
pappso::MsRunDataSetTree::massSpectrumIndex
std::size_t massSpectrumIndex(const MsRunDataSetTreeNode *node) const
Definition msrundatasettree.cpp:213
pappso::MsRunDataSetTree::m_rtDoubleNodeVectorMap
DoubleNodeVectorMap m_rtDoubleNodeVectorMap
Definition msrundatasettree.h:123
pappso::MsRunDataSetTree::productNodesByPrecursorSpectrumIndex
std::vector< MsRunDataSetTreeNode * > productNodesByPrecursorSpectrumIndex(std::size_t precursor_spectrum_index)
Definition msrundatasettree.cpp:434
pappso::MsRunDataSetTree::size
std::size_t size() const
Definition msrundatasettree.cpp:1184
pappso::MsRunDataSetTree::m_spectrumCount
std::size_t m_spectrumCount
Definition msrundatasettree.h:114
pappso::MsRunDataSetTree::m_dtDoubleNodeVectorMap
DoubleNodeVectorMap m_dtDoubleNodeVectorMap
Definition msrundatasettree.h:122
pappso::MsRunDataSetTree::addDataSetTreeNodesInsideDtOrRtRange
std::size_t addDataSetTreeNodesInsideDtOrRtRange(double start, double end, NodeVector &nodes, Enums::DataKind data_kind) const
Definition msrundatasettree.cpp:690
pappso::MsRunDataSetTree::removeDataSetQualMassSpectraOutsideDtOrRtRange
std::size_t removeDataSetQualMassSpectraOutsideDtOrRtRange(double start, double end, QualMassSpectraVector &mass_spectra, Enums::DataKind data_kind) const
Definition msrundatasettree.cpp:1016
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
msrundatasettreenode.h
msrundatasettreevisitor.h
msrunid.h
pappso::Enums::DataKind
DataKind
Definition types.h:249
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MsRunDataSetTreeSPtr
std::shared_ptr< MsRunDataSetTree > MsRunDataSetTreeSPtr
Definition msrundatasettree.h:25
pappso::MsRunDataSetTreeCstSPtr
std::shared_ptr< const MsRunDataSetTree > MsRunDataSetTreeCstSPtr
Definition msrundatasettree.h:26
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::QualifiedMassSpectrumCstSPtr
std::shared_ptr< const QualifiedMassSpectrum > QualifiedMassSpectrumCstSPtr
Definition qualifiedmassspectrum.h:45
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition precision.h:122
selectionpolygon.h