| 1 | #include <stdio.h> |
|---|
| 2 | #include <string.h> |
|---|
| 3 | #include <stdlib.h> |
|---|
| 4 | #ifdef MAC |
|---|
| 5 | #include <console.h> |
|---|
| 6 | #endif |
|---|
| 7 | #include "clustalw.h" |
|---|
| 8 | |
|---|
| 9 | /* |
|---|
| 10 | * Prototypes |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | #ifdef MAC |
|---|
| 14 | extern int ccommand(char ***); |
|---|
| 15 | #endif |
|---|
| 16 | |
|---|
| 17 | extern void *ckalloc(size_t); |
|---|
| 18 | extern void init_amenu(void); |
|---|
| 19 | extern void init_interface(void); |
|---|
| 20 | extern void init_matrix(void); |
|---|
| 21 | extern void fill_chartab(void); |
|---|
| 22 | extern void parse_params(Boolean); |
|---|
| 23 | extern void main_menu(void); |
|---|
| 24 | |
|---|
| 25 | /* |
|---|
| 26 | * Global variables |
|---|
| 27 | */ |
|---|
| 28 | double **tmat; |
|---|
| 29 | |
|---|
| 30 | char revision_level[] = "W (1.83)"; /* JULIE feb 2001*/ |
|---|
| 31 | |
|---|
| 32 | Boolean interactive=FALSE; |
|---|
| 33 | |
|---|
| 34 | #ifdef MSDOS |
|---|
| 35 | const char *help_file_name = "clustalw.hlp"; |
|---|
| 36 | #else |
|---|
| 37 | const char *help_file_name = "clustalw_help"; |
|---|
| 38 | #endif |
|---|
| 39 | |
|---|
| 40 | sint max_names; /* maximum length of names in current alignment file */ |
|---|
| 41 | |
|---|
| 42 | float gap_open, gap_extend; |
|---|
| 43 | float pw_go_penalty, pw_ge_penalty; |
|---|
| 44 | |
|---|
| 45 | FILE *tree; |
|---|
| 46 | FILE *clustal_outfile, *gcg_outfile, *nbrf_outfile, *phylip_outfile, |
|---|
| 47 | *gde_outfile, *nexus_outfile; |
|---|
| 48 | FILE *fasta_outfile; /* Ramu */ |
|---|
| 49 | |
|---|
| 50 | sint *seqlen_array; |
|---|
| 51 | sint max_aln_length; |
|---|
| 52 | short usermat[NUMRES][NUMRES], pw_usermat[NUMRES][NUMRES]; |
|---|
| 53 | short def_aa_xref[NUMRES+1], aa_xref[NUMRES+1], pw_aa_xref[NUMRES+1]; |
|---|
| 54 | short userdnamat[NUMRES][NUMRES], pw_userdnamat[NUMRES][NUMRES]; |
|---|
| 55 | short def_dna_xref[NUMRES+1], dna_xref[NUMRES+1], pw_dna_xref[NUMRES+1]; |
|---|
| 56 | sint nseqs; |
|---|
| 57 | sint nsets; |
|---|
| 58 | sint *output_index; |
|---|
| 59 | sint **sets; |
|---|
| 60 | sint *seq_weight; |
|---|
| 61 | sint max_aa; |
|---|
| 62 | sint gap_pos1; |
|---|
| 63 | sint gap_pos2; |
|---|
| 64 | sint mat_avscore; |
|---|
| 65 | sint profile_no; |
|---|
| 66 | |
|---|
| 67 | Boolean usemenu; |
|---|
| 68 | Boolean dnaflag; |
|---|
| 69 | Boolean distance_tree; |
|---|
| 70 | |
|---|
| 71 | char **seq_array; |
|---|
| 72 | char **names,**titles; |
|---|
| 73 | char **args; |
|---|
| 74 | char seqname[FILENAMELEN+1]; |
|---|
| 75 | |
|---|
| 76 | char *gap_penalty_mask1 = NULL, *gap_penalty_mask2 = NULL; |
|---|
| 77 | char *sec_struct_mask1 = NULL, *sec_struct_mask2 = NULL; |
|---|
| 78 | sint struct_penalties; |
|---|
| 79 | char *ss_name1 = NULL, *ss_name2 = NULL; |
|---|
| 80 | |
|---|
| 81 | Boolean user_series = FALSE; |
|---|
| 82 | UserMatSeries matseries; |
|---|
| 83 | short usermatseries[MAXMAT][NUMRES][NUMRES]; |
|---|
| 84 | short aa_xrefseries[MAXMAT][NUMRES+1]; |
|---|
| 85 | |
|---|
| 86 | int main(int argc,char **argv) |
|---|
| 87 | { |
|---|
| 88 | sint i; |
|---|
| 89 | |
|---|
| 90 | #ifdef MAC |
|---|
| 91 | argc=ccommand(&argv); |
|---|
| 92 | #endif |
|---|
| 93 | |
|---|
| 94 | init_amenu(); |
|---|
| 95 | init_interface(); |
|---|
| 96 | init_matrix(); |
|---|
| 97 | |
|---|
| 98 | fill_chartab(); |
|---|
| 99 | |
|---|
| 100 | if(argc>1) { |
|---|
| 101 | args = (char **)ckalloc(argc * sizeof(char *)); |
|---|
| 102 | |
|---|
| 103 | for(i=1;i<argc;++i) |
|---|
| 104 | { |
|---|
| 105 | args[i-1]=(char *)ckalloc((strlen(argv[i])+1) * sizeof(char)); |
|---|
| 106 | strcpy(args[i-1],argv[i]); |
|---|
| 107 | } |
|---|
| 108 | usemenu=FALSE; |
|---|
| 109 | parse_params(FALSE); |
|---|
| 110 | |
|---|
| 111 | for(i=0;i<argc-1;i++) |
|---|
| 112 | ckfree(args[i]); |
|---|
| 113 | ckfree(args); |
|---|
| 114 | } |
|---|
| 115 | usemenu=TRUE; |
|---|
| 116 | interactive=TRUE; |
|---|
| 117 | |
|---|
| 118 | main_menu(); |
|---|
| 119 | |
|---|
| 120 | exit(0); |
|---|
| 121 | } |
|---|
| 122 | |
|---|