#include <njtree.h>
Public Types | |
| enum | inputformat { MATRIX, NUMTAXON } |
Public Member Functions | |
| njtree () | |
| ~njtree () | |
| bool | load (std::istream &ins, inputformat ipf) |
| bool | load_generic (std::istream &ins) |
| int | taxonCount () const |
| int | remainingCount () const |
| bool | symmetric () |
| void | compute_sums_Sx () |
| void | best_pair (int &a, int &b) const |
| void | reduction (int a, int b) |
| void | finish (std::ostream &ous) |
| void | output (int i, std::ostream &ous) |
Private Member Functions | |
| bool | empty (int i) const |
| double | distance (int i, int j) const |
| double | variance (int i, int j) const |
| double | agglomerative_criterion (int i, int j) const |
| double | branch_length (int a, int b) const |
| double | lamda (int a, int b) const |
| double | reduction4 (int a, double la, int b, double lb, int i, double lam) const |
| double | reduction10 (int a, int b, int i, double lam, double vab) const |
| void | concatenate (const char chn1[], int ind, int post) |
| double | finish_branch_length (int i, int j, int k) const |
| void | clear () |
Private Attributes | |
| double ** | delta |
| int | n |
| int | r |
| wordList * | trees |
Static Private Attributes | |
| static int | PREC = 10 |
| enum njtree::inputformat |
| njtree::njtree | ( | ) | [inline] |
| bool njtree::load | ( | std::istream & | ins, | |
| inputformat | ipf | |||
| ) |
| ins | ifstream opened to a file will allocate dynamic memory; return true if successful the format of the matrix (stored in the file) should be like the following example |
more than one distance data can be stored in one file. This function will read one at a time The fist line contain the number of taxons in the input file The matrix can be square or top triangle.
For the full matrix, the M[i,j] and M[j,i] could be different. this program will use the average for computation.
References clear(), delta, wordList::head, load_generic(), MATRIX, n, word::name, r, wordList::tail, and trees.
Referenced by main().
| bool njtree::load_generic | ( | std::istream & | ins | ) |
this version is more generic than load. It has not requirement for the number of taxons. This function will read from it and count after the read.
Right now it is still reading square matrices.
Delimiters between fields can be spaces or a single tab.
References clear(), delta, wordList::head, n, name, r, wordList::tail, and trees.
| bool njtree::symmetric | ( | ) |
| void njtree::compute_sums_Sx | ( | ) |
| void njtree::best_pair | ( | int & | a, | |
| int & | b | |||
| ) | const |
| void njtree::reduction | ( | int | a, | |
| int | b | |||
| ) |
References branch_length(), concatenate(), delta, distance(), empty(), wordList::head, lamda(), LEN, n, word::next, PRC, PREC, r, wordList::tail, trees, and variance().
Referenced by main().
| void njtree::finish | ( | std::ostream & | ous | ) |
References delta, empty(), finish_branch_length(), wordList::head, LEN, length, n, word::name, word::next, output(), PREC, and trees.
Referenced by main().
| void njtree::output | ( | int | i, | |
| std::ostream & | ous | |||
| ) |
| bool njtree::empty | ( | int | i | ) | const [inline, private] |
References wordList::head, and trees.
Referenced by best_pair(), compute_sums_Sx(), finish(), lamda(), and reduction().
| double njtree::distance | ( | int | i, | |
| int | j | |||
| ) | const [inline, private] |
References delta.
Referenced by agglomerative_criterion(), branch_length(), compute_sums_Sx(), finish_branch_length(), reduction(), and reduction4().
| double njtree::variance | ( | int | i, | |
| int | j | |||
| ) | const [inline, private] |
| double njtree::agglomerative_criterion | ( | int | i, | |
| int | j | |||
| ) | const [inline, private] |
| double njtree::branch_length | ( | int | a, | |
| int | b | |||
| ) | const [inline, private] |
| double njtree::lamda | ( | int | a, | |
| int | b | |||
| ) | const [private] |
| double njtree::reduction4 | ( | int | a, | |
| double | la, | |||
| int | b, | |||
| double | lb, | |||
| int | i, | |||
| double | lam | |||
| ) | const [inline, private] |
References distance().
| double njtree::reduction10 | ( | int | a, | |
| int | b, | |||
| int | i, | |||
| double | lam, | |||
| double | vab | |||
| ) | const [inline, private] |
References variance().
| void njtree::concatenate | ( | const char | chn1[], | |
| int | ind, | |||
| int | post | |||
| ) | [private] |
References wordList::head, word::name, word::next, wordList::tail, and trees.
Referenced by reduction().
| double njtree::finish_branch_length | ( | int | i, | |
| int | j, | |||
| int | k | |||
| ) | const [inline, private] |
| void njtree::clear | ( | ) | [private] |
double** njtree::delta [private] |
the distance matrix It is a two-dimensional array
Referenced by agglomerative_criterion(), branch_length(), clear(), compute_sums_Sx(), distance(), finish(), load(), load_generic(), reduction(), symmetric(), variance(), and ~njtree().
int njtree::n [private] |
the size of the distance matrix for multiple inputs this is useful to prevent memory reallocation
Referenced by best_pair(), clear(), compute_sums_Sx(), finish(), lamda(), load(), load_generic(), reduction(), symmetric(), taxonCount(), and ~njtree().
int njtree::r [private] |
Referenced by agglomerative_criterion(), branch_length(), lamda(), load(), load_generic(), reduction(), and remainingCount().
wordList* njtree::trees [private] |
this is the tree order
Referenced by clear(), concatenate(), empty(), finish(), load(), load_generic(), output(), reduction(), and ~njtree().
int njtree::PREC = 10 [static, private] |
precission for computation, default 10
Referenced by finish(), and reduction().
1.5.6