1 /* version 3.696. 2 Written by Joseph Felsenstein, Akiko Fuseki, Sean Lamont, and Andrew Keeffe. 3 4 Copyright (c) 1993-2014, Joseph Felsenstein 5 All rights reserved. 6 7 Redistribution and use in source and binary forms, with or without 8 modification, are permitted provided that the following conditions are met: 9 10 1. Redistributions of source code must retain the above copyright notice, 11 this list of conditions and the following disclaimer. 12 13 2. Redistributions in binary form must reproduce the above copyright notice, 14 this list of conditions and the following disclaimer in the documentation 15 and/or other materials provided with the distribution. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 /* 31 seq.h: included in dnacomp, dnadist, dnainvar, dnaml, dnamlk, dnamove, 32 dnapars, dnapenny, protdist, protpars, restdist & restml 33 */ 34 35 #ifndef SEQ_H 36 #define SEQ_H 37 38 #define ebcdic EBCDIC 39 #define MAXNCH 20 40 41 /* All of this came over from cons.h -plc*/ 42 #define OVER 7 43 #define ADJACENT_PAIRS 1 44 #define CORR_IN_1_AND_2 2 45 #define ALL_IN_1_AND_2 3 46 #define NO_PAIRING 4 47 #define ALL_IN_FIRST 5 48 #define TREE1 8 49 #define TREE2 9 50 51 #define FULL_MATRIX 11 52 #define VERBOSE 22 53 #define SPARSE 33 54 55 /* Number of columns per block in a matrix output */ 56 #define COLUMNS_PER_BLOCK 10 57 58 59 /*end move*/ 60 61 62 typedef struct gbases { 63 baseptr base; 64 struct gbases *next; 65 } gbases; 66 67 typedef struct nuview_data { 68 /* A big 'ol collection of pointers used in nuview */ 69 double *yy, *wwzz, *vvzz, *vzsumr, *vzsumy, *sum, *sumr, *sumy; 70 sitelike *xx; 71 } nuview_data; 72 73 struct LOC_hyptrav { 74 boolean bottom; 75 node *r; 76 long *hypset; 77 boolean maybe, nonzero; 78 long tempset, anc; 79 } ; 80 81 82 extern long nonodes, endsite, outgrno, nextree, which; 83 84 extern boolean interleaved, printdata, outgropt, treeprint, dotdiff, transvp; 85 extern steptr weight, category, alias, location, ally; 86 extern sequence y; 87 88 #ifndef OLDC 89 /* function prototypes */ 90 void alloctemp(node **, long *, long); 91 void freetemp(node **); 92 void freetree2 (pointarray, long); 93 void inputdata(long); 94 void alloctree(pointarray *, long, boolean); 95 void allocx(long, long, pointarray, boolean); 96 97 void prot_allocx(long, long, pointarray, boolean); 98 void setuptree(pointarray, long, boolean); 99 void setuptree2(tree *); 100 void alloctip(node *, long *); 101 void getbasefreqs(double, double, double, double, double *, double *, 102 double *, double *, double *, double *, double *, 103 double *xi, double *, double *, boolean, boolean); 104 void empiricalfreqs(double *,double *,double *,double *,steptr,pointarray); 105 void sitesort(long, steptr); 106 void sitecombine(long); 107 108 void sitescrunch(long); 109 void sitesort2(long, steptr); 110 void sitecombine2(long, steptr); 111 void sitescrunch2(long, long, long, steptr); 112 void makevalues(pointarray, long *, boolean); 113 void makevalues2(long, pointarray, long, long, sequence, steptr); 114 void fillin(node *, node *, node *); 115 long getlargest(long *); 116 void multifillin(node *, node *, long); 117 void sumnsteps(node *, node *, node *, long, long); 118 119 void sumnsteps2(node *, node *, node *, long, long, long *); 120 void multisumnsteps(node *, node *, long, long, long *); 121 void multisumnsteps2(node *); 122 boolean alltips(node *, node *); 123 void gdispose(node *, node **, pointarray); 124 void preorder(node *, node *, node *, node *, node *, node *, long); 125 void updatenumdesc(node *, node *, long); 126 void add(node *,node *,node *,node **,boolean,pointarray,node **,long *); 127 void findbelow(node **below, node *item, node *fork); 128 129 void re_move(node *item, node **fork, node **root, boolean recompute, 130 pointarray, node **, long *); 131 void postorder(node *p); 132 void getnufork(node **, node **, pointarray, long *); 133 void reroot(node *, node *); 134 void reroot2(node *, node *); 135 void reroot3(node *, node *, node *, node *, node **); 136 void savetraverse(node *); 137 void newindex(long, node *); 138 void flipindexes(long, pointarray); 139 boolean parentinmulti(node *); 140 141 long sibsvisited(node *, long *); 142 long smallest(node *, long *); 143 void bintomulti(node **, node **, node **, long *); 144 void backtobinary(node **, node *, node **); 145 boolean outgrin(node *, node *); 146 void flipnodes(node *, node *); 147 void moveleft(node *, node *, node **); 148 void savetree(node *, long *, pointarray, node **, long *); 149 void addnsave(node *, node *, node *, node **, node **,boolean, 150 pointarray, long *, long *); 151 void addbestever(long *, long *, long, boolean, long *, bestelm *); 152 153 void addtiedtree(long, long *, long, boolean,long *, bestelm *); 154 void clearcollapse(pointarray); 155 void clearbottom(pointarray); 156 void collabranch(node *, node *, node *); 157 boolean allcommonbases(node *, node *, boolean *); 158 void findbottom(node *, node **); 159 boolean moresteps(node *, node *); 160 boolean passdown(node *, node *, node *, node *, node *, node *, 161 node *, node *, node *, boolean); 162 boolean trycollapdesc(node *, node *, node *, node *, node *, 163 node *, node *, node *, node *, boolean , long *); 164 void setbottom(node *); 165 166 boolean zeroinsubtree(node *, node *, node *, node *, node *, 167 node *, node *, node *, boolean, node *, long *); 168 boolean collapsible(node *, node *, node *, node *, node *, 169 node *, node *, node *, boolean, node *, long *, pointarray); 170 void replaceback(node **, node *, node *, node **, long *); 171 void putback(node *, node *, node *, node **); 172 void savelocrearr(node *, node *, node *, node *, node *, node *, 173 node *, node *, node *, node **, long, long *, boolean, 174 boolean , boolean *, long *, bestelm *, pointarray , 175 node **, long *); 176 void clearvisited(pointarray); 177 void hyprint(long, long, struct LOC_hyptrav *,pointarray, Char *); 178 void gnubase(gbases **, gbases **, long); 179 void chuckbase(gbases *, gbases **); 180 void hyptrav(node *, long *, long, long, boolean,pointarray, 181 gbases **, Char *); 182 183 void hypstates(long , node *, pointarray, gbases **, Char *); 184 void initbranchlen(node *p); 185 void initmin(node *, long, boolean); 186 void initbase(node *, long); 187 void inittreetrav(node *, long); 188 void compmin(node *, node *); 189 void minpostorder(node *, pointarray); 190 void branchlength(node *,node *,double *,pointarray); 191 void printbranchlengths(node *); 192 void branchlentrav(node *,node *,long,long,double *,pointarray); 193 194 void treelength(node *, long, pointarray); 195 void coordinates(node *, long *, double, long *); 196 void drawline(long, double, node *); 197 void printree(node *, double); 198 void writesteps(long, boolean, steptr, node *); 199 void treeout(node *, long, long *, node *); 200 void treeout3(node *, long, long *, node *); 201 void fdrawline2(FILE *fp, long i, double scale, tree *curtree); 202 void drawline2(long, double, tree); 203 void drawline3(long, double, node *); 204 void copynode(node *, node *, long); 205 206 void prot_copynode(node *, node *, long); 207 void copy_(tree *, tree *, long, long); 208 void prot_copy_(tree *, tree *, long, long); 209 void standev(long, long, long, double, double *, long **, longer); 210 void standev2(long, long, long, long, double, double *, double **, 211 steptr, longer); 212 void freetip(node *); 213 void freenontip(node *); 214 void freenodes(long, pointarray); 215 void freenode(node **); 216 void freetree(long, pointarray); 217 218 void freex(long, pointarray); 219 void freex_notip(long, pointarray); 220 void prot_freex_notip(long nonodes, pointarray treenode); 221 void prot_freex(long nonodes, pointarray treenode); 222 void freegarbage(gbases **); 223 void freegrbg(node **); 224 225 void collapsetree(node *, node *, node **, pointarray, long *); 226 void collapsebestrees(node **, node **, pointarray, bestelm *, long *, 227 long *, long, boolean, boolean); 228 void fix_x(node* p,long site, double maxx, long rcategs); 229 void fix_protx(node* p,long site,double maxx, long rcategs); 230 /*function prototypes*/ 231 #endif 232 233 #endif /* SEQ_H */ 234