1 // 2 // C++ Interface: pattern 3 // 4 // Description: 5 // 6 // 7 // Author: BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>, (C) 2008 8 // 9 // Copyright: See COPYING file that comes with this distribution 10 // 11 // 12 #ifndef PATTERN_H 13 #define PATTERN_H 14 15 #include "phylo-yaml/statespace.h" 16 17 using namespace std; 18 using namespace PML; 19 20 const int PAT_CONST = 1; // const site pattern, e.g. AAAAAA, CC-C-CCCC 21 const int PAT_INVARIANT = 2; // invariant site pattern, including const patterns and e.g., GS--G-GGG (S = G/C) 22 const int PAT_INFORMATIVE = 4; // parsimony informative sites 23 const int PAT_VARIANT = 8; // variant site pattern 24 25 /** 26 Site-patterns in a multiple sequence alignment 27 @author BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at> 28 */ 29 class Pattern : public vector<StateType> 30 { 31 public: 32 /** 33 constructor 34 */ 35 Pattern(); 36 37 /** 38 constructor 39 */ 40 Pattern(int nseq, int freq = 1); 41 42 Pattern(const Pattern &pat); 43 44 /** 45 @param num_states number of states of the model 46 @return the number of ambiguous character incl. gaps 47 */ 48 int computeAmbiguousChar(int num_states); 49 50 /** 51 @param num_states number of states of the model 52 @return the number of gaps 53 */ 54 int computeGapChar(int num_states, int STATE_UNKNOWN); 55 56 // Pattern &operator= (Pattern pat); 57 58 /** 59 destructor 60 */ 61 virtual ~Pattern(); 62 isConst()63 inline bool isConst() { 64 return (flag & PAT_CONST) != 0; 65 } 66 isInvariant()67 inline bool isInvariant() { 68 return (flag & PAT_INVARIANT) != 0; 69 } 70 isInformative()71 inline bool isInformative() { 72 return (flag & PAT_INFORMATIVE) != 0; 73 } 74 75 /** 76 frequency appearance of the pattern 77 */ 78 int frequency; 79 80 /** 81 true if this is a constant pattern 82 2015-03-04: is_const will also be true for pattern like "AA-A--AAA" 83 */ 84 // bool is_const; 85 86 /** true if pattern is informative, false otherwise */ 87 // bool is_informative; 88 89 int flag; 90 91 /** 2015-03-04: if is_const is true, this will store the const character for the pattern */ 92 char const_char; 93 94 /** number of different character states */ 95 int num_chars; 96 }; 97 98 #endif 99