BioInt
1.02.00
BioInt: An integrative biological object-oriented application framework and interpreter
|
00001 #ifndef BIOUPGMA_H 00002 #define BIOUPGMA_H 00003 00004 #include <fstream> 00005 #include <string> 00006 #include <iostream> 00007 #include <cmath> 00008 #include <cstring> 00009 #include "BioUtilities.h" 00010 #include "BioLenPos.h" 00011 #include "BioFasta.h" 00012 #include "BioMultipleGenBank.h" 00013 #include "BioMultipleSwissProt.h" 00014 #include "BioMultipleEmbl.h" 00015 #include "BioOutputStream.h" 00016 #include "BioProteinSequenceGlobalAlignment.h" 00017 #include "BioDnaSequenceGlobalAlignment.h" 00018 00019 #define MAXOTU 200 00020 00021 class BioUpgma 00022 { 00023 float *dist; /* list of the genetic distances to be analyzed */ 00024 vector < node > nodetable; /* list of nodes in the tree */ 00025 vector < branch > tree; /* text diagram of tree */ 00026 FILE *fpt; /* pointer for output (tree) file */ 00027 int notu ; /* total number of OTUs in data set */ 00028 int cotu ; /* current number of OTUs remaining */ 00029 int ndist ; /* total number of distances in data set */ 00030 int cdist ; /* total number of distances in data set */ 00031 int nnodes ; /* number of nodes made */ 00032 string otulist[MAXOTU]; /* list of the OTUs to be compared */ 00033 00034 public: 00035 BioUpgma(); 00036 //Added on 5.12.2012 00037 BioUpgma(BioMultipleFasta,string,string); //1st arg is multiple sequence format file, of is output tree file. 00038 BioUpgma(BioMultipleGenBank, string); 00039 BioUpgma(BioMultipleEmbl, string); 00040 BioUpgma(BioMultipleSwissProt, string); 00041 ~BioUpgma(); 00042 00043 private: 00044 /****************** EXTRACT DATA FROM DISTANCE MATRIX FILE ******************/ 00045 void getotus(string infl); /* gets otus from input file */ 00046 void getdist(ifstream &fs); /* gets distances from input file */ 00047 /******************* FLIP MATRIX TO UPPER-RIGHT TRIANGLE ********************/ 00048 void flipmatrix(); /* flips matrix from 'D' type to 'U' type */ 00049 /***************************** NEIGHBOR-JOINING *****************************/ 00050 void cluster(char outfl[]); /* operates clustering algorithm */ 00051 void reducematrix(coord xy); /* reduces matrix after each cycle */ 00052 void reduceotulist(int nodenumber,int x,int y); /* reduces otulist */ 00053 /******************************** DRAW TREE *********************************/ 00054 void drawtree(); /* draws a diagram of the tree */ 00055 int orderotus(int nlines, int otulen); /* order otus and nodes in tree */ 00056 void printtree(int nlines, int otulen); /* prints tree to screen & file */ 00057 void fliptree(int nlines); /* turns tree around for easier reading */ 00058 void printscale(int otulen); /* prints a distance scale under tree */ 00059 public: 00060 void showRootedTree(string infile, string outfile, string mat_orient); 00061 00062 }; 00063 00064 #endif