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 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 if(accession.startsWith("MUTATION:"))
193 {
194 QRegularExpression regexp_mutation("^MUTATION:([A-Z])=>([A-Z])$");
195 QRegularExpressionMatch match = regexp_mutation.match(accession);
196 if(match.hasMatch())
197 {
198 qDebug() << match.capturedTexts()[1].at(0) << " " << match.capturedTexts()[2].at(0);
199
200 Aa aa_from(match.capturedTexts()[1].toStdString().c_str()[0]);
201 Aa aa_to(match.capturedTexts()[2].toStdString().c_str()[0]);
202 AaModificationP instance_mutation = createInstanceMutation(aa_from, aa_to);
203 return instance_mutation;
204 // m_psiModLabel<<"|";
205 }
206 }
207 if(accession.startsWith("C13N15:"))
208 {
209 QRegularExpression regexp_label("^C13N15:([A-Z])$");
210 QRegularExpressionMatch match = regexp_label.match(accession);
211 if(match.hasMatch())
212 {
213 char labelled_aa(match.capturedTexts()[1].toStdString().c_str()[0]);
214
215 AaModificationP instance_labelled_aa_p =
216 createInstanceC13N15LabelledAminoAcid(QChar(labelled_aa));
217
218
219 return instance_labelled_aa_p;
220 // m_psiModLabel<<"|";
221 }
222 }
223 // initMyResource();
224 FilterOboPsiModSink term_list;
225 FilterOboPsiModTermAccession filterm_accession(term_list, accession);
226
227 OboPsiMod psimod(filterm_accession);
228
229 try
230 {
231 return (AaModification::createInstance(term_list.getOne()));
232 }
233 catch(ExceptionNotFound &e)
234 {
235 pappso::FilterOboPsiModMap obo_unimod_map;
236 pappso::OboUnimod unimod_parser(obo_unimod_map);
237 // OboUnimod unimod(filterm_accession);
238
239 try
240 {
242 obo_unimod_map.getOboPsiModTermWithAccession(accession)));
243 }
244 catch(ExceptionNotFound &e)
245 {
246 try
247 {
248 return (
250 }
251 catch(ExceptionNotFound &e)
252 {
253 throw ExceptionNotFound(
254 QObject::tr("modification not found : [%1]\n%2").arg(accession).arg(e.qwhat()));
255 }
256 }
257 }
258}
259
260void
261AaModification::setXrefOrigin(const QString &origin)
262{
263 // xref: Origin: "N"
264 // xref: Origin: "X"
265 m_origin = origin;
266}
267
268void
270{
271 pappso_double theoreticalm_mass = 0;
272 std::map<Enums::AtomIsotopeSurvey, int>::const_iterator it_atom = m_atomCount.find(Enums::AtomIsotopeSurvey::C);
273 if(it_atom != m_atomCount.end())
274 {
275 theoreticalm_mass += MASSCARBON * (it_atom->second);
276 }
278 if(it_atom != m_atomCount.end())
279 {
280 theoreticalm_mass += MPROTIUM * (it_atom->second);
281 }
282
284 if(it_atom != m_atomCount.end())
285 {
286 theoreticalm_mass += MASSOXYGEN * (it_atom->second);
287 }
288
290 if(it_atom != m_atomCount.end())
291 {
292 theoreticalm_mass += MASSNITROGEN * (it_atom->second);
293 }
295 if(it_atom != m_atomCount.end())
296 {
297 theoreticalm_mass += MASSSULFUR * (it_atom->second);
298 }
299
300 qDebug() << theoreticalm_mass;
301
302 theoreticalm_mass += DIFFC12C13 * m_mapIsotope.at(Enums::Isotope::C13);
303 theoreticalm_mass += DIFFH1H2 * m_mapIsotope.at(Enums::Isotope::H2);
304 theoreticalm_mass += DIFFN14N15 * m_mapIsotope.at(Enums::Isotope::N15);
305 theoreticalm_mass += DIFFO16O17 * m_mapIsotope.at(Enums::Isotope::O17);
306 theoreticalm_mass += DIFFO16O18 * m_mapIsotope.at(Enums::Isotope::O18);
307 theoreticalm_mass += DIFFS32S33 * m_mapIsotope.at(Enums::Isotope::S33);
308 theoreticalm_mass += DIFFS32S34 * m_mapIsotope.at(Enums::Isotope::S34);
309 theoreticalm_mass += DIFFS32S36 * m_mapIsotope.at(Enums::Isotope::S36);
310
311
312 if(m_mass == 0.0)
313 {
314 m_mass = theoreticalm_mass;
315 }
316 else
317 {
318 pappso_double diff = std::fabs((pappso_double)m_mass - theoreticalm_mass);
319 if(diff < 0.001)
320 {
321 m_mass = theoreticalm_mass;
322 qDebug() << diff;
323 }
324 else
325 {
326 qDebug() << "ERROR in AaModification::calculateMassFromChemicalComponents "
327 "theo="
328 << theoreticalm_mass << " m=" << m_mass << " diff=" << diff
329 << " accession=" << m_accession;
330 }
331 }
332}
333
336{
337 QString accession = QString("%1").arg(modificationMass);
338 qDebug() << accession;
339 QMutexLocker locker(&m_mutex);
341 {
342 // not found
343 m_mapAccessionModifications.insert(std::pair<QString, AaModification *>(
344 accession, new AaModification(accession, modificationMass)));
345 }
346 else
347 {
348 // found
349 }
350 return m_mapAccessionModifications.at(accession);
351}
352
354AaModification::getInstance(const QString &accession)
355{
356 try
357 {
358 QMutexLocker locker(&m_mutex);
359 MapAccessionModifications::iterator it = m_mapAccessionModifications.find(accession);
360 if(it == m_mapAccessionModifications.end())
361 {
362
363 // not found
364 std::pair<MapAccessionModifications::iterator, bool> insert_res =
365 m_mapAccessionModifications.insert(std::pair<QString, AaModificationP>(
366 accession, AaModification::createInstance(accession)));
367 it = insert_res.first;
368 }
369 else
370 {
371 // found
372 }
373 return it->second;
374 }
375 catch(ExceptionNotFound &e)
376 {
377 throw ExceptionNotFound(
378 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2").arg(accession).arg(e.qwhat()));
379 }
380 catch(PappsoException &e)
381 {
382 throw PappsoException(
383 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.qwhat()));
384 }
385 catch(std::exception &e)
386 {
387 throw PappsoException(
388 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.what()));
389 }
390}
391
394{
395 switch(amino_acid.toLatin1())
396 {
397 // Enums::AminoAcidChar::alanine
398 case 'A':
399 return getInstance("MOD:01631");
400 break;
401 // Enums::AminoAcidChar::arginine,
402 case 'R':
403 return getInstance("MOD:01632");
404 break;
405 // Enums::AminoAcidChar::cysteine,
406 case 'C':
407 return getInstance("MOD:01635");
408 break;
409 // Enums::AminoAcidChar::aspartic_acid,
410 case 'D':
411 return getInstance("MOD:01634");
412 break;
413 // Enums::AminoAcidChar::glutamic_acid,
414 case 'E':
415 return getInstance("MOD:01636");
416 break;
417
418 // Enums::AminoAcidChar::phenylalanine,
419 case 'F':
420 return getInstance("MOD:01644");
421 break;
422 // Enums::AminoAcidChar::glycine,
423 case 'G':
424 return getInstance("MOD:01638");
425 break;
426 // Enums::AminoAcidChar::histidine,
427 case 'H':
428 return getInstance("MOD:01639");
429 break;
430
431 // Enums::AminoAcidChar::isoleucine,
432 case 'I':
433 return getInstance("MOD:01640");
434 break;
435
436 // Enums::AminoAcidChar::lysine,
437 case 'K':
438 return getInstance("MOD:01642");
439 break;
440 // Enums::AminoAcidChar::leucine,
441 case 'L':
442 return getInstance("MOD:01641");
443 break;
444
445 // Enums::AminoAcidChar::methionine,
446 case 'M':
447 return getInstance("MOD:01643");
448 break;
449
450 // Enums::AminoAcidChar::asparagine,
451 case 'N':
452 return getInstance("MOD:01633");
453 break;
454
455 // Enums::AminoAcidChar::proline,
456 case 'P':
457 return getInstance("MOD:01645");
458 break;
459
460 // Enums::AminoAcidChar::glutamine,
461 case 'Q':
462 return getInstance("MOD:01637");
463 break;
464 // Enums::AminoAcidChar::serine,
465 case 'S':
466 return getInstance("MOD:01646");
467 break;
468
469 // Enums::AminoAcidChar::threonine,
470 case 'T':
471 return getInstance("MOD:01647");
472 break;
473
474
475 // Enums::AminoAcidChar::valine,
476 case 'V':
477 return getInstance("MOD:01650");
478 break;
479
480 // Enums::AminoAcidChar::tryptophan,
481 case 'W':
482 return getInstance("MOD:01648");
483 break;
484
485 // Enums::AminoAcidChar::tyrosine,
486 case 'Y':
487 return getInstance("MOD:01649");
488 break;
489
490 default:
491 throw ExceptionNotFound(
492 QObject::tr("ERROR getting removal accession instance of amino acid: "
493 "%1 NOT FOUND")
494 .arg(amino_acid));
495 }
496}
497
500{
501 pappso::AaModificationP aa_insert = nullptr;
502 switch(amino_acid.toLatin1())
503 {
504 // Enums::AminoAcidChar::alanine
505 case 'A':
506 aa_insert = getInstance("MOD:00010");
507 break;
508
509 // Enums::AminoAcidChar::arginine,
510 case 'R':
511 aa_insert = getInstance("MOD:00011");
512 break;
513
514 // Enums::AminoAcidChar::cysteine,
515 case 'C':
516 aa_insert = getInstance("MOD:00014");
517 break;
518
519 // Enums::AminoAcidChar::aspartic_acid,
520 case 'D':
521 aa_insert = getInstance("MOD:00013");
522 break;
523
524 // Enums::AminoAcidChar::glutamic_acid,
525 case 'E':
526 aa_insert = getInstance("MOD:00015");
527 break;
528
529 // Enums::AminoAcidChar::phenylalanine,
530 case 'F':
531 aa_insert = getInstance("MOD:00023");
532 break;
533
534 // Enums::AminoAcidChar::glycine,
535 case 'G':
536 aa_insert = getInstance("MOD:00017");
537 break;
538
539 // Enums::AminoAcidChar::histidine,
540 case 'H':
541 aa_insert = getInstance("MOD:00018");
542 break;
543
544 // Enums::AminoAcidChar::isoleucine,
545 case 'I':
546 aa_insert = getInstance("MOD:00019");
547 break;
548
549 // Enums::AminoAcidChar::lysine,
550 case 'K':
551 aa_insert = getInstance("MOD:00021");
552 break;
553 // Enums::AminoAcidChar::leucine,
554 case 'L':
555 aa_insert = getInstance("MOD:00020");
556 break;
557
558 // Enums::AminoAcidChar::methionine,
559 case 'M':
560 aa_insert = getInstance("MOD:00022");
561 break;
562
563 // Enums::AminoAcidChar::asparagine,
564 case 'N':
565 aa_insert = getInstance("MOD:00012");
566 break;
567
568 // Enums::AminoAcidChar::proline,
569 case 'P':
570 aa_insert = getInstance("MOD:00024");
571 break;
572
573 // Enums::AminoAcidChar::glutamine,
574 case 'Q':
575 aa_insert = getInstance("MOD:00016");
576 break;
577 // Enums::AminoAcidChar::serine,
578 case 'S':
579 aa_insert = getInstance("MOD:00025");
580 break;
581
582 // Enums::AminoAcidChar::threonine,
583 case 'T':
584 aa_insert = getInstance("MOD:00026");
585 break;
586
587
588 // Enums::AminoAcidChar::valine,
589 case 'V':
590 aa_insert = getInstance("MOD:00029");
591 break;
592
593 // Enums::AminoAcidChar::tryptophan,
594 case 'W':
595 aa_insert = getInstance("MOD:00027");
596 break;
597
598 // Enums::AminoAcidChar::tyrosine,
599 case 'Y':
600 aa_insert = getInstance("MOD:00028");
601 break;
602 // Enums::AminoAcidChar::selenocysteine,
603 case 'U':
604 aa_insert = getInstance("MOD:00031");
605 break;
606 default:
607 throw ExceptionNotFound(
608 QObject::tr("ERROR getting removal accession instance of amino acid: "
609 "%1 NOT FOUND")
610 .arg(amino_acid));
611 }
612
613 return aa_insert;
614}
615
618{
619
620 QMutexLocker locker(&m_mutex);
621
622 std::pair<MapAccessionModifications::iterator, bool> insert_res =
624 std::pair<QString, AaModificationP>(oboterm.getAccession(), nullptr));
625
626 if(!insert_res.second)
627 {
628 // Failed to insert, was there already by same key.
629 }
630 else
631 {
632 // Could insert (albeit with nullptr), was not there already by same key.
633 // Just assign to the *correct* pair member the pointer to an
634 // extemporaneously allocated AaModification.
635 insert_res.first->second = AaModification::createInstance(oboterm);
636 }
637
638 return insert_res.first->second;
639}
640
641
644 pappso_double mass,
645 const PeptideSp &peptide_sp,
646 unsigned int position)
647{
649 if(MzRange(mass, precision).contains(getInstance("MOD:00719")->getMass()))
650 {
651 if(type == "M")
652 {
653 return getInstance("MOD:00719");
654 }
655 if(type == "K")
656 {
657 return getInstance("MOD:01047");
658 }
659 }
660 // accession== "MOD:00057"
661 if(MzRange(mass, precision).contains(getInstance("MOD:00408")->getMass()))
662 {
663 // id: MOD:00394
664 // name: acetylated residue
665 // potential N-terminus modifications
666 if(position == 0)
667 {
668 return getInstance("MOD:00408");
669 }
670 }
671 if(MzRange(mass, precision).contains(getInstance("MOD:01160")->getMass()))
672 {
673 //-17.02655
674 // loss of ammonia [MOD:01160] -17.026549
675 return getInstance("MOD:01160");
676 }
677
678 if(MzRange(mass, precision).contains(getInstance("MOD:01060")->getMass()))
679 {
680 //// iodoacetamide [MOD:00397] 57.021464
681 if(type == "C")
682 {
683 return getInstance("MOD:01060");
684 }
685 else
686 {
687 return getInstance("MOD:00397");
688 }
689 }
690 if(MzRange(mass, precision).contains(getInstance("MOD:00704")->getMass()))
691 {
692 // loss of water
693 /*
694 if (position == 0) {
695 if (peptide_sp.get()->getSequence().startsWith("EG")) {
696 return getInstance("MOD:00365");
697 }
698 if (peptide_sp.get()->getSequence().startsWith("ES")) {
699 return getInstance("MOD:00953");
700 }
701 if (type == "E") {
702 return getInstance("MOD:00420");
703 }
704 }
705 */
706 // dehydrated residue [MOD:00704] -18.010565
707 return getInstance("MOD:00704");
708 }
709 if(MzRange(mass, precision).contains(getInstance("MOD:00696")->getMass()))
710 {
711 // phosphorylated residue [MOD:00696] 79.966330
712 return getInstance("MOD:00696");
713 }
714 bool isCter = false;
715 if(peptide_sp.get()->size() == (position + 1))
716 {
717 isCter = true;
718 }
719 if((position == 0) || isCter)
720 {
721 if(MzRange(mass, precision).contains(getInstance("MOD:00429")->getMass()))
722 {
723 // dimethyl
724 return getInstance("MOD:00429");
725 }
726 if(MzRange(mass, precision).contains(getInstance("MOD:00552")->getMass()))
727 {
728 // 4x(2)H labeled dimethyl residue
729 return getInstance("MOD:00552");
730 }
731 if(MzRange(mass, precision).contains(getInstance("MOD:00638")->getMass()))
732 {
733 // 2x(13)C,6x(2)H-dimethylated arginine
734 return getInstance("MOD:00638");
735 }
736 }
737 throw PappsoException(QObject::tr("tandem modification not found : %1 %2 %3 %4")
738 .arg(type)
739 .arg(mass)
740 .arg(peptide_sp.get()->getSequence())
741 .arg(position));
742}
743
746{
747 return m_mass;
748}
749
750
751int
753{
754 // qDebug() << "AaModification::getNumberOfAtom(Enums::AtomIsotopeSurvey atom) NOT
755 // IMPLEMENTED";
756 return m_atomCount.at(atom);
757}
758
759
760int
762{
763 try
764 {
765 return m_mapIsotope.at(isotope);
766 }
767 catch(std::exception &e)
768 {
769 throw PappsoException(
770 QObject::tr("ERROR in AaModification::getNumberOfIsotope %2").arg(e.what()));
771 }
772}
773
774
775bool
777{
778 if(m_accession.startsWith("internal:"))
779 {
780 return true;
781 }
782 return false;
783}
784
786AaModification::createInstanceMutation(const Aa &aa_from, const Aa &aa_to)
787{
788 QString accession(QString("MUTATION:%1=>%2").arg(aa_from.getLetter()).arg(aa_to.getLetter()));
789 double diffMono = aa_to.getMass() - aa_from.getMass();
790 // not found
791 AaModification *instance_mutation;
792 // qDebug() << " AaModification::createInstance begin";
793 instance_mutation = new AaModification(accession, diffMono);
794 // xref: DiffFormula: "C 0 H 0 N 0 O 1 S 0"
795
796 for(std::int8_t atomInt = (std::int8_t)Enums::AtomIsotopeSurvey::C;
797 atomInt != (std::int8_t)Enums::AtomIsotopeSurvey::last;
798 atomInt++)
799 {
800 Enums::AtomIsotopeSurvey atom = static_cast<Enums::AtomIsotopeSurvey>(atomInt);
801 instance_mutation->m_atomCount[atom] =
802 aa_to.getNumberOfAtom(atom) - aa_from.getNumberOfAtom(atom);
803 }
804 instance_mutation->m_name =
805 QString("mutation from %1 to %2").arg(aa_from.getLetter()).arg(aa_to.getLetter());
806 return instance_mutation;
807}
808
809
811AaModification::getInstanceMutation(const QChar &mut_from, const QChar &mut_to)
812{
813 QString accession(QString("MUTATION:%1=>%2").arg(mut_from).arg(mut_to));
814 try
815 {
816 QMutexLocker locker(&m_mutex);
817 MapAccessionModifications::iterator it = m_mapAccessionModifications.find(accession);
818 if(it == m_mapAccessionModifications.end())
819 {
820 Aa aa_from(mut_from.toLatin1());
821 Aa aa_to(mut_to.toLatin1());
822 AaModificationP instance_mutation = createInstanceMutation(aa_from, aa_to);
823
824 std::pair<MapAccessionModifications::iterator, bool> insert_res =
826 std::pair<QString, AaModificationP>(accession, instance_mutation));
827 it = insert_res.first;
828 }
829 else
830 {
831 // found
832 }
833 return it->second;
834 }
835 catch(ExceptionNotFound &e)
836 {
837 throw ExceptionNotFound(
838 QObject::tr("ERROR getting instance of : %1 NOT FOUND\n%2").arg(accession).arg(e.qwhat()));
839 }
840 catch(PappsoException &e)
841 {
842 throw PappsoException(
843 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.qwhat()));
844 }
845 catch(std::exception &e)
846 {
847 throw PappsoException(
848 QObject::tr("ERROR getting instance of %1\n%2").arg(accession).arg(e.what()));
849 }
850}
851
854{
855 switch(from_aa.toLatin1())
856 {
857 case 'R':
858 return createInstance("MOD:00587");
859 break;
860 case 'K':
861 return createInstance("MOD:00582");
862 break;
863 case 'F':
864 return createInstance("MOD:00589");
865 break;
866 }
867
868 // At this point we have no MOD ontology term for all the other amino-acid
869 // residue, we need to craft the stuff ourselves.
870
871 QString accession(QString("C13N15:%1").arg(from_aa));
872
873 // Define the diff formula for each amino acid code not handled above.
874
875 QString diff_formula;
876
877 switch(from_aa.toLatin1())
878 {
879 case 'G':
880 diff_formula = "(12)C -2 (13)C 2 (14)N -1 (15)N 1";
881 break;
882 case 'A':
883 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
884 break;
885 case 'V':
886 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
887 break;
888 case 'I':
889 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
890 break;
891 case 'L':
892 diff_formula = "(12)C -6 (13)C 6 (14)N -1 (15)N 1";
893 break;
894 case 'S':
895 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
896 break;
897 case 'T':
898 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
899 break;
900 case 'C':
901 diff_formula = "(12)C -3 (13)C 3 (14)N -1 (15)N 1";
902 break;
903 case 'M':
904 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
905 break;
906 case 'D':
907 diff_formula = "(12)C -4 (13)C 4 (14)N -1 (15)N 1";
908 break;
909 case 'E':
910 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
911 break;
912 case 'N':
913 diff_formula = "(12)C -4 (13)C 4 (14)N -2 (15)N 2";
914 break;
915 case 'Q':
916 diff_formula = "(12)C -5 (13)C 5 (14)N -2 (15)N 2";
917 break;
918 case 'W':
919 diff_formula = "(12)C -11 (13)C 11 (14)N -2 (15)N 2";
920 break;
921 case 'Y':
922 diff_formula = "(12)C -9 (13)C 9 (14)N -1 (15)N 1";
923 break;
924 case 'H':
925 diff_formula = "(12)C -6 (13)C 6 (14)N -3 (15)N 3";
926 break;
927 case 'P':
928 diff_formula = "(12)C -5 (13)C 5 (14)N -1 (15)N 1";
929 break;
930 default:
931 throw PappsoException(
932 QObject::tr("ERROR creating C13N15-labelled amino acid residue %1\n").arg(from_aa));
933 }
934
935 OboPsiModTerm obo_psi_term;
936 obo_psi_term.setAccession(accession);
937 obo_psi_term.m_diffFormula = diff_formula;
938 obo_psi_term.m_name = QString("Fully C13N15-labelled %1").arg(from_aa);
939 obo_psi_term.m_diffMono = 0;
940
941 qDebug() << "obo_psi_term.m_diffFormula: " << obo_psi_term.m_diffFormula;
942 return AaModification::createInstance(obo_psi_term);
943}
944
945} // namespace pappso
946
947void
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:61
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)