Skip to content
Snippets Groups Projects
Commit 216373c1 authored by Langella Olivier's avatar Langella Olivier
Browse files

forgotten files added

parent ef9ad66b
No related branches found
No related tags found
No related merge requests found
/**
* \file grouping/ptm/ptminterface.cpp
* \date 15/06/2020
* \author Olivier Langella
* \brief PTM interface
*/
/*******************************************************************************
* Copyright (c) 2020 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "ptminterface.h"
PtmInterface::PtmInterface()
{
}
PtmInterface::PtmInterface(const PtmInterface &other)
{
}
PtmInterface::~PtmInterface()
{
}
/**
* \file grouping/ptm/ptminterface.h
* \date 15/06/2020
* \author Olivier Langella
* \brief PTM interface
*/
/*******************************************************************************
* Copyright (c) 2020 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include <vector>
#include <pappsomspp/amino_acid/aamodification.h>
#include "../../core/peptidematch.h"
#include "../../core/proteinmatch.h"
/**
* @brief Interface to describe a post translational modification
*/
class PtmInterface
{
public:
/**
* Default constructor
*/
PtmInterface();
/**
* Copy constructor
*
* @param other TODO
*/
PtmInterface(const PtmInterface &other);
/**
* Destructor
*/
virtual ~PtmInterface();
virtual std::size_t
countPeptideMatchPtm(const PeptideMatch &peptide_match) const = 0;
virtual std::vector<unsigned int>
getPtmPositions(const PeptideMatch &peptide_match) const = 0;
virtual std::vector<unsigned int>
getPtmPositions(const ProteinMatch *protein_match) const = 0;
protected:
struct ModificationAndAa
{
pappso::AaModificationP modification;
std::vector<char> aa_list;
};
std::vector<ModificationAndAa> m_modificationList;
};
/**
* \file grouping/ptm/ptmphospho.cpp
* \date 15/06/2020
* \author Olivier Langella
* \brief PTM phosphorylation
*/
/*******************************************************************************
* Copyright (c) 2020 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "ptmphospho.h"
PtmPhospho::PtmPhospho()
{
// phospho :
m_modificationList.push_back(
{pappso::AaModification::getInstance("MOD:00696"), {}});
m_modificationList.push_back(
{pappso::AaModification::getInstance("MOD:00704"), {'S', 'T'}});
}
PtmPhospho::~PtmPhospho()
{
}
std::size_t
PtmPhospho::countPeptideMatchPtm(const PeptideMatch &peptide_match) const
{
unsigned int number = 0;
for(const ModificationAndAa &modification : m_modificationList)
{
if(modification.aa_list.size() == 0)
{
number += peptide_match.getPeptideEvidence()
->getPeptideXtpSp()
.get()
->getNumberOfModification(modification.modification);
}
else
{
number += peptide_match.getPeptideEvidence()
->getPeptideXtpSp()
.get()
->countModificationOnAa(modification.modification,
modification.aa_list);
}
}
return number;
}
std::vector<unsigned int>
PtmPhospho::getPtmPositions(const PeptideMatch &peptide_match) const
{
std::vector<unsigned int> position_list;
for(const ModificationAndAa &modification : m_modificationList)
{
if(modification.aa_list.size() == 0)
{
for(unsigned int position :
peptide_match.getPeptideEvidence()
->getPeptideXtpSp()
.get()
->getModificationPositionList(modification.modification))
{
position_list.push_back(position);
}
}
else
{
for(unsigned int position :
peptide_match.getPeptideEvidence()
->getPeptideXtpSp()
.get()
->getModificationPositionList(modification.modification,
modification.aa_list))
{
position_list.push_back(position);
}
}
}
std::sort(position_list.begin(), position_list.end());
auto last = std::unique(position_list.begin(), position_list.end());
position_list.erase(last, position_list.end());
return position_list;
}
std::vector<unsigned int>
PtmPhospho::getPtmPositions(const ProteinMatch *protein_match) const
{
std::vector<unsigned int> position_list;
for(const PeptideMatch &peptide_match :
protein_match->getPeptideMatchList(ValidationState::validAndChecked))
{
unsigned int start = peptide_match.getStart();
std::vector<unsigned int> positionb_list =
this->getPtmPositions(peptide_match);
for(unsigned int position : positionb_list)
{
position_list.push_back(start + position);
}
}
std::sort(position_list.begin(), position_list.end());
auto last = std::unique(position_list.begin(), position_list.end());
position_list.erase(last, position_list.end());
return position_list;
}
/**
* \file grouping/ptm/ptmphospho.h
* \date 15/06/2020
* \author Olivier Langella
* \brief PTM phosphorylation
*/
/*******************************************************************************
* Copyright (c) 2020 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "ptminterface.h"
/**
* @todo write docs
*/
class PtmPhospho : public PtmInterface
{
public:
/**
* Default constructor
*/
PtmPhospho();
/**
* Destructor
*/
~PtmPhospho();
virtual std::size_t
countPeptideMatchPtm(const PeptideMatch &peptide_match) const override;
virtual std::vector<unsigned int>
getPtmPositions(const PeptideMatch &peptide_match) const override;
virtual std::vector<unsigned int>
getPtmPositions(const ProteinMatch *protein_match) const override;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment