00001 //initialize.h 00002 #include <iostream.h> 00003 #include <stdlib.h> 00004 #include <stdio.h> 00005 #include <fstream.h> 00006 00007 #define PREC 8 /* precision of branch-lengths */ 00008 #define PRC 12 00009 #define LEN 30 /* length of taxon names */ 00010 00011 typedef struct word 00012 { 00013 char name[LEN]; 00014 struct word *suiv; 00015 }WORD; 00016 00017 typedef struct pointers 00018 { 00019 WORD *head; 00020 WORD *tail; 00021 }POINTERS; 00022 00023 /*;;;;;;; INPUT, OUTPUT, INITIALIZATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00024 ; ; 00025 ; ; 00026 ; The delta matrix is read from the input-file. ; 00027 ; It is recommended to put it and the executable in ; 00028 ; a special directory. The input-file and output-file ; 00029 ; can be given as arguments to the executable by ; 00030 ; typing them after the executable (Bionj input-file ; 00031 ; output-file) or by typing them when asked by the ; 00032 ; program. The input-file has to be formated according ; 00033 ; the PHYLIP standard. The output file is formated ; 00034 ; according to the NEWSWICK standard. ; 00035 ; ; 00036 ; The lower-half of the delta matrix is occupied by ; 00037 ; dissimilarities. The upper-half of the matrix is ; 00038 ; occupied by variances. The first column ; 00039 ; is initialized as 0; during the algorithm some ; 00040 ; indices are no more used, and the corresponding ; 00041 ; positions in the first column are set to 1. ; 00042 ; ; 00043 ; This delta matix is made symmetrical using the rule: ; 00044 ; Dij = Dji <- (Dij + Dji)/2. The diagonal is set to 0; ; 00045 ; during the further steps of the algorithm, it is used ; 00046 ; to store the sums Sx. ; 00047 ; ; 00048 ; A second array, trees, is used to store taxon names. ; 00049 ; During the further steps of the algoritm, some ; 00050 ; positions in this array are emptied while the others ; 00051 ; are used to store subtrees. ; 00052 ; ; 00053 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ 00054 00055 00056 /*;;;;;;;;;;;;;;;;;;; Initialize ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00057 ;Description : This function reads an input file and return the ; 00058 ; delta matrix and trees: the list of taxa. ; 00059 ; ; 00060 ; input : ; 00061 ; double **delta : delta matrix ; 00062 ; FILE *input : pointer to input file ; 00063 ; int n : number of taxa ; 00064 ; char **trees : list of taxa ; 00065 ; ; 00066 ; return value: ; 00067 ; double **delta : delta matrix ; 00068 ; char *trees : list of taxa ; 00069 ; ; 00070 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ 00071 00072 void Initialize(double **&delta, istream &input, int n, POINTERS *trees); 00073 00074 00075 /*;;;;;;;;;;;;;;;;;;;;;;;;;;; Print_output;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*\ 00076 ; ; 00077 ; ; 00078 ; Description : This function prints out the tree in the output file. ; 00079 ; ; 00080 ; input : ; 00081 ; POINTERS *trees : pointer to the subtrees. ; 00082 ; int i : indicate the subtree i to be printed. ; 00083 : FILE *output : pointer to the output file. ; 00084 ; ; 00085 ; return value: The phylogenetic tree in the output file. ; 00086 ; ; 00087 \*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ 00088 00089 00090 void Print_output(int i, POINTERS *trees, FILE *output); 00091 00092
1.5.6