libpappsomspp
Library for mass spectrometry
pappso::Protein Class Reference

#include <protein.h>

Public Member Functions

 Protein ()
 
 Protein (const QString &description, const QString &sequence)
 
 Protein (const Protein &protein)
 
ProteinSp makeProteinSp () const
 
bool operator== (const Protein &other) const
 
 ~Protein ()
 
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 More...
 
Proteinreverse ()
 reverse characters in the sequence More...
 
unsigned int size () const
 protein amino acid sequence size More...
 
pappso_double getMass () const
 get monoisotopic mass of ProteinSp Protein::makeProteinSp() const More...
 

Private Attributes

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

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:60
QString m_sequence
the amino acid sequence
Definition: protein.h:58
QString m_accession
a single unique identifier of the protein (usually the first word of description)
Definition: protein.h:56
QString m_description
free text to describe the protein
Definition: protein.h:53

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 ( )

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(), 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::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(sequence.replace(QRegularExpression("[BZX]"), "E"));
161  return peptide.getMass();
162  }
163  catch(pappso::PappsoException &error)
164  {
166  QObject::tr("Error computing mass for protein %1 :\n%2")
167  .arg(getAccession())
168  .arg(error.qwhat()));
169  }
170 }
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

Definition at line 122 of file protein.cpp.

123 {
124  return m_sequence;
125 }

References m_sequence.

Referenced by pappso::FastaOutputStream::writeProtein().

◆ 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:62

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.

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 56 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 53 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 60 of file protein.h.

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

◆ m_removeTranslationStopRegExp

QRegularExpression pappso::Protein::m_removeTranslationStopRegExp
staticprivate

Definition at line 62 of file protein.h.

Referenced by removeTranslationStop().

◆ m_sequence

QString pappso::Protein::m_sequence
private

the amino acid sequence

Definition at line 58 of file protein.h.

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


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