Loading...
Searching...
No Matches
pappso::PeptideStrParser Class Reference

`#include <peptidestrparser.h>`

## Static Public Member Functions

static PeptideSp | parseString (const QString &pepstr)
static NoConstPeptideSp | parseNoConstString (const QString &pepstr)

## Static Private Member Functions

static void | parseStringToPeptide (const QString &pepstr, Peptide &peptide)

## Static Private Attributes

static QRegularExpression | _mod_parser
static QRegularExpression | _rx_psimod
static QRegularExpression | _rx_modmass

## Detailed Description

Definition at line 32 of file peptidestrparser.h.

## Member Function Documentation

## parseNoConstString()

NoConstPeptideSp pappso::PeptideStrParser::parseNoConstString | ( | const QString & | pepstr | ) |

static

Definition at line 153 of file peptidestrparser.cpp.

{
// QMutexLocker locker(&_mutex);
Peptide peptide(QString(pepstr).replace(_mod_parser, ""));
PeptideStrParser::parseStringToPeptide(pepstr, peptide);
return (peptide.makeNoConstPeptideSp());
}
pappso::PeptideStrParser::parseStringToPeptide
static void parseStringToPeptide(const QString &pepstr, Peptide &peptide)
Definition peptidestrparser.cpp:38
pappso::PeptideStrParser::_mod_parser
static QRegularExpression _mod_parser
Definition peptidestrparser.h:42

References _mod_parser, pappso::Peptide::makeNoConstPeptideSp(), and parseStringToPeptide().

## parseString()

PeptideSp pappso::PeptideStrParser::parseString | ( | const QString & | pepstr | ) |

static

Definition at line 142 of file peptidestrparser.cpp.

{
// QMutexLocker locker(&_mutex);
Peptide peptide(QString(pepstr).replace(_mod_parser, ""));
PeptideStrParser::parseStringToPeptide(pepstr, peptide);
return (peptide.makePeptideSp());
}

References _mod_parser, pappso::Peptide::makePeptideSp(), and parseStringToPeptide().

## parseStringToPeptide()

void pappso::PeptideStrParser::parseStringToPeptide | ( | const QString & | pepstr,
|  | Peptide & | peptide
| ) |  |

static private

Definition at line 38 of file peptidestrparser.cpp.

{
// Peptide
// peptide2("C(MOD:00397+MOD:01160)C(MOD:00397)AADDKEAC(MOD:00397)FAVEGPK");
// CCAADDKEACFAVEGPK
/*
<psimod position="1" accession="MOD:00397"/>
<psimod position="2" accession="MOD:00397"/>
<psimod position="10" accession="MOD:00397"/>
<psimod position="1" accession="MOD:01160"/>
*/
int matched_length_cumul = 0;
int pos = 0;
QRegularExpressionMatch match_mod = _mod_parser.match(pepstr, pos);
while(match_mod.hasMatch())
{
pos = match_mod.capturedStart(0);
QString captured = match_mod.captured(0);
qDebug() << " captured=" << captured << " pos=" << pos
<< " match_mod.lastCapturedIndex()="
<< match_mod.lastCapturedIndex();
QStringList mod_list = captured.mid(1, captured.size() - 2)
.split(QRegularExpression("[+,\\,]"));
for(QString &mod : mod_list)
{
qDebug() << "PeptideStrParser::parseString mod " << mod;
QRegularExpressionMatch match_psimod = _rx_psimod.match(mod);
if(match_psimod.hasMatch())
{
qDebug() << "PeptideStrParser::parseString pos-1 "
<< (pos - 1 - matched_length_cumul);
peptide.addAaModification(AaModification::getInstance(mod),
pos - 1 - matched_length_cumul);
}
else if(mod.startsWith("internal:Nter_"))
{
peptide.setInternalNterModification(
AaModification::getInstance(mod));
}
else if(mod.startsWith("internal:Cter_"))
{
peptide.setInternalCterModification(
AaModification::getInstance(mod));
}
else if(mod.startsWith("C13N15:"))
{
qDebug() << "PeptideStrParser::parseString pos-1 "
<< (pos - 1 - matched_length_cumul);
peptide.addAaModification(AaModification::getInstance(mod),
pos - 1 - matched_length_cumul);
}
else
{
qDebug() << "mod=" << mod;
QRegularExpressionMatch match_modmass = _rx_modmass.match(mod);
if(match_modmass.hasMatch())
{
// number
qDebug() << "number mod=" << mod
<< " cap=" << match_modmass.captured(0);
if(!mod.contains("."))
{
// integer
qDebug() << "integer mod=" << mod;
mod = "MOD:0000" + mod;
while(mod.size() > 9)
{
mod = mod.replace(4, 1, "");
}
peptide.addAaModification(
AaModification::getInstance(mod),
pos - 1 - matched_length_cumul);
}
else
{
qDebug() << "double mod=" << mod;
peptide.addAaModification(
AaModification::getInstanceCustomizedMod(
mod.toDouble()),
pos - 1 - matched_length_cumul);
}
}
else
{
qDebug() << "not a number mod=" << mod;
FilterOboPsiModSink term_list;
FilterOboPsiModTermLabel filter_label(term_list, mod);
OboPsiMod psimod(filter_label);
peptide.addAaModification(
AaModification::getInstance(term_list.getFirst()),
pos - 1 - matched_length_cumul);
}
}
}
matched_length_cumul += captured.size();
match_mod = _mod_parser.match(pepstr, pos + 1);
}
}
pappso::AaModification::getInstance
static AaModificationP getInstance(const QString &accession)
Definition aamodification.cpp:456
pappso::AaModification::getInstanceCustomizedMod
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
Definition aamodification.cpp:436
pappso::PeptideStrParser::_rx_psimod
static QRegularExpression _rx_psimod
Definition peptidestrparser.h:43
pappso::PeptideStrParser::_rx_modmass
static QRegularExpression _rx_modmass
Definition peptidestrparser.h:44

References _mod_parser, _rx_modmass, _rx_psimod, pappso::Peptide::addAaModification(), pappso::FilterOboPsiModSink::getFirst(), pappso::AaModification::getInstance(), pappso::AaModification::getInstanceCustomizedMod(), pappso::Peptide::setInternalCterModification(), and pappso::Peptide::setInternalNterModification().

Referenced by parseNoConstString(), and parseString().

## Member Data Documentation

## _mod_parser

QRegularExpression pappso::PeptideStrParser::_mod_parser

static private

Definition at line 42 of file peptidestrparser.h.

Referenced by parseNoConstString(), parseString(), and parseStringToPeptide().

## _rx_modmass

QRegularExpression pappso::PeptideStrParser::_rx_modmass

static private

Definition at line 44 of file peptidestrparser.h.

Referenced by parseStringToPeptide().

## _rx_psimod

QRegularExpression pappso::PeptideStrParser::_rx_psimod

static private

Definition at line 43 of file peptidestrparser.h.

Referenced by parseStringToPeptide().

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

- pappsomspp/peptide/peptidestrparser.h
- pappsomspp/peptide/peptidestrparser.cpp