Loading...
Searching...
No Matches
bucket.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/processing/spectree/bucket.cpp
* \date 13/12/2023
* \author Olivier Langella
* \brief bucket for spectree
*
* C++ implementation of algorithm already described in :
* 1. David, M., Fertin, G., Rogniaux, H. & Tessier, D. SpecOMS: A Full Open
* Modification Search Method Performing All-to-All Spectra Comparisons within
* Minutes. J. Proteome Res. 16, 3030–3038 (2017).
*
* https://www.theses.fr/2019NANT4092
*/
/*
* SpecTree
* Copyright (C) 2023 Olivier Langella
* <olivier.langella@universite-paris-saclay.fr>
*
* This program is free software: you can redistribute ipetide to spectrum
* alignmentt 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.
*
* This program 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 th^e GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "bucket.h"
#include <algorithm>
namespace pappso
{
namespace spectree
{
Bucket::Bucket(std::size_t val)
{
m_itemId = val;
}
Bucket::Bucket(const Bucket &other) : m_cartList(other.m_cartList)
{
m_itemId = other.m_itemId;
}
void
Bucket::push_back(std::size_t cart)
{
m_cartList.push_back(cart);
}
std::size_t
Bucket::size() const
{
return m_cartList.size();
}
std::size_t
Bucket::getId() const
{
return m_itemId;
}
bool
Bucket::operator<(const Bucket &bucket_b) const
{
auto it_bucket_end = m_cartList.end();
auto it_bucket_b_end = bucket_b.m_cartList.end();
auto it_bucket = m_cartList.begin();
auto it_bucket_b = bucket_b.m_cartList.begin();
for(; it_bucket != it_bucket_end && it_bucket_b != it_bucket_b_end;
it_bucket++, it_bucket_b++)
{
if(*it_bucket != *it_bucket_b)
return (*it_bucket < *it_bucket_b);
}
// When the buckets have an equal content until the limit, the shortest one
// is returned first
return (m_cartList.size() < bucket_b.m_cartList.size());
}
std::size_t
Bucket::front() const
{
return m_cartList.front();
}
std::size_t
Bucket::back() const
{
return m_cartList.back();
}
const std::vector<std::size_t> &
Bucket::getCartList() const
{
return m_cartList;
}
} // namespace spectree
} // namespace pappso
bucket.h
bucket for spectree
pappso::spectree::Bucket
Definition bucket.h:56
pappso::spectree::Bucket::size
std::size_t size() const
Definition bucket.cpp:62
pappso::spectree::Bucket::operator<
bool operator<(const Bucket &bucket_two) const
Definition bucket.cpp:75
pappso::spectree::Bucket::m_itemId
std::size_t m_itemId
Definition bucket.h:118
pappso::spectree::Bucket::push_back
void push_back(std::size_t cart)
Definition bucket.cpp:56
pappso::spectree::Bucket::m_cartList
std::vector< std::size_t > m_cartList
Definition bucket.h:127
pappso::spectree::Bucket::Bucket
Bucket(std::size_t val)
Definition bucket.cpp:45
pappso::spectree::Bucket::back
std::size_t back() const
get the last cart id of the list
Definition bucket.cpp:103
pappso::spectree::Bucket::getId
std::size_t getId() const
Definition bucket.cpp:68
pappso::spectree::Bucket::front
std::size_t front() const
get the first cart id of the list
Definition bucket.cpp:97
pappso::spectree::Bucket::getCartList
const std::vector< std::size_t > & getCartList() const
Definition bucket.cpp:109
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39