Codebase list codonw / lintian-fixes/main codonW.h
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

codonW.h @lintian-fixes/mainraw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
/**************************************************************************/
/* CodonW codon usage analysis package                                    */
/* Copyright (C) 2005            John F. Peden                            */
/* This program is free software; you can redistribute                    */
/* it and/or modify it under the terms of the GNU General Public License  */
/* as published by the Free Software Foundation; version 2 of the         */
/* License,                                                               */
/*                                                                        */
/* This program is distributed in the hope that it will be useful, but    */
/* WITHOUT ANY WARRANTY; without even the implied warranty of             */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           */
/* GNU General Public License for more details.                           */
/* You should have received a copy of the GNU General Public License along*/
/* with this program; if not, write to the Free Software Foundation, Inc.,*/
/* 675 Mass Ave, Cambridge, MA 02139, USA.                                */
/*                                                                        */
/*                                                                        */
/* The author can be contacted by email (jfp#hanson-codonw@yahoo.com Anti-*/
/* Spam please change the # in my email to an _)                          */
/*                                                                        */
/* For the latest version and information see                             */
/* http://codonw.sourceforge.net 					  */
/**************************************************************************/


#define ARB_UNIT          100                  /* used to define the array*/
#define MAX_GENE          (ARB_UNIT*3)         /* seq, which holds readin */
#define LINE_LENGTH       (ARB_UNIT+100)       /* sequence data           */
#define GARG_EXACT     0x800                   /* used in function gargs  */
#define GARG_NEXT      0x1000                  /* used in function gargs  */
#define GARG_THERE     0x2000                  /* used in function gargs  */
#define GARG_SUBSQ     0x4000                  /* used in function gargs  */
#define MAX_ARGS       100                     /* used in function gargs  */
/*                                                debugging code          */
#define debug_         printf("Got to %i\n",debugger++); 
#define debug(x)       printf( #x " = %d", x);
/*                                                defile the macro pause  */
#define pause {fprintf(stderr,"\nPress return or enter to continue -> ");gets(pm->junk);}
#define MAX_FILENAME_LEN 90                   /* max filename             */

/* define the structures used within codonW                               */
typedef struct {
  char   *des;
  char   *typ;
  int    ca[65];
} GENETIC_CODE_STRUCT;                        /* genetic code information */  

typedef  struct { 
  char *aa1[22];                              /* 1 letter AA code         */ 
  char *aa3[22];                              /* 3 letter AA code         */  
  char *cod[65];                              /* 3 letter name of codons  */
} AMINO_STRUCT;                               

typedef struct {
  float hydro[22];                            /* hydropathicity values    */ 
  int   aromo[22];                            /* aromaticity values       */
} AMINO_PROP_STRUCT;
  
typedef struct  {
  char   *des;                                /* store a description      */
  char   *ref;                                /*       a reference        */
  char   fop_cod[65];                         /* the optimal codons       */
} FOP_STRUCT; 

typedef struct {
  char   *des;                                /* store a description      */
  char   *ref;                                /*       a reference        */
  float  cai_val[65];                         /* the CAI w values         */
} CAI_STRUCT;

typedef struct {  
char   level;                                 /* either expert or standard*/
int   axis;                                   /* how many axis to generate*/
int   rows;                                   /* how many genes in dataset*/
int   colm;                                   /* how many columns in data */
int   fop_gene;                   /* No of genes to use to ident opt codon*/
char  add_row[MAX_FILENAME_LEN];              /* file with supp sequences */
float inertia;                                /* total data inertia       */
char  codons[65];                             /* codon to be analysed     */
char  amino [22];                             /* amino acids to be COA'ed */
} COA_STRUCT;

typedef struct {
  char prog;                                  /* used to ident which prog */
  char bulk;                                  /* used to ident blk output */  
  char verbose;                          /* don't overwrite files    */
  char totals;                                /* concatenate genes ?      */
  char menu;                                  /* show a menu       ?      */
  char warn;                                  /* show sequence warning    */

  char codonW;                                /* am I codonW              */ 
  char fop;                                   /* calc index fop           */
  char cai;                                   /* calc index CAI           */
  char cbi;                                   /* calc index CBI           */
  char bases;                                 /* calc base composition    */
  char gc3s;                                  /* calc gc at sil.3rd base  */
  char gc;                                    /* calc gc                  */
  char enc;                                   /* calc enc                 */
  char sil_base;                              /* calc silent base compo   */
  char L_sym;                                 /* No of synonymous codons  */
  char L_aa;                                  /* No of amino acids        */
  char hyd;                                   /* calc hydropathicity      */
  char aro;                                   /* calc aromaticity         */
  
  char seperator;                             /* column separator         */
  char coa;                                   /* calculate a COA or not ? */
  
  char code;                                  /* which genetic code       */
  char f_type;                                /* which predefined fop val */
  char c_type;                                /* which predefined CAI val */
  
  char seq_type;                              /* DNA or Protein or CU     */
  char seq_format;                            /* Human or machine readable*/
  char curr_infilename [MAX_FILENAME_LEN];    /* input filename           */  
  char curr_outfilename[MAX_FILENAME_LEN];    /* .out filename            */   
  char curr_tidyoutname[MAX_FILENAME_LEN];    /* .blk filename            */ 
  char fop_filen[MAX_FILENAME_LEN];           /* user fop filename        */
  char cai_filen[MAX_FILENAME_LEN];           /* user CAI filename        */
  char cbi_filen[MAX_FILENAME_LEN];           /* user CBI filename        */
  char curr_logfilename[MAX_FILENAME_LEN];    /* used for logging errors  */

  char junk      [BUFSIZ+1];                  /* used to store char info  */
  char messages  [300];                       /* used to constuct messgs  */
  char analysis_run;                          /* has CodonW actually run  */

  int  term_length;                           /* how many lines are there */
                                              /* file pointers            */
  FILE *inputfile;                            /* input file               */ 
  FILE *outputfile;                           /* .out file                */
  FILE *tidyoutfile;                          /* .blk file                */
  FILE *cuout;                                /* codon usage output       */
  FILE *fopfile;                              /* fop input values         */
  FILE *caifile;                              /* cai input values         */  
  FILE *cbifile;                              /* cbi input values         */
  FILE *logfile;                              /* log file name            */
  FILE *my_err;                               /* pointer for err stream   */
  
  FILE *fcoa_in;                                 
  FILE *fcoa_out;
} MENU_STRUCT ;


#ifndef DECOSF
#define DEBUG                                 /* include debug  code      */ 
#endif

#ifndef TRUE
#define TRUE 1                                /* for dumb compilers       */
#endif

#ifndef FALSE
#define FALSE 0                               /* for dumb compilers       */
#endif


/* these handle how to delete files, and blank the screen                 */
#if defined _WINDOWS || defined _WIN32
# define deletefile(x) _unlink(x)
# define clearscr(x) {int n; for(n=0; n<x ;n++) printf("\n");}
#elif defined  _DOS
# define deletefile(x) _unlink(x)
# define clearscr(x) system("cls");
#else
# define deletefile(x)  remove(x)
#if defined DEBUG
# define clearscr(x) {int n; for(n=0; n<x ;n++) printf("\n");}
#else
# define clearscr(x) system("clear");
#endif
#endif

#ifdef ORIG_DEFS                                 /* declare only once     */ 
char Revision[] = "1.4.4";                       /* version               */
char Update[]   = "$Date: 2005/05/11 21:43:49 $";/* date                  */
char Author[]   = "$Author: johnfpeden $";       /* author                */
char  title[100];                                /* sequence description  */
char  long_seq;                                  /* length of seq title   */ 
char  last_base;
long int ncod[65];
long int naa[23];
long int din[3][16];
long int codon_tot;
long int master_ic;
long int fl_pos_start;        
long int fl_pos_curr;
long int GC_TOT;
long int AT_TOT;
long int AA_TOT;
long int IUBC_TOT;
long int GAP_TOT; 
long int num_sequence;
long int num_seq_int_stop;
long int non_std_char;
long int tot;
int last_aa = 0;
int reg = 1;
int valid_stops;
int valid_start;
int fram;              
int *da;
int *ds;

AMINO_STRUCT         *paa;                       /* pointer to structs   */
GENETIC_CODE_STRUCT  *pcu;
FOP_STRUCT           *pfop;
FOP_STRUCT           *pcbi;
CAI_STRUCT           *pcai;
MENU_STRUCT          *pm;
COA_STRUCT           *pcoa;
AMINO_PROP_STRUCT    *pap;


                                                /* declare default values */           
COA_STRUCT coa={
'n',                                            /* level                  */
4,                                              /* axis                   */
0,                                              /* rows  or genes         */
64,                                             /* colms                  */
-5,               /* fop_gene (if number is negative implies a percentage)*/ 
"",                                             /* add_row                */
(float) 0.00                                    /* inertia                */
};       

int NumGeneticCodes=8;                          /* used in menu.c         */
                                                /* No. of predefined codes*/

                                                /* define genetic codes   */    
GENETIC_CODE_STRUCT  cu[] = { 
  "Universal Genetic code",
  "TGA=* TAA=* TAG=*",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 11,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  3,  8, 15, 20,  4,  8, 15, 20,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
  "Vertebrate Mitochondrial code",
  "AGR=* ATA=M TGA=W",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 19,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  4,  8, 15, 11,  4,  8, 15, 11,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
  "Yeast Mitochondrial code",
  "CTN=* ATA=M TGA=W",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 19,  2,  6, 11, 19,
  8,  7, 12, 20,  8,  7, 12, 20,  8,  7, 13, 20,  8,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  4,  8, 15, 20,  4,  8, 15, 20,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
  "Filamentous fungi Mitochondrial code",
  "TGA=W",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 19,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  3,  8, 15, 20,  4,  8, 15, 20,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
  "Insects and Plathyhelminthes Mitochondrial code",
  "ATA=M TGA=W AGR=S",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 19,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  4,  8, 15,  6,  4,  8, 15,  6,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
 "Nuclear code of Cilitia",
 "UAA=Q=Gln  UAG=Q",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 13, 11,  2,  6, 13, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  3,  8, 15, 20,  4,  8, 15, 20,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
 "Nuclear code of Euplotes",
 "UGA=C",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 18,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  3,  8, 15, 20,  4,  8, 15, 20,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21,
  "Mitochondrial code of Echinoderms",
  "UGA=W AGR=S AAA=N",
  0,
  1,  6, 10, 18,  1,  6, 10, 18,  2,  6, 11, 19,  2,  6, 11, 19,
  2,  7, 12, 20,  2,  7, 12, 20,  2,  7, 13, 20,  2,  7, 13, 20,
  3,  8, 14,  6,  3,  8, 14,  6,  3,  8, 14,  6,  4,  8, 15,  6,
  5,  9, 16, 21,  5,  9, 16, 21,  5,  9, 17, 21,  5,  9, 17, 21
};
                                            /* define amino acid info     */
AMINO_STRUCT amino_acids ={
 "X",
 "F","L","I","M","V",
 "S","P","T","A","Y",
 "*","H","Q","N","K",
 "D","E","C","W","R","G",
 "UNK",
 "Phe","Leu","Ile","Met","Val",
 "Ser","Pro","Thr","Ala","Tyr",
 "TER","His","Gln","Asn","Lys",
 "Asp","Glu","Cys","Trp","Arg","Gly",
 "BAD",
 "UUU","UCU","UAU","UGU",
 "UUC","UCC","UAC","UGC",
 "UUA","UCA","UAA","UGA",
 "UUG","UCG","UAG","UGG",
 "CUU","CCU","CAU","CGU",
 "CUC","CCC","CAC","CGC",
 "CUA","CCA","CAA","CGA",
 "CUG","CCG","CAG","CGG",
 "AUU","ACU","AAU","AGU",
 "AUC","ACC","AAC","AGC",
 "AUA","ACA","AAA","AGA",
 "AUG","ACG","AAG","AGG",
 "GUU","GCU","GAU","GGU",
 "GUC","GCC","GAC","GGC",
 "GUA","GCA","GAA","GGA",
 "GUG","GCG","GAG","GGG"
};

int NumFopSpecies=8;                             /* again used in menu.c  */
                                                 /* predefined fop info   */   
FOP_STRUCT  fop[] = { 
  "Escherichia coli",
  "Ikemura (1985) Mol. Biol. Evol. 2:13-34 (updated by INCBI 1991)",
0,2,3,2,2,3,3,3,3,2,2,2,2,2,2,2,2,
  2,2,2,3,2,2,3,3,2,2,2,2,3,3,3,2, 
  2,3,2,2,3,3,3,3,2,2,3,2,2,2,2,2,
  3,3,2,3,2,2,3,3,2,2,3,2,2,3,2,2,
  "Bacillus subtilis ",
  "Sharp et al (1990) Genetics & Biotech of Bacilli vol3 pp89-98",
0,2,3,2,2,3,1,3,2,2,2,2,2,2,1,2,2,
  3,3,2,3,2,1,2,3,2,3,3,1,2,2,2,1, 
  2,3,2,2,3,1,3,2,1,2,3,2,2,2,2,1,
  3,3,2,3,2,1,3,2,3,2,3,2,2,2,2,1,
  "Dictyostelium discoideum ",
  "Sharp and Devine (1989) Nucl. Acids Res 17:5029-5039)",
0,2,2,2,2,3,2,3,2,2,2,2,2,2,2,2,2,
  2,2,2,3,3,2,3,2,2,3,3,2,2,2,2,2, 
  2,2,2,2,3,3,3,2,2,2,2,2,2,2,3,2,
  2,2,2,3,3,3,2,2,2,2,3,2,2,2,2,2,
  "Aspergillus nidulans ",
  "Lloyd and Sharp (1991) Mol. Gen. Genet 230: 288-294",
0,2,2,2,2,3,3,3,2,2,2,2,2,2,2,2,2,
  2,2,2,3,3,3,3,3,2,2,2,2,2,2,3,2, 
  2,2,2,2,3,3,3,2,2,2,2,2,2,2,3,2,
  2,3,2,3,3,3,3,2,2,2,2,2,2,2,3,2,
  "Saccharomyces cerevisiae ",
  "Sharp and Cowe (1991) Yeast 7:657-678",
0,2,3,2,3,3,3,3,2,2,2,2,2,3,2,2,2,
  2,2,2,2,2,2,3,2,2,3,3,2,2,2,2,2, 
  3,3,2,2,3,3,3,2,2,2,2,3,2,2,3,2,
  3,3,2,3,3,2,3,2,2,2,3,2,2,2,2,2,
  "Drosophila melanogaster",
  "Shields et al. (1988) Mol Biol Evol 5: 704-716",
0,2,2,2,2,3,3,3,3,2,2,2,2,2,2,2,2,
  2,2,2,3,2,3,3,3,2,2,2,2,3,2,3,2, 
  2,2,2,2,3,3,3,2,2,2,2,2,2,2,3,2,
  2,2,2,2,3,3,3,3,2,2,2,2,3,2,3,2,
 "Caenorhabditis elegans",
 "Stenico, Lloyd and Sharp Nuc. Acids Res. 22: 2437-2446(1994)",
0,2,2,2,2,3,3,3,3,2,2,2,2,2,2,2,2,
  3,2,2,3,3,2,3,3,2,3,2,2,2,2,2,2, 
  2,2,2,2,3,3,3,2,2,2,2,2,2,2,3,2,
  2,3,2,2,3,3,3,2,2,2,2,3,2,2,3,2,
 "Neurospora crassa",
 "Lloyd and Sharp (1993)",
0,2,3,2,2,3,3,3,3,2,2,2,2,2,2,2,2,
  2,2,2,3,3,3,3,3,2,2,2,2,2,2,3,2,
  2,3,2,2,3,3,3,2,2,2,2,2,2,2,3,2,
  2,2,2,3,3,3,3,3,2,2,2,2,2,2,3,2
};

int NumCaiSpecies=3;                              /* used in menu.c       */
CAI_STRUCT cai[]= {                               /* array of cai structs */
  "Escherichia coli",
  "No reference",
  0.000F,
    0.296F,1.000F,0.239F,0.500F,1.000F,0.744F,1.000F,1.000F,
    0.020F,0.077F,0.000F,0.000F,0.020F,0.017F,0.000F,1.000F,
    0.042F,0.070F,0.291F,1.000F,0.037F,0.012F,1.000F,0.356F,
    0.007F,0.135F,0.124F,0.004F,1.000F,1.000F,1.000F,0.004F,
    0.185F,0.965F,0.051F,0.085F,1.000F,1.000F,1.000F,0.410F,
    0.003F,0.076F,1.000F,0.004F,1.000F,0.099F,0.253F,0.002F,
    1.000F,1.000F,0.434F,1.000F,0.066F,0.122F,1.000F,0.724F,
    0.495F,0.586F,1.000F,0.010F,0.221F,0.424F,0.259F,0.019F,
  "Bacillus subtilis",
  "No reference",
  0.00F,
     0.571F,1.000F,0.500F,1.000F,1.000F,0.021F,1.000F,1.000F,
     1.000F,0.458F,0.000F,0.000F,0.036F,0.021F,0.000F,1.000F,
     0.857F,1.000F,1.000F,1.000F,0.143F,0.071F,0.083F,0.609F,
     0.500F,0.714F,1.000F,0.022F,0.071F,0.143F,0.214F,0.043F,
     0.500F,1.000F,0.417F,0.125F,1.000F,0.033F,1.000F,0.208F,
     0.071F,0.867F,1.000F,0.435F,1.000F,0.200F,0.097F,0.022F,
     1.000F,1.000F,0.417F,0.955F,0.188F,0.025F,1.000F,0.773F,
     0.750F,0.275F,1.000F,1.000F,0.438F,0.125F,0.412F,0.045F,
  "Saccharomyces cerevisiae",
  "Sharp and Cowe (1991) Yeast 7:657-678",
  0.00F,
    0.113F,1.000F,0.071F,1.000F,1.000F,0.693F,1.000F,0.077F,
    0.117F,0.036F,0.000F,0.000F,1.000F,0.005F,0.000F,1.000F,
    0.006F,0.047F,0.245F,0.137F,0.003F,0.009F,1.000F,0.002F,
    0.039F,1.000F,1.000F,0.002F,0.003F,0.002F,0.007F,0.002F,
    0.823F,0.921F,0.053F,0.021F,1.000F,1.000F,1.000F,0.031F,
    0.003F,0.012F,0.135F,1.000F,1.000F,0.006F,1.000F,0.003F,
    1.000F,1.000F,0.554F,1.000F,0.831F,0.316F,1.000F,0.020F,
    0.002F,0.015F,1.000F,0.002F,0.018F,0.001F,0.016F,0.004F
};


AMINO_PROP_STRUCT amino_prop={                   /* amino acid properties */
  0.00F,                
  2.80F,3.80F,4.50F,1.90F,4.20F,                 /* hydropathicity values */
  -0.8F,-1.6F,-0.7F,1.80F,-1.3F,   
  1.00F,-3.2F,-3.5F,-3.5F,-3.9F,
  -3.5F,-3.5F,2.50F,-0.9F,-4.5F,
  -0.4F,
  0,
  1,0,0,0,0,                                     /* am i aromatic ?       */ 
  0,0,0,0,1,
  0,0,0,0,0,
  0,0,0,1,0,0 
};


MENU_STRUCT Z_menu={  /* define all manner of default values              */
  FALSE,              /* prog                                             */
  'X',                /*This default is set in proc_commline to CU        */
  TRUE ,              /*verbose                                      */
  FALSE,              /*totals                                            */
  TRUE,               /*menu interface                                    */
  TRUE,               /*warnings about sequence data are to be displayed  */
  FALSE,              /*codons                                            */  
  FALSE,              /*fop                                               */  
  FALSE,              /*cai                                               */ 
  FALSE,              /*cbi                                               */ 
  FALSE,              /*bases                                             */  
  FALSE,              /*gc3s                                              */
  FALSE,              /*gc                                                */  
  FALSE,              /*enc                                               */
  FALSE,              /* silent base                                      */ 
  FALSE,              /* Length silent codons                             */
  FALSE,              /* length in codons                                 */
  FALSE,              /* hydrophobicity                                   */
  FALSE,              /* aromaticity                                      */
    
  ' ',                /* default seperator                                */
   
  FALSE,              /* coa                                              */
   
  0,                  /* genetic code                                     */
  0,                  /* type of fop_species                              */ 
  0,                  /* type of cai_species                              */
  
  FALSE,              /* sequence type                                    */
  'H',                /* Sequence format                                  */
  "",                 /* current input file name                          */
  "",                 /* current output file name                         */
  "",                 /* current tidy outfile name                        */
  "",                 /* current fop input file name                      */
  "",                 /* current cai input file name                      */
  "",                 /* current sbi input file name                      */
  "",                 /* log all stderr output to a file                  */
  "",                 /* Null the string junk                             */  
  "",                 /* Null the string messages                         */
   
  FALSE,              /* was analysis run                                 */     
  24,                 /* current number of lines (height of ) screen      */ 
  
  NULL,               /* Null pointer input file                          */   
  NULL,               /* Null pointer outputfile                          */   
  NULL,               /* Null pointer tidyout file                        */   
  NULL,               /* Null codon usage file                            */
  NULL,               /* Null pointer fopfile                             */
  NULL,               /* Null pointer caifile                             */ 
  NULL,               /* Null pointer cbifile                             */ 
  NULL,               /* Null pointer the logfile name                    */
  NULL,               /* assign NULL pointer to my_err                    */
  NULL,               /* Null pointer fcoa_in                             */
  NULL                /* Null pointer fcoa_out                            */
};


#else                 /* already been defined so declare as externals     */      

extern AMINO_STRUCT         *paa;
extern GENETIC_CODE_STRUCT  *pcu;
extern FOP_STRUCT           *pfop;
extern FOP_STRUCT           *pcbi;
extern CAI_STRUCT           *pcai;
extern MENU_STRUCT          *pm;
extern COA_STRUCT           *pcoa;
extern AMINO_PROP_STRUCT    *pap;

#if defined (_WINDOWS) || defined (_DOS) 
 extern   CAI_STRUCT          /*_near*/ cai[];       /* some MS compilers  */
 extern   GENETIC_CODE_STRUCT /*_near*/ cu[];        /* want these to be   */ 
 extern   FOP_STRUCT          /*_near*/ fop[];       /* declared as _near  */
#else                
 extern CAI_STRUCT                cai[];
 extern GENETIC_CODE_STRUCT        cu[];
 extern FOP_STRUCT                fop[];
#endif
 extern COA_STRUCT                coa;
 extern AMINO_STRUCT              amino_acids;
 extern AMINO_PROP_STRUCT         amino_prop;
 extern MENU_STRUCT               Z_menu; 

 extern char Revision[];                             /* version string    */
 extern char Update[];
 extern char Author[];
 extern char  title[100];
 extern char  long_seq;
 extern char  last_base;

 extern long int ncod[65];
 extern long int naa[23];
 extern long int din[3][16];
 extern long int codon_tot;
 extern long int master_ic;
 extern long int fl_pos_start;
 extern long int fl_pos_curr;
 extern long int GC_TOT;
 extern long int AT_TOT;
 extern long int AA_TOT;
 extern long int IUBC_TOT;
 extern long int GAP_TOT; 
 extern long int num_sequence;
 extern long int num_seq_int_stop;
 extern long int non_std_char;
 extern long int tot;
 extern int last_aa;
 extern int reg;
 extern int valid_stops;
 extern int valid_start;
 extern int fram;      
 extern int *da;
 extern int *ds;
 extern int NumGeneticCodes;
 extern int NumFopSpecies;
 extern int NumCaiSpecies;
#endif

/****************** Function type declarations *****************************/

FILE *open_file    ( char *info, char *default_name, char *mode, 
                     int  verbose );

int*  how_synon    ( void );
int*  how_synon_aa ( void );
int*  how_synon    ( void );
int*  how_synon_aa ( void );

int codon_usage_tot( char *seq, long int how_many); 
int ident_codon    ( char *codon );
int codon_usage_out( FILE *fblkout, long int *ncod,int last_aa,
                     int valid_stops, char *info);
int rscu_usage_out ( FILE *fblkout, long int *ncod,long int *naa);
int raau_usage_out ( FILE *fblkout, long int *naa );
int aa_usage_out   ( FILE *fblkout, long int *naa );
int cai_out        ( FILE *foutput, long int *ncod); 
int cbi_out        ( FILE * foutput, long int *ncod, long int *naa );
int fop_out        ( FILE *foutput, long int *ncod);
int hydro_out      ( FILE *foutput, long int *naa );
int aromo_out      ( FILE *foutput, long int *naa );
int toutput        ( FILE *fblkout, char *seq );
int output_long    ( FILE *fblkout, char *seq );
int cutab_out      ( FILE *fblkout, long *ncod, long *naa);
int dinuc_out      ( FILE *fblkout, char *title  );
int fileclose      ( FILE **file_pointer );
int clean_up       ( long int *ncod,long int *naa );
int initilize_point( char code , char fop_type, char cai_type );
int initilize_coa  ( char code );
int proc_comm_line ( int *argc, char ***arg_list);
int my_exit        ( int exit_value, char *message );          
int printinfo      ( void); 

int dinuc_count    ( char *seq , long int tot );
int tidy           ( FILE *finput , FILE *foutput , FILE *fblkout, 
                     FILE *fcoaout ) ;  
int chelp ( char *help );

long int codon_error( int last_aa, int valid_stops, char *title, 
                      char error_level);

float  enc_out      ( FILE *foutput, long int *ncod, long int *naa);
double inertot      ( void);

char* get_aa        ( int one_or_3_letter , char* the_dna_word);
char* garg          ( int argc, char *argv[], const char *targ, int mode);
char  coa_raw_out   ( FILE *fcoaout, long *ncod, long *naa, char *title);
char  WasHelpCalled ( char * input); 

void sorted_by_axis1( double *ax1, int *sortax1, int lig);
void highlow        ( long int *low , long int *high ,FILE *summ );
void menu_1         ( void);
void menu_2         ( void);
void menu_3         ( void);
void menu_4         ( void);
void menu_5         ( void);
void menu_6         ( void); 
void menu_7         ( void);
void menu_8         ( void);
void menu_coa       ( void);
void welcome        ( void);
void menu_initial   ( void);

void asummary       ( void);
void tester         ( void);
void vecalloc       ( double **vec, int n);
void vecalloc       ( double **vec, int n);
void writevec       ( double *v1, FILE *fic);
void lecmat         ( double **tab, char *nfic);
void freetab        ( double **tab);
void freevec        ( double *vec);
void taballoc       ( double ***tab, int l1, int c1);
void lecvec         ( double *v1, char *nfic);
void ecrmat         ( double **tab, char *nfic);
void ecrvec         ( double *v1, char *nfic);
void scalmat        ( double **tab, double r);
void scalvec        ( double *v1, double r);
void sqrvec         ( double *v1);
void prodmatAAtB    ( double **a, double **b);
void prodmatABC     ( double **a, double **b, double **c);
void prodmatAtAB    ( double **a, double **b);
void ecrmatred      ( double **tab, int c1, char *nfic);
void readvec        ( double *v1, FILE *fic);
void lecvalpro      ( double *v1, char *nfic);
void writescal      ( double r,  FILE *fic);
void editvalpro     ( FILE *ficlist, double *vp, int n, double s);
void DiagoRC        ( FILE *summary);
void gc_out         ( FILE *foutput, FILE *fblkout, int which);
void base_sil_us_out( FILE *foutput, long int *ncod,long int *naa);
void bintext        ( char *nfice , char *nfics);
void select_coa     ( char choice); 
void textbin        ( char *filein , char *fileout);
void colmout        ( char *nfice, char *nfics,AMINO_STRUCT *paa,
                                   FILE *summary);   
void output         ( char *seq ,  FILE *foutput , FILE* fblkout ,
                                   FILE *fcoaout);
void rowout         ( char *nfice, char *nfics, char *ncout, FILE *summary);
void PrepAFC        ( char *nfic);
void inertialig     ( char *inertia_out, char *filen, FILE *summary);
void inertiacol     ( char *inertia_out, FILE *summary);
void selectcol      ( char *nfic , double *col, int numcol);
void gen_cusort_fop ( int *sortax1, int lig , FILE *fnam ,FILE *summ ); 
void dot            ( int y    ,  long int period ); 
void DiagoComp      ( int n0, double **w, double *d, int *rang);
void suprow         ( int num_seq,char *nficvp,char *nfictasup,
                      char *nficlisup,char *option, FILE *summary);
void main_menu      ( int c );