libpappsomspp
Library for mass spectrometry
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.

154{
155
156 // QMutexLocker locker(&_mutex);
157 Peptide peptide(QString(pepstr).replace(_mod_parser, ""));
159
160 return (peptide.makeNoConstPeptideSp());
161}
static void parseStringToPeptide(const QString &pepstr, Peptide &peptide)
static QRegularExpression _mod_parser

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.

143{
144
145 // QMutexLocker locker(&_mutex);
146 Peptide peptide(QString(pepstr).replace(_mod_parser, ""));
148
149 return (peptide.makePeptideSp());
150}

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

◆ parseStringToPeptide()

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

Definition at line 38 of file peptidestrparser.cpp.

39{
40 // Peptide
41 // peptide2("C(MOD:00397+MOD:01160)C(MOD:00397)AADDKEAC(MOD:00397)FAVEGPK");
42 // CCAADDKEACFAVEGPK
43 /*
44 <psimod position="1" accession="MOD:00397"/>
45 <psimod position="2" accession="MOD:00397"/>
46 <psimod position="10" accession="MOD:00397"/>
47 <psimod position="1" accession="MOD:01160"/>
48 */
49 int matched_length_cumul = 0;
50 int pos = 0;
51
52 QRegularExpressionMatch match_mod = _mod_parser.match(pepstr, pos);
53
54 while(match_mod.hasMatch())
55 {
56 pos = match_mod.capturedStart(0);
57 QString captured = match_mod.captured(0);
58 qDebug() << " captured=" << captured << " pos=" << pos
59 << " match_mod.lastCapturedIndex()="
60 << match_mod.lastCapturedIndex();
61 QStringList mod_list = captured.mid(1, captured.size() - 2)
62 .split(QRegularExpression("[+,\\,]"));
63 for(QString &mod : mod_list)
64 {
65 qDebug() << "PeptideStrParser::parseString mod " << mod;
66 QRegularExpressionMatch match_psimod = _rx_psimod.match(mod);
67 if(match_psimod.hasMatch())
68 {
69 qDebug() << "PeptideStrParser::parseString pos-1 "
70 << (pos - 1 - matched_length_cumul);
71 peptide.addAaModification(AaModification::getInstance(mod),
72 pos - 1 - matched_length_cumul);
73 }
74 else if(mod.startsWith("internal:Nter_"))
75 {
76 peptide.setInternalNterModification(
78 }
79 else if(mod.startsWith("internal:Cter_"))
80 {
81 peptide.setInternalCterModification(
83 }
84 else if(mod.startsWith("C13N15:"))
85 {
86 qDebug() << "PeptideStrParser::parseString pos-1 "
87 << (pos - 1 - matched_length_cumul);
88 peptide.addAaModification(AaModification::getInstance(mod),
89 pos - 1 - matched_length_cumul);
90 }
91 else
92 {
93 qDebug() << "mod=" << mod;
94 QRegularExpressionMatch match_modmass = _rx_modmass.match(mod);
95 if(match_modmass.hasMatch())
96 {
97 // number
98 qDebug() << "number mod=" << mod
99 << " cap=" << match_modmass.captured(0);
100 if(!mod.contains("."))
101 {
102 // integer
103 qDebug() << "integer mod=" << mod;
104 mod = "MOD:0000" + mod;
105 while(mod.size() > 9)
106 {
107 mod = mod.replace(4, 1, "");
108 }
109 peptide.addAaModification(
111 pos - 1 - matched_length_cumul);
112 }
113 else
114 {
115 qDebug() << "double mod=" << mod;
116 peptide.addAaModification(
118 mod.toDouble()),
119 pos - 1 - matched_length_cumul);
120 }
121 }
122 else
123 {
124 qDebug() << "not a number mod=" << mod;
125 FilterOboPsiModSink term_list;
126 FilterOboPsiModTermLabel filter_label(term_list, mod);
127
128 OboPsiMod psimod(filter_label);
129
130 peptide.addAaModification(
131 AaModification::getInstance(term_list.getFirst()),
132 pos - 1 - matched_length_cumul);
133 }
134 }
135 }
136 matched_length_cumul += captured.size();
137 match_mod = _mod_parser.match(pepstr, pos + 1);
138 }
139}
static AaModificationP getInstance(const QString &accession)
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
static QRegularExpression _rx_psimod
static QRegularExpression _rx_modmass

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
staticprivate

Definition at line 42 of file peptidestrparser.h.

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

◆ _rx_modmass

QRegularExpression pappso::PeptideStrParser::_rx_modmass
staticprivate

Definition at line 44 of file peptidestrparser.h.

Referenced by parseStringToPeptide().

◆ _rx_psimod

QRegularExpression pappso::PeptideStrParser::_rx_psimod
staticprivate

Definition at line 43 of file peptidestrparser.h.

Referenced by parseStringToPeptide().


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