libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
aamodification.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/amino_acid/aamodification.h
3 * \date 7/3/2015
4 * \author Olivier Langella
5 * \brief amino acid modification model
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
31#include <QRegularExpression>
32#include <QDebug>
33#include <cmath>
34
39#include "../peptide/peptide.h"
44#include "../obo/obounimod.h"
45
46/*
47
48inline void initMyResource() {
49 Q_INIT_RESOURCE(resources);
50}
51*/
52
53namespace pappso
54{
55
57
77
78
80 : m_accession(toCopy.m_accession),
81 m_name(toCopy.m_name),
82 m_mass(toCopy.m_mass),
83 m_atomCount(std::move(toCopy.m_atomCount)),
85{
86 m_origin = toCopy.m_origin;
87}
88
92
93const QString &
95{
96
97 // qDebug();
98 return m_accession;
99}
100
101
102const QString
104{
105 QString str_return;
106 // qDebug();
107 if(m_accession.startsWith("MOD:"))
108 return m_accession;
109 if(m_accession.startsWith("UNIMOD:"))
110 return m_accession;
111
112 if(m_accession.startsWith("internal:"))
113 return str_return;
114
115 if(m_accession.startsWith("MUTATION:"))
116 {
117 // MUTATION:%1=>%2
118 QStringList aa_list = m_accession.mid(9).split("=>");
119 // first, find removal accession
120 return QString("%1][%2")
121 .arg(getInstanceRemovalAccessionByAaLetter(aa_list[0].at(0))->getAccession())
122 .arg(getInstanceInsertionAccessionByAaLetter(aa_list[1].at(0))->getAccession());
123 }
124
125 if(m_mass > 0)
126 {
127 return QString("+%1").arg(QString::number(m_mass, 'f', 4));
128 }
129 else
130 {
131 return QString("%1").arg(QString::number(m_mass, 'f', 4));
132 }
133 return str_return;
134}
135
136const QString &
138{
139 return m_name;
140}
141
142const QString &
144{
145 return m_origin;
146}
147
149 MapAccessionModifications ret;
150
151 return ret;
152}();
153
156{
157 AaModification *new_mod;
158 // qDebug() << " AaModification::createInstance begin";
159 new_mod = new AaModification(term.getAccession(), term.m_diffMono);
160 // xref: DiffFormula: "C 0 H 0 N 0 O 1 S 0"
162 formula.setOboPsiModTerm(term);
163 new_mod->setDiffFormula(formula);
164 new_mod->setXrefOrigin(term.m_origin);
165 new_mod->m_name = term.m_name;
166
167 qDebug() << new_mod->m_mass;
168 return new_mod;
169}
170
172AaModification::createInstance(const QString &accession)
173{
174 if(accession == "internal:Nter_hydrolytic_cleavage_H")
175 {
176 OboPsiModTerm term;
177 term.setAccession(accession);
178 term.m_diffFormula = "H 1";
179 term.m_diffMono = MPROTIUM;
180 term.m_name = "Nter hydrolytic cleavage H+";
181 return (AaModification::createInstance(term));
182 }
183 else if(accession == "internal:Cter_hydrolytic_cleavage_HO")
184 {
185 OboPsiModTerm term;
186 term.setAccession(accession);
187 term.m_diffFormula = "H 1 O 1";
189 term.m_name = "Cter hydrolytic cleavage HO";
190 return (AaModification::createInstance(term));
191 }
192 else if(accession == "USER:2-Ethynylbenzaldehyde")
193 {
194 // https://pubchem.ncbi.nlm.nih.gov/compound/640368
195 OboPsiModTerm term;
196 term.setAccession(accession);
197 term.m_diffFormula = "H 4 C 9 O 0"; // C9H6O
198 term.m_name = "2-Ethynylbenzaldehyde";
199 ChemicalFormula formula;
200 formula.setOboPsiModTerm(term);
201 term.m_diffMono = formula.getMass();
202
203 return (AaModification::createInstance(term));
204 }
205 else if(accession.startsWith("MUTATION:"))
206 {
207 QRegularExpression regexp_mutation("^MUTATION:([A-Z])=>([A-Z])$");
208 QRegularExpressionMatch match = regexp_mutation.match(accession);
209 if(match.hasMatch())
210 {
211 qDebug() << match.capturedTexts()[1].at(0) << " " << match.capturedTexts()[2].at(0);
212
213 Aa aa_from(match.capturedTexts()[1].toStdString().c_str()[0]);
214 Aa aa_to(match.capturedTexts()[2].toStdString().c_str()[0]);
215 AaModificationP instance_mutation = createInstanceMutation(aa_from, aa_to);
216 return instance_mutation;
217 // m_psiModLabel<<"|";
218 }
219 }
220 else if(accession.startsWith("C13N15:"))
221 {
222 QRegularExpression regexp_label("^C13N15:([A-Z])$");
223 QRegularExpressionMatch match = regexp_label.match(accession);
224 if(match.hasMatch())
225 {
226 char labelled_aa(match.capturedTexts()[1].toStdString().c_str()[0]);
227
228 AaModificationP instance_labelled_aa_p =
229 createInstanceC13N15LabelledAminoAcid(QChar(labelled_aa));
230
231
232 return instance_labelled_aa_p;
233 // m_psiModLabel<<"|";
234 }
235 }
236 // initMyResource();
237 FilterOboPsiModSink term_list;
238 FilterOboPsiModTermAccession filterm_accession(term_list, accession);
239
240 OboPsiMod psimod(filterm_accession);
241
242 try
243 {
244 return (AaModification::createInstance(term_list.getOne()));
245 }
246 catch(ExceptionNotFound &e)
247 {
248 pappso::FilterOboPsiModMap obo_unimod_map;
249 pappso::OboUnimod unimod_parser(obo_unimod_map);
250 // OboUnimod unimod(filterm_accession);
251
252 try
253 {
255 obo_unimod_map.getOboPsiModTermWithAccession(accession)));
256 }
257 catch(ExceptionNotFound &e)
258 {
259 try
260 {
261 return (
263 }
264 catch(ExceptionNotFound &e)
265 {
266 throw ExceptionNotFound(
267 QObject::tr("modification not found : [%1]\n%2").arg(accession).arg(e.qwhat()));
268 }
269 }
270 }
271}
272
273void
274AaModification::setXrefOrigin(const QString &origin)
275{
276 // xref: Origin: "N"
277 // xref: Origin: "X"
278 m_origin = origin;
279}
280
281void
283{
284 pappso_double theoreticalm_mass = 0;
285 std::map<Enums::AtomIsotopeSurvey, int>::const_iterator it_atom =
287 if(it_atom != m_atomCount.end())
288 {
289 theoreticalm_mass += MASSCARBON * (it_atom->second);
290 }
292 if(it_atom != m_atomCount.end())
293 {
294 theoreticalm_mass += MPROTIUM * (it_atom->second);
295 }
296
298 if(it_atom != m_atomCount.end())
299 {
300 theoreticalm_mass += MASSOXYGEN * (it_atom->second);
301 }
302
304 if(it_atom != m_atomCount.end())
305 {
306 theoreticalm_mass += MASSNITROGEN * (it_atom->second);
307 }
309 if(it_atom != m_atomCount.end())
310 {
311 theoreticalm_mass += MASSSULFUR * (it_atom->second);
312 }
313
314 qDebug() << theoreticalm_mass;
315
316 theoreticalm_mass += DIFFC12C13 * m_mapIsotope.at(Enums::Isotope::C13);
317 theoreticalm_mass += DIFFH1H2 * m_mapIsotope.at(Enums::Isotope::H2);
318 theoreticalm_mass += DIFFN14N15 * m_mapIsotope.at(Enums::Isotope::N15);
319 theoreticalm_mass += DIFFO16O17 * m_mapIsotope.at(Enums::Isotope::O17);
320 theoreticalm_mass += DIFFO16O18 * m_mapIsotope.at(Enums::Isotope::O18);
321 theoreticalm_mass += DIFFS32S33 * m_mapIsotope.at(Enums::Isotope::S33);
322 theoreticalm_mass += DIFFS32S34 * m_mapIsotope.at(Enums::Isotope::S34);
323 theoreticalm_mass += DIFFS32S36 * m_mapIsotope.at(Enums::Isotope::S36);
324
325
326 if(m_mass == 0.0)
327 {
328 m_mass = theoreticalm_mass;
329 }
330 else
331 {
332 pappso_double diff = std::fabs((pappso_double)m_mass - theoreticalm_mass);
333 if(diff < 0.001)
334 {
335 m_mass = theoreticalm_mass;
336 qDebug() << diff;
337 }
338 else
339 {
340 qDebug() << "ERROR in AaModification::calculateMassFromChemicalComponents "
341 "theo="
342 << theoreticalm_mass << " m=" << m_mass << " diff=" << diff
343 << " accession=" << m_accession;
344 }
345 }
346}
347
350{
351 QString accession = QString("%1").arg(modificationMass);
352 qDebug() << accession;
353 QMutexLocker locker(&m_mutex);
355 {
356 // not found
357 m_mapAccessionModifications.insert(std::pair<QString, AaModification *>(
358 accession, new AaModification(accession, modificationMass)));
359 }
360 else
361 {
362 // found
363 }
364 return m_mapAccessionModifications.at(accession);
365}
366
368AaModification::getInstance(const QString &accession)
369{
370 try
371 {
372 QMutexLocker locker(&m_mutex);
373 MapAccessionModifications::iterator it = m_mapAccessionModifications.find(accession);
374 if(it == m_mapAccessionModifications.end())
375 {
376
377 // not found
378 std::pair<MapAccessionModifications::iterator, bool> insert_res =
379 m_mapAccessionModifications.insert(std::pair<QString, AaModificationP>(
380 accession, AaModification::createInstance(accession)));
381 it = insert_res.first;
382 }
383 else
384 {
385 // found
386 }
387 return it->second;
388 }
389 catch(ExceptionNotFound &e)
390 {
391 throw ExceptionNotFound(
392 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2").arg(accession).arg(e.qwhat()));
393 }
394 catch(PappsoException &e)
395 {
396 throw PappsoException(
397 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.qwhat()));
398 }
399 catch(std::exception &e)
400 {
401 throw PappsoException(
402 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.what()));
403 }
404}
405
408{
409 switch(amino_acid.toLatin1())
410 {
411 // Enums::AminoAcidChar::alanine
412 case 'A':
413 return getInstance("MOD:01631");
414 break;
415 // Enums::AminoAcidChar::arginine,
416 case 'R':
417 return getInstance("MOD:01632");
418 break;
419 // Enums::AminoAcidChar::cysteine,
420 case 'C':
421 return getInstance("MOD:01635");
422 break;
423 // Enums::AminoAcidChar::aspartic_acid,
424 case 'D':
425 return getInstance("MOD:01634");
426 break;
427 // Enums::AminoAcidChar::glutamic_acid,
428 case 'E':
429 return getInstance("MOD:01636");
430 break;
431
432 // Enums::AminoAcidChar::phenylalanine,
433 case 'F':
434 return getInstance("MOD:01644");
435 break;
436 // Enums::AminoAcidChar::glycine,
437 case 'G':
438 return getInstance("MOD:01638");
439 break;
440 // Enums::AminoAcidChar::histidine,
441 case 'H':
442 return getInstance("MOD:01639");
443 break;
444
445 // Enums::AminoAcidChar::isoleucine,
446 case 'I':
447 return getInstance("MOD:01640");
448 break;
449
450 // Enums::AminoAcidChar::lysine,
451 case 'K':
452 return getInstance("MOD:01642");
453 break;
454 // Enums::AminoAcidChar::leucine,
455 case 'L':
456 return getInstance("MOD:01641");
457 break;
458
459 // Enums::AminoAcidChar::methionine,
460 case 'M':
461 return getInstance("MOD:01643");
462 break;
463
464 // Enums::AminoAcidChar::asparagine,
465 case 'N':
466 return getInstance("MOD:01633");
467 break;
468
469 // Enums::AminoAcidChar::proline,
470 case 'P':
471 return getInstance("MOD:01645");
472 break;
473
474 // Enums::AminoAcidChar::glutamine,
475 case 'Q':
476 return getInstance("MOD:01637");
477 break;
478 // Enums::AminoAcidChar::serine,
479 case 'S':
480 return getInstance("MOD:01646");
481 break;
482
483 // Enums::AminoAcidChar::threonine,
484 case 'T':
485 return getInstance("MOD:01647");
486 break;
487
488
489 // Enums::AminoAcidChar::valine,
490 case 'V':
491 return getInstance("MOD:01650");
492 break;
493
494 // Enums::AminoAcidChar::tryptophan,
495 case 'W':
496 return getInstance("MOD:01648");
497 break;
498
499 // Enums::AminoAcidChar::tyrosine,
500 case 'Y':
501 return getInstance("MOD:01649");
502 break;
503
504 default:
505 throw ExceptionNotFound(
506 QObject::tr("ERROR getting removal accession instance of amino acid: "
507 "%1 NOT FOUND")
508 .arg(amino_acid));
509 }
510}
511
514{
515 pappso::AaModificationP aa_insert = nullptr;
516 switch(amino_acid.toLatin1())
517 {
518 // Enums::AminoAcidChar::alanine
519 case 'A':
520 aa_insert = getInstance("MOD:00010");
521 break;
522
523 // Enums::AminoAcidChar::arginine,
524 case 'R':
525 aa_insert = getInstance("MOD:00011");
526 break;
527
528 // Enums::AminoAcidChar::cysteine,
529 case 'C':
530 aa_insert = getInstance("MOD:00014");
531 break;
532
533 // Enums::AminoAcidChar::aspartic_acid,
534 case 'D':
535 aa_insert = getInstance("MOD:00013");
536 break;
537
538 // Enums::AminoAcidChar::glutamic_acid,
539 case 'E':
540 aa_insert = getInstance("MOD:00015");
541 break;
542
543 // Enums::AminoAcidChar::phenylalanine,
544 case 'F':
545 aa_insert = getInstance("MOD:00023");
546 break;
547
548 // Enums::AminoAcidChar::glycine,
549 case 'G':
550 aa_insert = getInstance("MOD:00017");
551 break;
552
553 // Enums::AminoAcidChar::histidine,
554 case 'H':
555 aa_insert = getInstance("MOD:00018");
556 break;
557
558 // Enums::AminoAcidChar::isoleucine,
559 case 'I':
560 aa_insert = getInstance("MOD:00019");
561 break;
562
563 // Enums::AminoAcidChar::lysine,
564 case 'K':
565 aa_insert = getInstance("MOD:00021");
566 break;
567 // Enums::AminoAcidChar::leucine,
568 case 'L':
569 aa_insert = getInstance("MOD:00020");
570 break;
571
572 // Enums::AminoAcidChar::methionine,
573 case 'M':
574 aa_insert = getInstance("MOD:00022");
575 break;
576
577 // Enums::AminoAcidChar::asparagine,
578 case 'N':
579 aa_insert = getInstance("MOD:00012");
580 break;
581
582 // Enums::AminoAcidChar::proline,
583 case 'P':
584 aa_insert = getInstance("MOD:00024");
585 break;
586
587 // Enums::AminoAcidChar::glutamine,
588 case 'Q':
589 aa_insert = getInstance("MOD:00016");
590 break;
591 // Enums::AminoAcidChar::serine,
592 case 'S':
593 aa_insert = getInstance("MOD:00025");
594 break;
595
596 // Enums::AminoAcidChar::threonine,
597 case 'T':
598 aa_insert = getInstance("MOD:00026");
599 break;
600
601
602 // Enums::AminoAcidChar::valine,
603 case 'V':
604 aa_insert = getInstance("MOD:00029");
605 break;
606
607 // Enums::AminoAcidChar::tryptophan,
608 case 'W':
609 aa_insert = getInstance("MOD:00027");
610 break;
611
612 // Enums::AminoAcidChar::tyrosine,
613 case 'Y':
614 aa_insert = getInstance("MOD:00028");
615 break;
616 // Enums::AminoAcidChar::selenocysteine,
617 case 'U':
618 aa_insert = getInstance("MOD:00031");
619 break;
620 default:
621 throw ExceptionNotFound(
622 QObject::tr("ERROR getting removal accession instance of amino acid: "
623 "%1 NOT FOUND")
624 .arg(amino_acid));
625 }
626
627 return aa_insert;
628}
629
632{
633
634 QMutexLocker locker(&m_mutex);
635
636 std::pair<MapAccessionModifications::iterator, bool> insert_res =
638 std::pair<QString, AaModificationP>(oboterm.getAccession(), nullptr));
639
640 if(!insert_res.second)
641 {
642 // Failed to insert, was there already by same key.
643 }
644 else
645 {
646 // Could insert (albeit with nullptr), was not there already by same key.
647 // Just assign to the *correct* pair member the pointer to an
648 // extemporaneously allocated AaModification.
649 insert_res.first->second = AaModification::createInstance(oboterm);
650 }
651
652 return insert_res.first->second;
653}
654
655
658 pappso_double mass,
659 const PeptideSp &peptide_sp,
660 unsigned int position)
661{
663 if(MzRange(mass, precision).contains(getInstance("MOD:00719")->getMass()))
664 {
665 if(type == "M")
666 {
667 return getInstance("MOD:00719");
668 }
669 if(type == "K")
670 {
671 return getInstance("MOD:01047");
672 }
673 }
674 // accession== "MOD:00057"
675 if(MzRange(mass, precision).contains(getInstance("MOD:00408")->getMass()))
676 {
677 // id: MOD:00394
678 // name: acetylated residue
679 // potential N-terminus modifications
680 if(position == 0)
681 {
682 return getInstance("MOD:00408");
683 }
684 }
685 if(MzRange(mass, precision).contains(getInstance("MOD:01160")->getMass()))
686 {
687 //-17.02655
688 // loss of ammonia [MOD:01160] -17.026549
689 return getInstance("MOD:01160");
690 }
691
692 if(MzRange(mass, precision).contains(getInstance("MOD:01060")->getMass()))
693 {
694 //// iodoacetamide [MOD:00397] 57.021464
695 if(type == "C")
696 {
697 return getInstance("MOD:01060");
698 }
699 else
700 {
701 return getInstance("MOD:00397");
702 }
703 }
704 if(MzRange(mass, precision).contains(getInstance("MOD:00704")->getMass()))
705 {
706 // loss of water
707 /*
708 if (position == 0) {
709 if (peptide_sp.get()->getSequence().startsWith("EG")) {
710 return getInstance("MOD:00365");
711 }
712 if (peptide_sp.get()->getSequence().startsWith("ES")) {
713 return getInstance("MOD:00953");
714 }
715 if (type == "E") {
716 return getInstance("MOD:00420");
717 }
718 }
719 */
720 // dehydrated residue [MOD:00704] -18.010565
721 return getInstance("MOD:00704");
722 }
723 if(MzRange(mass, precision).contains(getInstance("MOD:00696")->getMass()))
724 {
725 // phosphorylated residue [MOD:00696] 79.966330
726 return getInstance("MOD:00696");
727 }
728 bool isCter = false;
729 if(peptide_sp.get()->size() == (position + 1))
730 {
731 isCter = true;
732 }
733 if((position == 0) || isCter)
734 {
735 if(MzRange(mass, precision).contains(getInstance("MOD:00429")->getMass()))
736 {
737 // dimethyl
738 return getInstance("MOD:00429");
739 }
740 if(MzRange(mass, precision).contains(getInstance("MOD:00552")->getMass()))
741 {
742 // 4x(2)H labeled dimethyl residue
743 return getInstance("MOD:00552");
744 }
745 if(MzRange(mass, precision).contains(getInstance("MOD:00638")->getMass()))
746 {
747 // 2x(13)C,6x(2)H-dimethylated arginine
748 return getInstance("MOD:00638");
749 }
750 }
751 throw PappsoException(QObject::tr("tandem modification not found : %1 %2 %3 %4")
752 .arg(type)
753 .arg(mass)
754 .arg(peptide_sp.get()->getSequence())
755 .arg(position));
756}
757
760{
761 return m_mass;
762}
763
764
765int
767{
768 // qDebug() << "AaModification::getNumberOfAtom(Enums::AtomIsotopeSurvey atom) NOT
769 // IMPLEMENTED";
770 return m_atomCount.at(atom);
771}
772
773
774int
776{
777 try
778 {
779 return m_mapIsotope.at(isotope);
780 }
781 catch(std::exception &e)
782 {
783 throw PappsoException(
784 QObject::tr("ERROR in AaModification::getNumberOfIsotope %2").arg(e.what()));
785 }
786}
787
788
789bool
791{
792 if(m_accession.startsWith("internal:"))
793 {
794 return true;
795 }
796 return false;
797}
798
800AaModification::createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
801{
802 QString accession(QString("MUTATION:%1=>%2").arg(aa_from.getLetter()).arg(aa_to.getLetter()));
803 double diffMono = aa_to.getMass() - aa_from.getMass();
804 // not found
805 AaModification *instance_mutation;
806 // qDebug() << " AaModification::createInstance begin";
807 instance_mutation = new AaModification(accession, diffMono);
808 // xref: DiffFormula: "C 0 H 0 N 0 O 1 S 0"
809
810 for(std::int8_t atomInt = (std::int8_t)Enums::AtomIsotopeSurvey::C;
811 atomInt != (std::int8_t)Enums::AtomIsotopeSurvey::last;
812 atomInt++)
813 {
814 Enums::AtomIsotopeSurvey atom = static_cast<Enums::AtomIsotopeSurvey>(atomInt);
815 instance_mutation->m_atomCount[atom] =
816 aa_to.getNumberOfAtom(atom) - aa_from.getNumberOfAtom(atom);
817 }
818 instance_mutation->m_name =
819 QString("mutation from %1 to %2").arg(aa_from.getLetter()).arg(aa_to.getLetter());
820 return instance_mutation;
821}
822
823
825AaModification::getInstanceMutation(const QChar &mut_from, const QChar &mut_to)
826{
827 QString accession(QString("MUTATION:%1=>%2").arg(mut_from).arg(mut_to));
828 try
829 {
830 QMutexLocker locker(&m_mutex);
831 MapAccessionModifications::iterator it = m_mapAccessionModifications.find(accession);
832 if(it == m_mapAccessionModifications.end())
833 {
834 Aa aa_from(mut_from.toLatin1());
835 Aa aa_to(mut_to.toLatin1());
836 AaModificationP instance_mutation = createInstanceMutation(aa_from, aa_to);
837
838 std::pair<MapAccessionModifications::iterator, bool> insert_res =
840 std::pair<QString, AaModificationP>(accession, instance_mutation));
841 it = insert_res.first;
842 }
843 else
844 {
845 // found
846 }
847 return it->second;
848 }
849 catch(ExceptionNotFound &e)
850 {
851 throw ExceptionNotFound(
852 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2").arg(accession).arg(e.qwhat()));
853 }
854 catch(PappsoException &e)
855 {
856 throw PappsoException(
857 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.qwhat()));
858 }
859 catch(std::exception &e)
860 {
861 throw PappsoException(
862 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.what()));
863 }
864}
865
868{
869 switch(from_aa.toLatin1())
870 {
871 case 'R':
872 return createInstance("MOD:00587");
873 break;
874 case 'K':
875 return createInstance("MOD:00582");
876 break;
877 case 'F':
878 return createInstance("MOD:00589");
879 break;
880 }
881
882 // At this point we have no MOD ontology term for all the other amino-acid
883 // residue, we need to craft the stuff ourselves.
884
885 QString accession(QString("C13N15:%1").arg(from_aa));
886
887 // Define the diff formula for each amino acid code not handled above.
888
889 QString diff_formula;
890
891 switch(from_aa.toLatin1())
892 {
893 case 'G':
894 diff_formula = "(12)C -2 (13)C 2 (14)N -1 (15)N 1";
895 break;
896 case 'A':
897 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
898 break;
899 case 'V':
900 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
901 break;
902 case 'I':
903 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
904 break;
905 case 'L':
906 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
907 break;
908 case 'S':
909 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
910 break;
911 case 'T':
912 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
913 break;
914 case 'C':
915 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
916 break;
917 case 'M':
918 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
919 break;
920 case 'D':
921 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
922 break;
923 case 'E':
924 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
925 break;
926 case 'N':
927 diff_formula = "(12)C -4 (13)C 4 (14)N -2 (15)N 2";
928 break;
929 case 'Q':
930 diff_formula = "(12)C -5 (13)C 5 (14)N -2 (15)N 2";
931 break;
932 case 'W':
933 diff_formula = "(12)C -11 (13)C 11 (14)N -2 (15)N 2";
934 break;
935 case 'Y':
936 diff_formula = "(12)C -9 (13)C 9 (14)N -1 (15)N 1";
937 break;
938 case 'H':
939 diff_formula = "(12)C -6 (13)C 6 (14)N -3 (15)N 3";
940 break;
941 case 'P':
942 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
943 break;
944 default:
945 throw PappsoException(
946 QObject::tr("ERROR creating C13N15-labelled amino acid residue %1\n").arg(from_aa));
947 }
948
949 OboPsiModTerm obo_psi_term;
950 obo_psi_term.setAccession(accession);
951 obo_psi_term.m_diffFormula = diff_formula;
952 obo_psi_term.m_name = QString("Fully C13N15-labelled %1").arg(from_aa);
953 obo_psi_term.m_diffMono = 0;
954
955 qDebug() << "obo_psi_term.m_diffFormula: " << obo_psi_term.m_diffFormula;
956 return AaModification::createInstance(obo_psi_term);
957}
958
959} // namespace pappso
960
961void
virtual const char & getLetter() const
Definition aabase.cpp:403
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
int getNumberOfIsotope(Enums::Isotope isotope) const override final
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
std::map< Enums::Isotope, int > m_mapIsotope
void setDiffFormula(const pappso::ChemicalFormula &diff_formula)
static AaModificationP createInstance(const QString &saccession)
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)
pappso_double getMass() const
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override final
get the number of atom C, O, N, H in the molecule
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.
static AaModificationP createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
static MapAccessionModifications m_mapAccessionModifications
std::map< Enums::AtomIsotopeSurvey, int > m_atomCount
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override final
get the number of atom C, O, N, H in the molecule
Definition aa.cpp:206
pappso_double getMass() const override
Definition aa.cpp:90
int getNumberOfIsotope(Enums::Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
void setOboPsiModTerm(const OboPsiModTerm &term)
get formula from an Obo term
int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const
const OboPsiModTerm & getOboPsiModTermWithName(const QString &name) const
get the first occurence of term with this name
const OboPsiModTerm & getOne()
void setAccession(const QString &accession)
const QString & getAccession() const
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...
Definition aa.cpp:39
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.
Definition types.h:60
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 PrecisionBase * PrecisionPtr
Definition precision.h:122
const pappso_double DIFFN14N15(15.0001088982 - MASSNITROGEN)
const pappso_double DIFFC12C13(1.0033548378)
const pappso_double DIFFH1H2(2.0141017778 - MPROTIUM)