solinteraction.h 3.97 KB
#ifndef DEF_HSOLINT
#define DEF_HSOLINT

#include <vector>

#include "rna.h"
#include "interaction.h"
#include "Motifs/pseudoknot.h"
#include "Motifs/helix.h"

typedef struct helixI{
        std::pair<int,int> pos_start;
        std::pair<int,int> pos_end;
        std::vector< helixI * > crossingHelixs; //redundance in some other helixs DO NOT DELETE FROM HERE
}helixI;


class SolInteraction
{

public:

    SolInteraction(const unsigned int rna1, const unsigned int rna2, const std::string &seq1, const std::string &seq2);

    SolInteraction(const unsigned int rna1, const unsigned int rna2, const std::string &seq1, const std::string &seq2,
                   const std::vector < std::pair < unsigned int, unsigned int > > &listBp,
                   const int ct, const unsigned int nbCt, const unsigned int id, unsigned int energyModel, float energy,
                   const std::vector < float > &probingDataRna1, const std::vector < float > &probingDataRna2,
                   float lowerThresProbing, float upperThresProbing);

    SolInteraction(const SolInteraction& that);

    SolInteraction();

    ~SolInteraction();

    unsigned int get_rna1_() const;

    unsigned int get_rna2_() const;

    std::string get_seq1_() const;

    std::string get_seq2_() const;

    std::vector < std::pair < unsigned int, unsigned int > > get_listBp_() const;

    float get_score_() const;

    unsigned int get_id_() const;

    int get_ct_() const;

    float get_ic_() const;

    unsigned int get_nbCt_() const;

    std::vector < Motif * > get_motifs_() const;

    float get_probing_() const;

    void set_id_(unsigned int id);

    void set_score_(float score);

    void set_listBp_(const std::vector < std::pair < unsigned int, unsigned int > > &listBp);

    void set_nbCt_(unsigned int nbCt);

    void set_ct_(int ct);

    void set_ic_(float ic);

    void set_probing_(float probing);

    std::string convToDP() const;

    std::string convToDPInvert() const;

    std::string to_string() const;

    std::string to_Json() const;

    SolInteraction& operator=(const SolInteraction& that);

    bool operator<(const SolInteraction& s);

    bool operator<(const SolInteraction& s) const;

    bool operator>(const SolInteraction& s);

    bool operator>(const SolInteraction& s) const;

    bool operator<=(const SolInteraction& s);

    bool operator<=(const SolInteraction& s) const;

    bool operator>=(const SolInteraction& s);

    bool operator>=(const SolInteraction& s) const;

    bool operator==(const SolInteraction& s);

    bool operator==(const SolInteraction& s) const;

    static std::vector < std::pair < unsigned int, unsigned int > > convToBP(std::string structure);

    std::string convToDPRnaEval();

    static bool checkStructure(std::string structure);

    static bool checkListBp(std::string seq1, std::string seq2, std::vector < std::pair < unsigned int, unsigned int > > listBp);

private:

    void computeEnergy();

    static int type(std::string bp);

    std::string convToNUPACK() const;

    void computeEnergyNUPACK();

    void computeEnergyVienna();

    void computeProbing(const std::vector < float > &probingDataRna1, const std::vector < float > &probingDataRna2, float lowerThresProbing, float upperThresProbing);

    std::vector < Motif * > readTree(helixI *tmp);

    void motifDetection();

    unsigned int rna1_;

    unsigned int rna2_;

    std::string seq1_;

    std::string seq2_;

    std::vector < std::pair < unsigned int, unsigned int > > listBp_; // ( id bp RNA 1, id bp RNA 2) paired

    float score_; // energy

    float probing_; // probing data score

    int ct_; // confidence Index of the complete solInteraction given in the interaction file

    float ic_; // confidence Index containing ct_ and the constraint from the constraint file, used for clique problem

    unsigned int nbCt_; // Number of user constraint the solInteraction corresponds

    unsigned int id_; // id amond the suboptimal solution SolInteraction vector

    std::vector < Motif * > motifs_;
};

#endif