Loading...
Searching...
No Matches
enzyme.h
Go to the documentation of this file.
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ 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++ 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++. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#pragma once
#include "enzymeproductinterface.h"
#include <QRegularExpression>
namespace pappso
{
class PMSPP_LIB_DECL Enzyme
{
public:
/** \brief build the default enzyme (trypsin) with recognition_site =
* "([KR])([^P])"
* */
Enzyme();
/** \brief build any enzyme given a recognition_site
* \param recognition_site is a regular expression that must identify 2 motifs
* : one on Nter side one on Cter side
* */
Enzyme(const QString &recognition_site);
~Enzyme();
/** \brief digest a protein into enzyme products
* \param sequence_database_id integer that references the sequence fatabase
* (file, stream, url...) \param protein_sp is the original protein to be
* digested \param is_decoy tell if the current protein is a decoy (true) or
* normal (false) protein \param enzyme_product is the object that will
* receive the digestion products
* */
void eat(std::int8_t sequence_database_id,
const ProteinSp &protein_sp,
bool is_decoy,
EnzymeProductInterface &enzyme_product) const;
/** \brief sets the maximum number of missed cleavage allowed in the digestion
* \param miscleavage maximum number of missed cleavade to allow (defaults is
* 0)
* */
void setMiscleavage(unsigned int miscleavage);
/** \brief get the maximum number of missed cleavage allowed in the digestion
* @return miscleavage maximum number of missed cleavade to allow (defaults is
* 0)
* */
unsigned int getMiscleavage() const;
/** \brief take only first m_takeOnlyFirstWildcard
* \param bool true : switch to take only the first possibility if there are
* X, B or Z wildcards in sequence
*/
void setTakeOnlyFirstWildcard(bool take_only_first_wildcard);
/** \brief if there are wildcards in the protein sequence : restrict the
* number of possible peptide sequences \param max_peptide_variant_list_size
* maximum number of peptide variant (default is 100)
*/
void setMaxPeptideVariantListSize(std::size_t max_peptide_variant_list_size);
const QRegularExpression &getQRegExpRecognitionSite() const;
private:
/** \brief example with a kinase == [K,R] */
QRegularExpression m_recognitionSite;
unsigned int m_miscleavage = 0;
bool m_takeOnlyFirstWildcard = false;
std::size_t m_maxPeptideVariantListSize = 100;
std::vector<char> m_wildCardX;
std::vector<char> m_wildCardB;
std::vector<char> m_wildCardZ;
void sanityCheck(EnzymeProductInterface &enzyme_product,
std::int8_t sequence_database_id,
const ProteinSp &protein_sp,
bool is_decoy,
const PeptideStr &peptide,
unsigned int start,
bool is_nter,
unsigned int missed_cleavage_number,
bool semi_enzyme) const;
void replaceWildcards(std::vector<std::string> *p_peptide_variant_list) const;
};
} // namespace pappso
pappso::EnzymeProductInterface
Definition enzymeproductinterface.h:34
pappso::Enzyme::m_recognitionSite
QRegularExpression m_recognitionSite
example with a kinase == [K,R]
Definition enzyme.h:89
pappso::Enzyme::m_maxPeptideVariantListSize
std::size_t m_maxPeptideVariantListSize
Definition enzyme.h:93
pappso::Enzyme::getMiscleavage
unsigned int getMiscleavage() const
get the maximum number of missed cleavage allowed in the digestion
Definition enzyme.cpp:76
pappso::Enzyme::Enzyme
Enzyme()
build the default enzyme (trypsin) with recognition_site = "([KR])([^P])"
Definition enzyme.cpp:32
pappso::Enzyme::setMiscleavage
void setMiscleavage(unsigned int miscleavage)
sets the maximum number of missed cleavage allowed in the digestion
Definition enzyme.cpp:71
pappso::Enzyme::m_wildCardB
std::vector< char > m_wildCardB
Definition enzyme.h:97
pappso::Enzyme::m_wildCardZ
std::vector< char > m_wildCardZ
Definition enzyme.h:98
pappso::Enzyme::m_wildCardX
std::vector< char > m_wildCardX
Definition enzyme.h:96
pappso::Enzyme::sanityCheck
void sanityCheck(EnzymeProductInterface &enzyme_product, std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const PeptideStr &peptide, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) const
Definition enzyme.cpp:271
pappso::Enzyme::getQRegExpRecognitionSite
const QRegularExpression & getQRegExpRecognitionSite() const
Definition enzyme.cpp:348
pappso::Enzyme::replaceWildcards
void replaceWildcards(std::vector< std::string > *p_peptide_variant_list) const
Definition enzyme.cpp:192
pappso::Enzyme::setTakeOnlyFirstWildcard
void setTakeOnlyFirstWildcard(bool take_only_first_wildcard)
take only first m_takeOnlyFirstWildcard
Definition enzyme.cpp:264
pappso::Enzyme::eat
void eat(std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, EnzymeProductInterface &enzyme_product) const
digest a protein into enzyme products
Definition enzyme.cpp:87
pappso::Enzyme::m_miscleavage
unsigned int m_miscleavage
Definition enzyme.h:90
pappso::Enzyme::m_takeOnlyFirstWildcard
bool m_takeOnlyFirstWildcard
Definition enzyme.h:91
pappso::Enzyme::setMaxPeptideVariantListSize
void setMaxPeptideVariantListSize(std::size_t max_peptide_variant_list_size)
if there are wildcards in the protein sequence : restrict the number of possible peptide sequences
Definition enzyme.cpp:81
enzymeproductinterface.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::PeptideStr
QString PeptideStr
A type definition for PeptideStr.
Definition types.h:55
pappso::ProteinSp
std::shared_ptr< const Protein > ProteinSp
shared pointer on a Protein object
Definition protein.h:47