31#include <QRegularExpression>
57 : m_accession(accession), m_mass(mass)
77 : m_accession(toCopy.m_accession),
78 m_name(toCopy.m_name),
79 m_mass(toCopy.m_mass),
80 m_atomCount(std::move(toCopy.m_atomCount)),
81 m_mapIsotope(toCopy.m_mapIsotope)
113 QStringList aa_list =
m_accession.mid(9).split(
"=>");
115 return QString(
"%1][%2")
124 return QString(
"+%1").arg(QString::number(
m_mass,
'f', 4));
128 return QString(
"%1").arg(QString::number(
m_mass,
'f', 4));
147 MapAccessionModifications ret;
163 qDebug() <<
"is_a " << term.
m_isA.join(
" ");
164 if(term.
isA(
"MOD:01441"))
166 qDebug() <<
"term.isA(MOD:01441)";
170 QObject::tr(
"origin not found for term : [%1]")
177 qDebug() << new_mod->
m_mass;
184 if(accession ==
"internal:Nter_hydrolytic_cleavage_H")
190 term.
m_name =
"Nter hydrolytic cleavage H+";
193 if(accession ==
"internal:Cter_hydrolytic_cleavage_HO")
199 term.
m_name =
"Cter hydrolytic cleavage HO";
202 if(accession.startsWith(
"MUTATION:"))
204 QRegularExpression regexp_mutation(
"^MUTATION:([A-Z])=>([A-Z])$");
205 QRegularExpressionMatch match = regexp_mutation.match(accession);
208 qDebug() << match.capturedTexts()[1].at(0) <<
" "
209 << match.capturedTexts()[2].at(0);
211 Aa aa_from(match.capturedTexts()[1].toStdString().c_str()[0]);
212 Aa aa_to(match.capturedTexts()[2].toStdString().c_str()[0]);
215 return instance_mutation;
219 if(accession.startsWith(
"C13N15:"))
221 QRegularExpression regexp_label(
"^C13N15:([A-Z])$");
222 QRegularExpressionMatch match = regexp_label.match(accession);
225 char labelled_aa(match.capturedTexts()[1].toStdString().c_str()[0]);
231 return instance_labelled_aa_p;
263 QRegularExpression rx(
"(^|\\s)([C,H,O,N,H,S])\\s([-]{0,1}\\d+)");
264 QRegularExpressionMatchIterator i = rx.globalMatch(diff_formula);
268 QRegularExpressionMatch match = i.next();
270 qDebug() << match.captured(2) <<
" " << match.captured(2) <<
" "
271 << match.captured(3);
273 if(match.captured(2) ==
"C")
277 else if(match.captured(2) ==
"H")
281 else if(match.captured(2) ==
"N")
285 else if(match.captured(2) ==
"O")
289 else if(match.captured(2) ==
"S")
296 rx.setPattern(
"\\(([-]{0,1}\\d+)\\)([C,H,O,N,H,S])\\s([-]{0,1}\\d+)");
298 i = rx.globalMatch(diff_formula);
302 QRegularExpressionMatch match = i.next();
304 qDebug() << match.captured(1) <<
" " << match.captured(2) <<
" "
305 << match.captured(3);
307 int number_of_isotopes = match.captured(3).toInt();
309 if(match.captured(2) ==
"C")
311 if(match.captured(1) ==
"13")
317 else if(match.captured(2) ==
"H")
319 if(match.captured(1) ==
"2")
325 else if(match.captured(2) ==
"N")
327 if(match.captured(1) ==
"15")
333 else if(match.captured(2) ==
"O")
335 if(match.captured(1) ==
"17")
339 else if(match.captured(1) ==
"18")
345 else if(match.captured(2) ==
"S")
347 if(match.captured(1) ==
"33")
351 else if(match.captured(1) ==
"34")
355 else if(match.captured(1) ==
"36")
371 std::map<AtomIsotopeSurvey, int>::const_iterator it_atom =
375 theoreticalm_mass +=
MASSCARBON * (it_atom->second);
380 theoreticalm_mass +=
MPROTIUM * (it_atom->second);
386 theoreticalm_mass +=
MASSOXYGEN * (it_atom->second);
397 theoreticalm_mass +=
MASSSULFUR * (it_atom->second);
400 qDebug() << theoreticalm_mass;
414 m_mass = theoreticalm_mass;
421 m_mass = theoreticalm_mass;
427 <<
"ERROR in AaModification::calculateMassFromChemicalComponents "
429 << theoreticalm_mass <<
" m=" <<
m_mass <<
" diff=" << diff
438 QString accession = QString(
"%1").arg(modificationMass);
439 qDebug() << accession;
461 MapAccessionModifications::iterator it =
467 std::pair<MapAccessionModifications::iterator, bool> insert_res =
469 std::pair<QString, AaModificationP>(
471 it = insert_res.first;
482 QObject::tr(
"ERROR getting instance of : %1 NOT FOUND\n%2")
492 catch(std::exception &e)
503 switch(amino_acid.toLatin1())
600 QObject::tr(
"ERROR getting removal accession instance of amino acid: "
610 switch(amino_acid.toLatin1())
716 QObject::tr(
"ERROR getting removal accession instance of amino acid: "
730 std::pair<MapAccessionModifications::iterator, bool> insert_res =
732 std::pair<QString, AaModificationP>(oboterm.
m_accession,
nullptr));
734 if(!insert_res.second)
746 return insert_res.first->second;
754 unsigned int position)
823 if(peptide_sp.get()->size() == (position + 1))
827 if((position == 0) || isCter)
846 QObject::tr(
"tandem modification not found : %1 %2 %3 %4")
849 .arg(peptide_sp.get()->getSequence())
876 catch(std::exception &e)
879 QObject::tr(
"ERROR in AaModification::getNumberOfIsotope %2")
915 instance_mutation->
m_name = QString(
"mutation from %1 to %2")
918 return instance_mutation;
925 QString accession(QString(
"MUTATION:%1=>%2").arg(mut_from).arg(mut_to));
929 MapAccessionModifications::iterator it =
933 Aa aa_from(mut_from.toLatin1());
934 Aa aa_to(mut_to.toLatin1());
938 std::pair<MapAccessionModifications::iterator, bool> insert_res =
940 std::pair<QString, AaModificationP>(accession,
942 it = insert_res.first;
953 QObject::tr(
"ERROR getting instance of : %1 NOT FOUND\n%2")
963 catch(std::exception &e)
974 switch(from_aa.toLatin1())
990 QString accession(QString(
"C13N15:%1").arg(from_aa));
994 QString diff_formula;
996 switch(from_aa.toLatin1())
999 diff_formula =
"(12)C -2 (13)C 2 (14)N -1 (15)N 1";
1002 diff_formula =
"(12)C -3 (13)C 3 (14)N -1 (15)N 1";
1005 diff_formula =
"(12)C -5 (13)C 5 (14)N -1 (15)N 1";
1008 diff_formula =
"(12)C -6 (13)C 6 (14)N -1 (15)N 1";
1011 diff_formula =
"(12)C -6 (13)C 6 (14)N -1 (15)N 1";
1014 diff_formula =
"(12)C -3 (13)C 3 (14)N -1 (15)N 1";
1017 diff_formula =
"(12)C -4 (13)C 4 (14)N -1 (15)N 1";
1020 diff_formula =
"(12)C -3 (13)C 3 (14)N -1 (15)N 1";
1023 diff_formula =
"(12)C -5 (13)C 5 (14)N -1 (15)N 1";
1026 diff_formula =
"(12)C -4 (13)C 4 (14)N -1 (15)N 1";
1029 diff_formula =
"(12)C -5 (13)C 5 (14)N -1 (15)N 1";
1032 diff_formula =
"(12)C -4 (13)C 4 (14)N -2 (15)N 2";
1035 diff_formula =
"(12)C -5 (13)C 5 (14)N -2 (15)N 2";
1038 diff_formula =
"(12)C -11 (13)C 11 (14)N -2 (15)N 2";
1041 diff_formula =
"(12)C -9 (13)C 9 (14)N -1 (15)N 1";
1044 diff_formula =
"(12)C -6 (13)C 6 (14)N -3 (15)N 3";
1047 diff_formula =
"(12)C -5 (13)C 5 (14)N -1 (15)N 1";
1051 QObject::tr(
"ERROR creating C13N15-labelled amino acid residue %1\n")
1058 obo_psi_term.
m_name = QString(
"Fully C13N15-labelled %1").arg(from_aa);
1061 qDebug() <<
"obo_psi_term.m_diffFormula: " << obo_psi_term.
m_diffFormula;
amino acid modification model
virtual const char & getLetter() const
const QString & getName() const
static AaModificationP getInstanceMutation(const QChar &mut_from, const QChar &mut_to)
get a fake modification coding a mutation from an amino acid to an other
static AaModificationP createInstance(const QString &saccession)
std::map< Isotope, int > m_mapIsotope
const QString & getAccession() const
const QString & getXrefOrigin() const
get list of amino acid on which this modification takes place
static AaModificationP getInstanceXtandemMod(const QString &type, pappso_double mass, const PeptideSp &peptide_sp, unsigned int position)
AaModification(AaModification &&toCopy)
std::map< AtomIsotopeSurvey, int > m_atomCount
int getNumberOfAtom(AtomIsotopeSurvey atom) const override final
get the number of atom C, O, N, H in the molecule
pappso_double getMass() const
void setXrefOrigin(const QString &origin)
set list of amino acid on which this modification takes place
std::map< QString, AaModificationP > MapAccessionModifications
static AaModificationP getInstance(const QString &accession)
static AaModificationP getInstanceRemovalAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the removal of the given amino acid find the modifications th...
static AaModificationP createInstanceC13N15LabelledAminoAcid(const QChar &aa_from)
get heavy amino acid modification C13 N15
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
const QString toProForma() const
get the amino acid in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
static AaModificationP getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the insertion of the given amino acid find the modifications.
const QString m_accession
void setDiffFormula(const QString &diff_formula)
static AaModificationP createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
void calculateMassFromChemicalComponents()
static MapAccessionModifications m_mapAccessionModifications
int getNumberOfIsotope(Isotope isotope) const override final
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
int getNumberOfAtom(AtomIsotopeSurvey atom) const override final
get the number of atom C, O, N, H in the molecule
pappso_double getMass() const override
const OboPsiModTerm & getOne()
bool isA(const QString &accession) const
tells if this term "is_a" another accession
const char * what() const noexcept override
virtual const QString & qwhat() const
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
const pappso_double DIFFS32S33(32.9714589101 - MASSSULFUR)
const pappso_double DIFFS32S34(33.9678670300 - MASSSULFUR)
const pappso_double DIFFO16O17(16.99913150 - MASSOXYGEN)
const pappso_double MASSCARBON(12)
const pappso_double MASSSULFUR(31.9720711741)
std::shared_ptr< const Peptide > PeptideSp
const pappso_double DIFFS32S36(35.9670812000 - MASSSULFUR)
const AaModification * AaModificationP
double pappso_double
A type definition for doubles.
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSNITROGEN(14.0030740048)
const pappso_double MASSOXYGEN(15.99491461956)
const pappso_double DIFFO16O18(17.9991610 - MASSOXYGEN)
const pappso_double DIFFN14N15(15.0001088982 - MASSNITROGEN)
const pappso_double DIFFC12C13(1.0033548378)
const pappso_double DIFFH1H2(2.0141017778 - MPROTIUM)