njtree Class Reference

#include <njtree.h>

List of all members.

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
wordListtrees

Static Private Attributes

static int PREC = 10


Detailed Description

generate bionj trees

Member Enumeration Documentation

Enumerator:
MATRIX 
NUMTAXON 


Constructor & Destructor Documentation

njtree::njtree (  )  [inline]

njtree::~njtree (  ) 

References delta, n, and trees.


Member Function Documentation

bool njtree::load ( std::istream ins,
inputformat  ipf 
)

Parameters:
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
6 AAB41303 0.000 3.500 1.586 3.500 1.974 3.500 A.ctg13578-000000.50.0 3.500 0.000 2.800 2.150 3.500 3.500 RS.ctg25256-000000.3.0 1.586 2.800 0.000 1.694 2.280 1.739 S.ctg15846-000000.4.0 3.500 2.150 1.694 0.000 2.024 2.029 BAA07791 1.974 3.500 2.280 2.024 0.000 3.500 AAF17707 3.500 3.500 1.739 2.029 3.500 0.000

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.

Referenced by load(), and main().

int njtree::taxonCount (  )  const [inline]

References n.

Referenced by main().

int njtree::remainingCount (  )  const [inline]

References r.

Referenced by main().

bool njtree::symmetric (  ) 

this function compares the values of A[i,j] with A[j,i] if found at least one of the pairs not the same it will return true. It will also average the two value and modifiy the values so they become identical

References delta, n, and value.

Referenced by main().

void njtree::compute_sums_Sx (  ) 

References delta, distance(), empty(), and n.

Referenced by main().

void njtree::best_pair ( int &  a,
int &  b 
) const

References agglomerative_criterion(), empty(), and n.

Referenced by main().

void njtree::reduction ( int  a,
int  b 
)

void njtree::finish ( std::ostream &  ous  ) 

void njtree::output ( int  i,
std::ostream &  ous 
)

References wordList::head, word::name, word::next, and trees.

Referenced by finish(), and main().

bool njtree::empty ( int  i  )  const [inline, private]

double njtree::distance ( int  i,
int  j 
) const [inline, private]

double njtree::variance ( int  i,
int  j 
) const [inline, private]

References delta.

Referenced by lamda(), reduction(), and reduction10().

double njtree::agglomerative_criterion ( int  i,
int  j 
) const [inline, private]

References delta, distance(), and r.

Referenced by best_pair().

double njtree::branch_length ( int  a,
int  b 
) const [inline, private]

References delta, distance(), and r.

Referenced by reduction().

double njtree::lamda ( int  a,
int  b 
) const [private]

References empty(), n, r, and variance().

Referenced by reduction().

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]

double njtree::finish_branch_length ( int  i,
int  j,
int  k 
) const [inline, private]

References distance().

Referenced by finish().

void njtree::clear (  )  [private]

References delta, n, and trees.

Referenced by load(), and load_generic().


Member Data Documentation

double** njtree::delta [private]

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]

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().


The documentation for this class was generated from the following files:

Generated on Wed Aug 10 11:57:13 2011 for Softwares from Orpara by  doxygen 1.5.6