| 1 | /*#include "/us1/user/julie/dmalloc/malloc.h"*/ |
|---|
| 2 | /*********************CLUSTALW.H*********************************************/ |
|---|
| 3 | /****************************************************************************/ |
|---|
| 4 | |
|---|
| 5 | /* |
|---|
| 6 | Main header file for ClustalW. Uncomment ONE of the following 4 lines |
|---|
| 7 | depending on which compiler you wish to use. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | /*#define VMS 1 VAX or ALPHA VMS */ |
|---|
| 11 | |
|---|
| 12 | /*#define MAC 1 Think_C for Macintosh */ |
|---|
| 13 | |
|---|
| 14 | /*#define MSDOS 1 Turbo C for PC's */ |
|---|
| 15 | |
|---|
| 16 | #define UNIX 1 /*Ultrix/Decstation, Gnu C for |
|---|
| 17 | Sun, IRIX/SGI, OSF1/ALPHA */ |
|---|
| 18 | |
|---|
| 19 | /***************************************************************************/ |
|---|
| 20 | /***************************************************************************/ |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | #include "general.h" |
|---|
| 24 | |
|---|
| 25 | #define MAXNAMES 30 /* Max chars read for seq. names */ |
|---|
| 26 | #define MAXTITLES 60 /* Title length */ |
|---|
| 27 | #define FILENAMELEN 256 /* Max. file name length */ |
|---|
| 28 | |
|---|
| 29 | #define UNKNOWN 0 |
|---|
| 30 | #define EMBLSWISS 1 |
|---|
| 31 | #define PIR 2 |
|---|
| 32 | #define PEARSON 3 |
|---|
| 33 | #define GDE 4 |
|---|
| 34 | #define CLUSTAL 5 /* DES */ |
|---|
| 35 | #define MSF 6 /* DES */ |
|---|
| 36 | #define RSF 7 /* JULIE */ |
|---|
| 37 | #define USER 8 /* DES */ |
|---|
| 38 | #define PHYLIP 9 /* DES */ |
|---|
| 39 | |
|---|
| 40 | #define NONE 0 |
|---|
| 41 | #define SECST 1 |
|---|
| 42 | #define GMASK 2 |
|---|
| 43 | |
|---|
| 44 | #define PROFILE 0 |
|---|
| 45 | #define SEQUENCE 1 |
|---|
| 46 | |
|---|
| 47 | #define BS_NODE_LABELS 2 |
|---|
| 48 | #define BS_BRANCH_LABELS 1 |
|---|
| 49 | |
|---|
| 50 | #define PAGE_LEN 22 /* Number of lines of help sent to screen */ |
|---|
| 51 | |
|---|
| 52 | #define PAGEWIDTH 80 /* maximum characters on output file page */ |
|---|
| 53 | #define LINELENGTH 60 /* Output file line length */ |
|---|
| 54 | #define GCG_LINELENGTH 50 |
|---|
| 55 | |
|---|
| 56 | #ifdef VMS /* Defaults for VAX VMS */ |
|---|
| 57 | #define COMMANDSEP '/' |
|---|
| 58 | #define DIRDELIM ']' /* Last character before file name in full file |
|---|
| 59 | specs */ |
|---|
| 60 | #define INT_SCALE_FACTOR 1000 /* Scaling factor to convert float to integer for profile scores */ |
|---|
| 61 | |
|---|
| 62 | #elif MAC |
|---|
| 63 | #define COMMANDSEP '/' |
|---|
| 64 | #define DIRDELIM ':' |
|---|
| 65 | #define INT_SCALE_FACTOR 100 /* Scaling factor to convert float to integer for profile scores */ |
|---|
| 66 | |
|---|
| 67 | #elif MSDOS |
|---|
| 68 | #define COMMANDSEP '/' |
|---|
| 69 | #define DIRDELIM '\\' |
|---|
| 70 | #define INT_SCALE_FACTOR 100 /* Scaling factor to convert float to integer for profile scores */ |
|---|
| 71 | |
|---|
| 72 | #elif UNIX |
|---|
| 73 | #define COMMANDSEP '-' |
|---|
| 74 | #define DIRDELIM '/' |
|---|
| 75 | #define INT_SCALE_FACTOR 1000 /* Scaling factor to convert float to integer for profile scores */ |
|---|
| 76 | #endif |
|---|
| 77 | |
|---|
| 78 | #define NUMRES 32 /* max size of comparison matrix */ |
|---|
| 79 | |
|---|
| 80 | #define INPUT 0 |
|---|
| 81 | #define ALIGNED 1 |
|---|
| 82 | |
|---|
| 83 | #define LEFT 1 |
|---|
| 84 | #define RIGHT 2 |
|---|
| 85 | |
|---|
| 86 | #define NODE 0 |
|---|
| 87 | #define LEAF 1 |
|---|
| 88 | |
|---|
| 89 | #define GAPCOL 32 /* position of gap open penalty in profile */ |
|---|
| 90 | #define LENCOL 33 /* position of gap extension penalty in profile */ |
|---|
| 91 | |
|---|
| 92 | typedef struct node { /* phylogenetic tree structure */ |
|---|
| 93 | struct node *left; |
|---|
| 94 | struct node *right; |
|---|
| 95 | struct node *parent; |
|---|
| 96 | float dist; |
|---|
| 97 | sint leaf; |
|---|
| 98 | int order; |
|---|
| 99 | char name[64]; |
|---|
| 100 | } stree, *treeptr; |
|---|
| 101 | |
|---|
| 102 | /* |
|---|
| 103 | Prototypes |
|---|
| 104 | */ |
|---|
| 105 | |
|---|
| 106 | /* alnscore.c */ |
|---|
| 107 | void aln_score(void); |
|---|
| 108 | /* interface.c */ |
|---|
| 109 | void parse_params(Boolean); |
|---|
| 110 | void init_amenu(void); |
|---|
| 111 | void init_interface(void); |
|---|
| 112 | void main_menu(void); |
|---|
| 113 | FILE *open_output_file(char *, char *, char *, char *); |
|---|
| 114 | FILE *open_explicit_file(char *); |
|---|
| 115 | sint seq_input(Boolean); |
|---|
| 116 | Boolean open_alignment_output(char *); |
|---|
| 117 | void create_alignment_output(sint fseq,sint lseq); |
|---|
| 118 | void align(char *phylip_name); |
|---|
| 119 | void profile_align(char *p1_tree_name,char *p2_tree_name);/* Align 2 alignments */ |
|---|
| 120 | void make_tree(char *phylip_name); |
|---|
| 121 | void get_tree(char *phylip_name); |
|---|
| 122 | sint profile_input(void); /* read a profile */ |
|---|
| 123 | void new_sequence_align(char *phylip_name); |
|---|
| 124 | Boolean user_mat(char *, short *, short *); |
|---|
| 125 | void get_help(char); |
|---|
| 126 | void clustal_out(FILE *, sint, sint, sint, sint); |
|---|
| 127 | void nbrf_out(FILE *, sint, sint, sint, sint); |
|---|
| 128 | void gcg_out(FILE *, sint, sint, sint, sint); |
|---|
| 129 | void phylip_out(FILE *, sint, sint, sint, sint); |
|---|
| 130 | void gde_out(FILE *, sint, sint, sint, sint); |
|---|
| 131 | void print_sec_struct_mask(int prf_length,char *mask,char *struct_mask); |
|---|
| 132 | void fix_gaps(void); |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | /* calcgapcoeff.c */ |
|---|
| 136 | void calc_gap_coeff(char **alignment, sint *gaps, sint **profile, Boolean struct_penalties, |
|---|
| 137 | char *gap_penalty_mask, sint first_seq, sint last_seq, |
|---|
| 138 | sint prf_length, sint gapcoef, sint lencoef); |
|---|
| 139 | /* calcprf1.c */ |
|---|
| 140 | void calc_prf1(sint **profile, char **alignment, sint *gaps, sint matrix[NUMRES ][NUMRES ], |
|---|
| 141 | sint *seq_weight, sint prf_length, sint first_seq, sint last_seq); |
|---|
| 142 | /* calcprf2.c */ |
|---|
| 143 | void calc_prf2(sint **profile, char **alignment, sint *seq_weight, sint prf_length, |
|---|
| 144 | sint first_seq, sint last_seq); |
|---|
| 145 | /* calctree.c */ |
|---|
| 146 | void calc_seq_weights(sint first_seq, sint last_seq,sint *seq_weight); |
|---|
| 147 | void create_sets(sint first_seq, sint last_seq); |
|---|
| 148 | sint read_tree(char *treefile, sint first_seq, sint last_seq); |
|---|
| 149 | void clear_tree(treeptr p); |
|---|
| 150 | sint calc_similarities(sint nseqs); |
|---|
| 151 | /* clustalw.c */ |
|---|
| 152 | int main(int argc, char **argv); |
|---|
| 153 | /* gcgcheck.c */ |
|---|
| 154 | int SeqGCGCheckSum(char *seq, sint len); |
|---|
| 155 | /* malign.c */ |
|---|
| 156 | sint malign(sint istart,char *phylip_name); |
|---|
| 157 | sint seqalign(sint istart,char *phylip_name); |
|---|
| 158 | sint palign1(void); |
|---|
| 159 | float countid(sint s1, sint s2); |
|---|
| 160 | sint palign2(char *p1_tree_name,char *p2_tree_name); |
|---|
| 161 | /* pairalign.c */ |
|---|
| 162 | sint pairalign(sint istart, sint iend, sint jstart, sint jend); |
|---|
| 163 | /* prfalign.c */ |
|---|
| 164 | lint prfalign(sint *group, sint *aligned); |
|---|
| 165 | /* random.c */ |
|---|
| 166 | unsigned long linrand(unsigned long r); |
|---|
| 167 | unsigned long addrand(unsigned long r); |
|---|
| 168 | void addrandinit(unsigned long s); |
|---|
| 169 | /* readmat.c */ |
|---|
| 170 | void init_matrix(void); |
|---|
| 171 | sint get_matrix(short *matptr, short *xref, sint matrix[NUMRES ][NUMRES ], Boolean neg_flag, |
|---|
| 172 | sint scale); |
|---|
| 173 | sint read_user_matrix(char *filename, short *usermat, short *xref); |
|---|
| 174 | int getargs(char *inline1, char *args[], int max); |
|---|
| 175 | /* sequence.c */ |
|---|
| 176 | void fill_chartab(void); |
|---|
| 177 | sint readseqs(sint first_seq); |
|---|
| 178 | /* showpair.c */ |
|---|
| 179 | void show_pair(void); |
|---|
| 180 | /* trees.c */ |
|---|
| 181 | void phylogenetic_tree(char *phylip_name,char *clustal_name,char *dist_name); |
|---|
| 182 | void bootstrap_tree(char *phylip_name,char *clustal_name); |
|---|
| 183 | sint dna_distance_matrix(FILE *tree); |
|---|
| 184 | sint prot_distance_matrix(FILE *tree); |
|---|
| 185 | void guide_tree(FILE *tree,int first_seq,sint nseqs); |
|---|
| 186 | |
|---|
| 187 | /* util.c */ |
|---|
| 188 | |
|---|
| 189 | void alloc_aln(sint nseqs); |
|---|
| 190 | void realloc_aln(sint first_seq,sint nseqs); |
|---|
| 191 | void free_aln(sint nseqs); |
|---|
| 192 | void alloc_seq(sint seq_no,sint length); |
|---|
| 193 | void realloc_seq(sint seq_no,sint length); |
|---|
| 194 | void free_seq(sint seq_no); |
|---|
| 195 | |
|---|
| 196 | void *ckalloc(size_t bytes); |
|---|
| 197 | void *ckrealloc(void *ptr, size_t bytes); |
|---|
| 198 | void *ckfree(void *ptr); |
|---|
| 199 | char prompt_for_yes_no(char *title,char *prompt); |
|---|
| 200 | void fatal(char *msg, ...); |
|---|
| 201 | void error(char *msg, ...); |
|---|
| 202 | void warning(char *msg, ...); |
|---|
| 203 | void info(char *msg, ...); |
|---|
| 204 | char *rtrim(char *str); |
|---|
| 205 | char *blank_to_(char *str); |
|---|
| 206 | char *upstr(char *str); |
|---|
| 207 | char *lowstr(char *str); |
|---|
| 208 | void getstr(char *instr, char *outstr); |
|---|
| 209 | double getreal(char *instr, double minx, double maxx, double def); |
|---|
| 210 | int getint(char *instr, int minx, int maxx, int def); |
|---|
| 211 | void do_system(void); |
|---|
| 212 | Boolean linetype(char *line, char *code); |
|---|
| 213 | Boolean keyword(char *line, char *code); |
|---|
| 214 | Boolean blankline(char *line); |
|---|
| 215 | void get_path(char *str, char *path); |
|---|
| 216 | |
|---|
| 217 | |
|---|