Skip to content
Snippets Groups Projects
proteinxtp.h 2.57 KiB
Newer Older

/*******************************************************************************
* Copyright (c) 2017 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/>.
*
* Contributors:
*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/

#include <pappsomspp/protein/protein.h>
#include <pappsomspp/types.h>
#include <list>
#include "sequencedatabase.h"
#include "../utils/types.h"

#ifndef PROTEIN_XTP_H
#define PROTEIN_XTP_H

Olivier Langella's avatar
Olivier Langella committed
struct DbXref {
    DbXref(ExternalDatabase database_in, const QString & accession_in):database(database), accession(accession_in) {
    };
    ExternalDatabase database;
    QString accession;
};

class ProteinXtp;

/** \brief shared pointer on a Protein object
 */
Olivier Langella's avatar
Olivier Langella committed
typedef std::shared_ptr<ProteinXtp> ProteinXtpSp;

class ProteinXtp : public pappso::Protein {
public:
    ProteinXtp();
    ProteinXtp(const ProteinXtp& other);
    virtual ~ProteinXtp();
    bool operator==(const ProteinXtp& other) const;


    ProteinXtpSp makeProteinXtpSp() const;
    void setCompleteDescription(const QString & full_description);
    
Olivier Langella's avatar
Olivier Langella committed
    void setIsContaminant(bool conta);
    void setIsDecoy(bool conta);
    bool isContaminant() const;
    bool isDecoy() const;
Olivier Langella's avatar
Olivier Langella committed
    unsigned int countTrypticPeptidesForPAI() const;
    
    /** @brief get only amino acid sequence 
     * clean sequence of other characters : * _ ...
     */
    QString getOnlyAminoAcidSequence() const;
    
    /** @brief get protein mass in dalton
     */
    pappso::pappso_double getMass() const;
    
    /** @brief look for external database accessions in accesion text
     */
    void parseAccession2dbxref();
    
Olivier Langella's avatar
Olivier Langella committed
    const std::list<DbXref> & getDbxrefList() const;

private:
    SequenceDatabase * _p_sequence_database;
    bool _is_decoy=false;
    bool _is_contaminant=false;
Olivier Langella's avatar
Olivier Langella committed
    std::list<DbXref> _dbxref_list;
};

#endif // PROTEIN_XTP_H