libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::Protein Class Reference

#include <protein.h>

Public Member Functions

 Protein ()
 
 Protein (const QString &description, const QString &sequence)
 
 Protein (const Protein &protein)
 
virtual ~Protein ()
 
ProteinSp makeProteinSp () const
 
bool operator== (const Protein &other) const
 
const QString & getSequence () const
 
void setSequence (const QString &sequence)
 
const QString & getAccession () const
 
virtual void setAccession (const QString &accession)
 
const QString & getDescription () const
 
void setDescription (const QString &description)
 
ProteinremoveTranslationStop ()
 remove * characters at the end of the sequence
 
Proteinreverse ()
 reverse characters in the sequence
 
unsigned int size () const
 protein amino acid sequence size
 
pappso_double getMass () const
 get monoisotopic mass of ProteinSp Protein::makeProteinSp() const
 

Private Attributes

QString m_description
 free text to describe the protein
 
QString m_accession
 a single unique identifier of the protein (usually the first word of description)
 
QString m_sequence
 the amino acid sequence
 
unsigned int m_length = 0
 number of amino acid
 

Static Private Attributes

static QRegularExpression m_removeTranslationStopRegExp
 

Detailed Description

Definition at line 49 of file protein.h.

Constructor & Destructor Documentation

◆ Protein() [1/3]

pappso::Protein::Protein ( )

Definition at line 62 of file protein.cpp.

63{
64}

◆ Protein() [2/3]

pappso::Protein::Protein ( const QString & description,
const QString & sequence )

Definition at line 65 of file protein.cpp.

66 : m_description(description.simplified()),
67 m_accession(m_description.split(" ").at(0)),
68 m_sequence(sequence)
69{
70 m_description = m_description.remove(0, m_accession.size()).simplified();
71 // m_sequence.replace(m_removeTranslationStopRegExp, "");
72 m_length = m_sequence.size();
73}
unsigned int m_length
number of amino acid
Definition protein.h:98
QString m_sequence
the amino acid sequence
Definition protein.h:96
QString m_accession
a single unique identifier of the protein (usually the first word of description)
Definition protein.h:94
QString m_description
free text to describe the protein
Definition protein.h:91

References m_accession, m_description, m_length, and m_sequence.

◆ Protein() [3/3]

pappso::Protein::Protein ( const Protein & protein)

Definition at line 74 of file protein.cpp.

75 : m_description(protein.m_description),
76 m_accession(protein.m_accession),
77 m_sequence(protein.m_sequence),
78 m_length(protein.m_length)
79{
80}

◆ ~Protein()

pappso::Protein::~Protein ( )
virtual

Definition at line 146 of file protein.cpp.

147{
148}

Member Function Documentation

◆ getAccession()

const QString & pappso::Protein::getAccession ( ) const

Definition at line 127 of file protein.cpp.

128{
129 return m_accession;
130}

References m_accession.

Referenced by getMass(), pappso::MzIdentMlWriter::writeDBSequence(), and pappso::FastaOutputStream::writeProtein().

◆ getDescription()

const QString & pappso::Protein::getDescription ( ) const

Definition at line 137 of file protein.cpp.

138{
139 return m_description;
140}

References m_description.

Referenced by pappso::MzIdentMlWriter::writeDBSequence(), and pappso::FastaOutputStream::writeProtein().

◆ getMass()

pappso_double pappso::Protein::getMass ( ) const

get monoisotopic mass of ProteinSp Protein::makeProteinSp() const

Definition at line 150 of file protein.cpp.

151{
152 try
153 {
154 // qDebug() << "ProteinXtp::getMass() begin " <<
155 // getOnlyAminoAcidSequence().replace("[BZX]","E");
156 // replace amino acid wildcard by E, just to give an random mass (assumed
157 // it is not perfect)
158 QString sequence(m_sequence);
159 sequence.replace(QRegularExpression("[^WGASPVTLINDKQEMHFRCYUBZX]"), "");
160 pappso::Peptide peptide(
161 sequence.replace(QRegularExpression("[BZX]"), "E"));
162 return peptide.getMass();
163 }
164 catch(pappso::PappsoException &error)
165 {
167 QObject::tr("Error computing mass for protein %1 :\n%2")
168 .arg(getAccession())
169 .arg(error.qwhat()));
170 }
171}
virtual const QString & qwhat() const
const QString & getAccession() const
Definition protein.cpp:127

References getAccession(), pappso::Peptide::getMass(), m_sequence, and pappso::PappsoException::qwhat().

◆ getSequence()

const QString & pappso::Protein::getSequence ( ) const

◆ makeProteinSp()

ProteinSp pappso::Protein::makeProteinSp ( ) const

Definition at line 97 of file protein.cpp.

98{
99 return std::make_shared<Protein>(*this);
100}

◆ operator==()

bool pappso::Protein::operator== ( const Protein & other) const

Definition at line 104 of file protein.cpp.

105{
106 return (m_accession == other.m_accession);
107}

References m_accession.

◆ removeTranslationStop()

Protein & pappso::Protein::removeTranslationStop ( )

remove * characters at the end of the sequence

Definition at line 83 of file protein.cpp.

84{
86 return (*this);
87}
static QRegularExpression m_removeTranslationStopRegExp
Definition protein.h:100

References m_removeTranslationStopRegExp, and m_sequence.

◆ reverse()

Protein & pappso::Protein::reverse ( )

reverse characters in the sequence

Definition at line 90 of file protein.cpp.

91{
92 std::reverse(m_sequence.begin(), m_sequence.end());
93 return (*this);
94}

References m_sequence.

◆ setAccession()

void pappso::Protein::setAccession ( const QString & accession)
virtual

Definition at line 132 of file protein.cpp.

133{
134 m_accession = accession.simplified();
135}

References m_accession.

◆ setDescription()

void pappso::Protein::setDescription ( const QString & description)

Definition at line 142 of file protein.cpp.

143{
144 m_description = description.simplified();
145}

References m_description.

◆ setSequence()

void pappso::Protein::setSequence ( const QString & sequence)

Definition at line 110 of file protein.cpp.

111{
112 m_sequence = sequence.simplified();
113 m_length = m_sequence.size();
114}

References m_length, and m_sequence.

◆ size()

unsigned int pappso::Protein::size ( ) const

protein amino acid sequence size

Definition at line 116 of file protein.cpp.

117{
118 return m_length;
119}

References m_length.

Referenced by pappso::PeptideFixedModificationBuilder::setPeptideSp().

Member Data Documentation

◆ m_accession

QString pappso::Protein::m_accession
private

a single unique identifier of the protein (usually the first word of description)

Definition at line 94 of file protein.h.

Referenced by Protein(), getAccession(), operator==(), and setAccession().

◆ m_description

QString pappso::Protein::m_description
private

free text to describe the protein

Definition at line 91 of file protein.h.

Referenced by Protein(), getDescription(), and setDescription().

◆ m_length

unsigned int pappso::Protein::m_length = 0
private

number of amino acid

Definition at line 98 of file protein.h.

Referenced by Protein(), setSequence(), and size().

◆ m_removeTranslationStopRegExp

QRegularExpression pappso::Protein::m_removeTranslationStopRegExp
staticprivate

Definition at line 100 of file protein.h.

Referenced by removeTranslationStop().

◆ m_sequence

QString pappso::Protein::m_sequence
private

the amino acid sequence

Definition at line 96 of file protein.h.

Referenced by Protein(), getMass(), getSequence(), removeTranslationStop(), reverse(), and setSequence().


The documentation for this class was generated from the following files: