/* Copyright by Matthias Hoechsmann (C) 2002-2004 ===================================== You may use, copy and distribute this file freely as long as you - do not change the file, - leave this copyright notice in the file, - do not make any profit with the distribution of this file - give credit where credit is due You are not allowed to copy or distribute this file otherwise The commercial usage and distribution of this file is prohibited Please report bugs and suggestions to */ #ifndef _RNA_PROFILE_ALIGNMENT_H #define _RNA_PROFILE_ALIGNMENT_H #include #include #include #include "alignment.h" #include "matrix.h" #include "ppforestali.h" #include "rna_algebra.h" #include "types.h" //#include "alignment.t.cpp" using namespace std; class RNAProfileAlignment : public PPForestAli { public: // typedef typename PPForestAli::size_type size_type; struct SquigglePlotOptions { bool hideBaseNumbers; Uint baseNumInterval; bool greyColors; bool mostLikelySequence; double minPairProb; }; struct BaseProbs { double a; double c; double g; double u; double gap; double base; }; private: string m_name; Uint m_numStructures; Uint m_numStructuresX; Uint m_numStructuresY; deque m_strNames; bool hasSequence; void makeRepLabel(size_type node, RNA_Alphabet_Profile a, RNA_Alphabet_Profile b); void makeDelLabel(size_type node, RNA_Alphabet_Profile a); void makeInsLabel(size_type node, RNA_Alphabet_Profile b); void showLabel(ostream &s,RNA_Alphabet_Profile p) const; void makeLabel(RNA_Alphabet_Profile &a,char c); /** Build forest from structure, sequence pair. */ void buildForest(const string &baseStr, const string &viennaStr, bool use_bp_prob=false); void getStructureAlignmentFromCSF(string &s, deque &pairprop, double t,size_type i, size_type j) const; double bestPairs(size_type node) const; void drawBaseCircles(int device_id,const BaseProbs &bp,double center_x,double center_y) const; double getMlBaseFreq(const BaseProbs &baseprobs) const; char getMlBase(const BaseProbs &bp) const; void getSeqAli(string &seq,Uint row,Uint i,Uint j) const; void getStructAli(string &str,Uint row) const; void makePairTable(map &pairs, Uint row) const; void filterConsensus(string &structure, deque &pairprob, deque &baseprobs, double minFreq) const; void addStrName(const string &strName) {m_strNames.push_back(strName);}; inline bool isBase(size_type node) const { if(label(node).p[ALPHA_PRO_BASE] > 0) return true; else return false; }; inline bool isPair(size_type node) const {return !isBase(node);}; public: RNAProfileAlignment(const string &baseStr, const string &viennaStr, const string &name); RNAProfileAlignment(const string &baseStr, const string &constraint, const string &name, double t); RNAProfileAlignment(const string &filename); void printSeqAli() const; deque > getSeqAli() const; deque getStrAli() const; string getConsSeq() const; string getConsStr(double minPairProb) const; deque getBaseProb() const; //deque,double> > getPairProb(double minPairProb); void getPairProb(double &minPairProb, deque,double> > &pairprobs); void printStrAli() const; void printConsensus(double minPairProb) const; void printFastaAli(bool noStructure=false) const; void squigglePlot(const string &filename, SquigglePlotOptions &options) const; void getSequenceAlignment(deque &baseprob) const; void getStructureAlignment(double t, string &s, deque &pairprob) const; string getName() const {return m_name;}; void setName(const string &name) {m_name=name;}; Uint getNumStructures() const {return m_numStructures;}; const deque& getStrNames() const {return m_strNames;}; void addStrNames(const deque& strNames); void save(const string &filename); RNAProfileAlignment(Uint numStructuresX,Uint numStructuresY) : PPForestAli(), m_numStructures(numStructuresX + numStructuresY), m_numStructuresX(numStructuresX), m_numStructuresY(numStructuresY){}; }; /* class Profile_RNA_Alignment: public Alignment { private: string m_name; public: Profile_RNA_Alignment(const RNAProfileForest *ppfx, const RNAProfileForest *ppfy, const DoubleScoreProfileAlgebraType &alg) : Alignment((const PPForest*)ppfx,(const PPForest*)ppfy,alg) { m_name=ppfx->getName(); m_name+="."; m_name+=ppfy->getName(); }; string getName() const {return m_name;}; };*/ #endif