diff --git a/src/core/peptidextp.cpp b/src/core/peptidextp.cpp index f1a4c51062539e7830a5981531721d2431744955..3a805db00f483037f67be58bfd1af33f4de347ea 100644 --- a/src/core/peptidextp.cpp +++ b/src/core/peptidextp.cpp @@ -23,6 +23,7 @@ #include "peptidextp.h" +#include <QStringList> PeptideXtp::PeptideXtp(const QString & pepstr):pappso::Peptide(pepstr) { @@ -39,11 +40,35 @@ PeptideXtp::~PeptideXtp() } +const QString PeptideXtp::getModifString() const { + QStringList modif_list; + unsigned int i=1; + for (const pappso::Aa & amino_acid:_aa_vec) { + std::list<pappso::AaModificationP> aa_modif_list = amino_acid.getModificationList(); + QStringList aamodif; + for (auto && aa_modif : aa_modif_list) { + if (!aa_modif->isInternal()) { + aamodif << QString::number(aa_modif->getMass(), 'f', 2); + } + } + QString mod_str(aamodif.join("|")); + if (!mod_str.isEmpty()) { + modif_list << QString("%1%2:%3").arg(i).arg(amino_acid.getLetter()).arg(mod_str); + } + i++; + } + //return QString ("%1 %2").arg(modif_list.join(" ")).arg(this->toAbsoluteString()); + return modif_list.join(" "); +} + PeptideXtpSp PeptideXtp::makePeptideXtpSp() const { return std::make_shared<PeptideXtp>(*this); } pappso::mz PeptideXtp::getGroupingMass() const { - return getMass(); + if (_sp_native_peptide.get() == nullptr) { + return getMass(); + } + return _sp_native_peptide.get()->getMass(); } diff --git a/src/core/peptidextp.h b/src/core/peptidextp.h index 4b428681ad5a1d356535934af9e34f36cc8620be..d539a98794ac419471ec4b58b6f85d344848a4e1 100644 --- a/src/core/peptidextp.h +++ b/src/core/peptidextp.h @@ -45,6 +45,16 @@ public: * peptide with taget modification is a light, inter or heavy version of the same peptide */ pappso::mz getGroupingMass() const; + + /** \brief human readable string that contains modifications + * */ + const QString getModifString() const; + +private: + /** \brief if the peptide is tagged, this is the native peptide without tags + */ + pappso::PeptideSp _sp_native_peptide = nullptr; + }; diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index 65e5bbc1c685ff47a427249b6a63c3afe8af1bde..70800841f9962721271f6940f06303a22829a1a2 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -98,7 +98,7 @@ int PeptideTableModel::rowCount(const QModelIndex &parent ) const { return 0; } int PeptideTableModel::columnCount(const QModelIndex &parent ) const { - return 7; + return 8; } QVariant PeptideTableModel::headerData(int section, Qt::Orientation orientation, int role) const { @@ -121,6 +121,8 @@ QVariant PeptideTableModel::headerData(int section, Qt::Orientation orientation, return QString("charge"); case 6: return QString("sequence"); + case 7: + return QString("modifs"); } } } @@ -179,6 +181,9 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const { if (col ==6) { return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getSequence(); } + if (col ==7) { + return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getModifString(); + } } return QString("Row%1, Column%2") .arg(index.row() + 1) diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index 3dd3dae81a413ddf3b61351726022a9e1d9d0a0c..ae2c6cdd8cdd28b6b5a62a6d1f3fb3d808e26065 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -270,8 +270,8 @@ bool XpipSaxHandler::startElement_modif(QXmlAttributes attributes) { //<modifs><modif aa="M" modvalue="15.99491" posi="17" posi_in_prot="49"/> qDebug() << "startElement_modif "; pappso::AaModificationP modif = _map_massstr_aamod[attributes.value("modvalue").simplified()]; - unsigned int position = attributes.value("modvalue").simplified().toUInt(); - _current_peptide_sp.get()->addAaModification(modif, position); + unsigned int position = attributes.value("posi").simplified().toUInt(); + _current_peptide_sp.get()->addAaModification(modif, position-1); qDebug() << "startElement_modif end" ; return true; }