File: pattern.h

package info (click to toggle)
iqtree 1.6.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,140 kB
  • sloc: cpp: 111,752; ansic: 53,619; python: 242; sh: 195; makefile: 52
file content (97 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// C++ Interface: pattern
//
// Description: 
//
//
// Author: BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef PATTERN_H
#define PATTERN_H

#include <iostream>
#include <string>
#include <vector>
#include <stdint.h>

using namespace std;

const int PAT_CONST       = 1; // const site pattern, e.g. AAAAAA, CC-C-CCCC
const int PAT_INVARIANT   = 2; // invariant site pattern, including const patterns and e.g., GS--G-GGG (S = G/C)
const int PAT_INFORMATIVE = 4; // parsimony informative sites
const int PAT_VARIANT     = 8; // variant site pattern

typedef uint32_t StateType;

/**
	Site-patterns in a multiple sequence alignment
	@author BUI Quang Minh, Steffen Klaere, Arndt von Haeseler <minh.bui@univie.ac.at>
*/
class Pattern : public vector<StateType>
{
public:
	/** 
		constructor
	*/
    Pattern();

    Pattern(const Pattern &pat);

    /**
		@param num_states number of states of the model
		@return the number of ambiguous character incl. gaps 
	*/
	int computeAmbiguousChar(int num_states);

	/**
		@param num_states number of states of the model
		@return the number of gaps 
	*/
	int computeGapChar(int num_states, int STATE_UNKNOWN);

//    Pattern &operator= (Pattern pat);

	/** 
		destructor
	*/
    virtual ~Pattern();

    inline bool isConst() {
        return (flag & PAT_CONST) != 0;
    }

    inline bool isInvariant() {
        return (flag & PAT_INVARIANT) != 0;
    }

    inline bool isInformative() {
        return (flag & PAT_INFORMATIVE) != 0;
    }

	/**
		frequency appearance of the pattern
	*/
	int frequency;

	/**
		true if this is a constant pattern
		2015-03-04: is_const will also be true for pattern like "AA-A--AAA"
	*/
//	bool is_const;
    
    /** true if pattern is informative, false otherwise */
//    bool is_informative;

    int flag;

	/** 2015-03-04: if is_const is true, this will store the const character for the pattern */
	char const_char;

    /** number of different character states */
    int num_chars;
};

#endif