| 1 | // DNAml_rates.h |
|---|
| 2 | |
|---|
| 3 | /* Compile time switches for various updates to program: |
|---|
| 4 | * 0 gives original version |
|---|
| 5 | * 1 gives new version |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifndef CXXFORWARD_H |
|---|
| 9 | #include <cxxforward.h> |
|---|
| 10 | #endif |
|---|
| 11 | #ifndef ARBDBT_H |
|---|
| 12 | #include <arbdbt.h> |
|---|
| 13 | #endif |
|---|
| 14 | |
|---|
| 15 | #define Debug 1 |
|---|
| 16 | |
|---|
| 17 | // Program constants and parameters |
|---|
| 18 | |
|---|
| 19 | #define maxsp 10000 // maximum number of species |
|---|
| 20 | #define maxsites 8000 // maximum number of sites |
|---|
| 21 | #define maxpatterns 8000 // max number of different site patterns |
|---|
| 22 | #define maxcategories 35 // maximum number of site types |
|---|
| 23 | #define nmlngth 10 // max. number of characters in species name |
|---|
| 24 | #define KI_MAX 256.0 // largest rate possible |
|---|
| 25 | #define RATE_STEP sqrt(sqrt(2.0)) // initial step size for rate search |
|---|
| 26 | #define MAX_ERROR 0.01 // max fractional error in rate calculation |
|---|
| 27 | #define MIN_INFO 4 // minimum number of informative sequences |
|---|
| 28 | #define UNDEF_CATEGORY 1 // category number to output for undefined rate |
|---|
| 29 | #define zmin 1.0E-15 // max branch prop. to -log(zmin) (= 34) |
|---|
| 30 | #define zmax (1.0 - 1.0E-6) // min branch prop. to 1.0-zmax (= 1.0E-6) |
|---|
| 31 | #define unlikely -1.0E300 // low likelihood for initialization |
|---|
| 32 | #define decimal_point '.' |
|---|
| 33 | |
|---|
| 34 | // the following macros are already defined in gmacros.h: |
|---|
| 35 | // #define ABS(x) (((x)< 0) ? -(x) : (x)) |
|---|
| 36 | // #define MIN(x, y) (((x)<(y)) ? (x) : (y)) |
|---|
| 37 | // #define MAX(x, y) (((x)>(y)) ? (x) : (y)) |
|---|
| 38 | #define LOG(x) (((x)> 0) ? log(x) : hang("log domain error")) |
|---|
| 39 | #define nint(x) ((int) ((x)>0 ? ((x)+0.5) : ((x)-0.5))) |
|---|
| 40 | #define aint(x) ((double) ((int) (x))) |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | typedef double xtype; |
|---|
| 44 | struct node; |
|---|
| 45 | typedef node *nodeptr; |
|---|
| 46 | |
|---|
| 47 | #if defined(Cxx11) |
|---|
| 48 | CONSTEXPR int MAXNODES = leafs_2_nodes(maxsp, ROOTED); |
|---|
| 49 | #else // !defined(Cxx11) |
|---|
| 50 | const int MAXNODES = 2*maxsp+1; |
|---|
| 51 | #endif |
|---|
| 52 | |
|---|
| 53 | struct xarray { |
|---|
| 54 | xarray *prev; |
|---|
| 55 | xarray *next; |
|---|
| 56 | nodeptr owner; |
|---|
| 57 | xtype *a, *c, *g, *t; |
|---|
| 58 | }; |
|---|
| 59 | |
|---|
| 60 | struct node { |
|---|
| 61 | double z; |
|---|
| 62 | nodeptr next; |
|---|
| 63 | nodeptr back; |
|---|
| 64 | int number; |
|---|
| 65 | xarray *x; |
|---|
| 66 | int xcoord, ycoord, ymin, ymax; |
|---|
| 67 | char name[nmlngth+1]; // Space for null termination |
|---|
| 68 | char *tip; // Pointer to sequence data |
|---|
| 69 | }; |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | struct tree { |
|---|
| 73 | double likelihood; |
|---|
| 74 | double log_f[maxpatterns]; |
|---|
| 75 | nodeptr nodep[MAXNODES]; |
|---|
| 76 | nodeptr start; |
|---|
| 77 | int mxtips; |
|---|
| 78 | int ntips; |
|---|
| 79 | int nextnode; |
|---|
| 80 | int opt_level; |
|---|
| 81 | bool smoothed; |
|---|
| 82 | bool rooted; |
|---|
| 83 | }; |
|---|
| 84 | |
|---|
| 85 | struct drawdata { |
|---|
| 86 | double tipmax; |
|---|
| 87 | int tipy; |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|