83f5d58ddf90a7a4c6600ad099ad038ae747df66
[jabaws.git] / binaries / src / tcoffee / t_coffee_source / t_coffee.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <math.h>
4 #include <stdarg.h>
5 #include <signal.h>
6 #include <string.h>
7
8 #include "io_lib_header.h"
9 #include "util_lib_header.h"
10 #include "dp_lib_header.h"
11 #include "define_header.h"
12 #include "t_coffee.h"
13 static void test();
14 static char * get_seq_type_from_cl (int argc, char **argv);
15 static char *get_defaults(char *buf, char *type);
16 static char *get_evaluate_defaults(char *buf, char *type);
17 static char *get_genome_defaults(char *buf, char *type);
18 static char *get_dali_defaults(char *buf, char *type);
19 static char *get_mcoffee_defaults(char *buf, char *type);
20 static char *get_fmcoffee_defaults(char *buf, char *type);
21 static char *get_t_coffee_defaults(char *buf, char *type);
22
23 static char *get_dmcoffee_defaults(char *buf, char *type);
24 static char *get_rcoffee_consan_defaults(char *buf, char *type);
25
26 static char *get_rmcoffee_defaults(char *buf, char *type);//Original R-Coffee Paper
27 static char *get_rcoffee_defaults(char *buf, char *type);//Original R-Coffee Paper
28 static char *get_rmcoffee_defaults_old(char *buf, char *type);//Original R-Coffee Paper
29 static char *get_rcoffee_defaults_old(char *buf, char *type);//Original R-Coffee Paper
30 static char *get_best4RNA_defaults(char *buf, char *type);
31
32 static char *get_very_fast_defaults(char *buf, char *type);
33 static char *get_precomputed_defaults(char *buf, char *type);
34 static char *get_3dcoffee_defaults(char *buf, char *type);
35 static char *get_expresso_defaults(char *buf, char *type);
36
37 static char *get_accurate_defaults(char *buf, char *type);
38 static char *get_accurate4PROTEIN_defaults(char *buf, char *type);
39 static char *get_accurate4DNA_defaults(char *buf, char *type);
40 static char *get_accurate4RNA_defaults(char *buf, char *type);
41
42 static char *get_psicoffee_defaults(char *buf, char *type);
43 static char *get_dna_defaults(char *buf, char *type);
44 static char *get_cdna_defaults(char *buf, char *type);
45 static char *get_repeat_defaults(char *buf, char *type);
46 static char *get_low_memory_defaults( char *buf, char *type);
47
48 static int set_methods_limits (char **method_limits,int n_methods_limit,char **list_file, int n_list, int *maxnseq, int *maxlen);
49 static FILE *t_coffee_tip (FILE *fp,char *mode);
50
51 static int run_other_pg(int argc, char *argv[]);
52 static char* prepare_one2all (char *seq,Sequence *S, char *lib_file);
53 static char* prepare_subset2all (char *seq,Sequence *S, char *lib_file, Constraint_list *CL);
54
55 #define is_a_seq_file(file) (!is_matrix(file) && !is_matrix(file+1) && !is_method (file) && !is_method (file+1) &&(check_file_exists(file) || check_file_exists(file+1))) 
56 static int NO_METHODS_IN_CL;
57 int batch_main ( int argc, char **argv);
58 int main (int argc, char *argv[])
59 {
60   int r, a;
61
62   if (argc>=2 && strcmp (argv[1], "-batch")==0)
63     {
64       char **list;
65       list=file2lines (argv[2]);
66       for (a=1; a<atoi (list[0]); a++)
67         {
68           char **com;
69           com=string2list (list[a]);
70           r=batch_main (atoi (com[0])-1, com+1);
71           free_char (com, -1);
72         }
73     }
74   else
75     {
76       r=batch_main (argc, argv);
77     }
78   myexit (r);
79 }
80 int batch_main ( int argc, char **argv)
81         {
82         
83         int a, b, c, t;
84         char *f;
85
86         Sequence *S;
87         char **new_order;
88         char **initial_order;
89
90         Fname *F=NULL;
91         Constraint_list *CL;
92         Alignment  *A=NULL, *EA=NULL;
93         Alignment  **aln_list;
94         
95         FILE *OUT;      
96
97         
98         NT_node **T=NULL;
99         int tot_node;
100         char *pc;
101 /*Parameters*/
102
103         int check_configuration;
104         int update;
105         int garbage;
106         int quiet;
107         char *parameters;
108         char *t_coffee_defaults;
109         int t_coffee_defaults_flag;
110                 
111         FILE *le=NULL;
112         char *se_name;
113         char *run_name;
114         
115         char *mem_mode;
116         
117         int do_extend;
118         char *extend_mode;
119         int max_n_pair;
120         int  nseq_for_quadruplet;
121         char **seq_name_for_quadruplet;
122         
123         int do_compact;
124         int **do_list;
125         int n_do;
126
127         char *compact_mode;
128         int do_clean;
129         char *clean_mode;
130         int do_self;
131         int do_normalise;
132         
133
134
135         int n_list;
136         char **list_file;
137         
138
139         char **template_file_list;
140         int n_template_file;
141
142         char **template_mode_list;
143         int n_template_mode;
144         
145         
146
147         int remove_template_file;
148         
149         char **profile_template_file_list;
150         int n_profile_template_file;
151         
152         int n_pdb;
153         char **pdb_list;
154         int pdb_start, pdb_end;
155         char *pdb_name;
156
157         char *out_lib;
158         char *out_lib_mode;
159         int shrink_lib;
160         int relax_lib;
161         int filter_lib;
162         int processed_lib;
163         
164         int lib_only;
165         char *outseqweight;
166
167
168
169         char *seq_source;
170         
171         int cosmetic_penalty,gop,f_gop, gep,f_gep, nomatch;
172         
173         char *tree_file;
174         char *ph_tree_file;
175         
176         char *use_tree;
177         char *tree_mode;
178         char *distance_matrix_mode;
179         char *distance_matrix_sim_mode;
180         
181         int quicktree;
182         char *out_aln;
183         char **tot_out_aln;
184         int maximise;
185         char **out_aln_format;
186         int  n_out_aln_format;
187         char *infile;
188         char *matrix;
189         char *dp_mode;
190         char *profile_mode;
191         char *profile_comparison;
192         
193         
194         int tg_mode;
195         int   ktup;
196         int   fasta_step;
197         int   diag_threshold;
198         int   diag_mode;
199         char *sim_matrix;
200
201         char *type;
202         int check_type;
203         int type_only;
204         char *transform;
205         char *outorder;
206         char  *inorder;
207         char *output_res_num;
208         char *residue_case;
209         int extra_cpu;
210
211
212         char *weight;
213
214         char *seq_weight;
215         int do_align;
216         char *evaluate_mode;
217         char *method_evaluate_mode;
218         int get_type;
219         /*Post_processing*/
220         int clean_aln;
221         int clean_threshold;
222         int clean_iteration;
223         char *clean_evaluate_mode;
224         /*Profile Alignment*/
225         
226         int n_seq_list;
227         char **seq_list;
228         
229         char **method_list;
230         int n_method_list;
231
232                 
233         char **method_limits;
234         int n_method_limits;
235                 
236         char **aln_file_list;
237         int n_aln_file_list;
238         
239         char **lib_file_list;
240         int n_lib_file_list;
241         
242         char **profile_list;
243         int n_profile_list;
244         
245         char *profile1;
246         char *profile2;
247
248         /*Domain Parameters*/
249         int do_domain;
250         int domain_start;
251         int domain_len;
252         int domain_scale;
253         int domain_interactive;
254         /* extended matrix analysis*/
255         int do_extended_matrix;
256         /*Action Parameters*/
257         int do_evaluate;
258         int do_convert;
259         int do_version;
260
261         int maxnseq;
262         int maxlen;
263         /*Thread parameters*/
264         int prot_min_sim;
265         int prot_max_sim;
266         int prot_min_cov;
267         int pdb_min_sim;
268         int pdb_max_sim;
269         int pdb_min_cov;
270         
271
272         
273         char *prot_blast_server;
274         char *pdb_blast_server;
275         
276         
277         char *pdb_db;
278         char *prot_db;
279         NT_node *SNL;
280         
281         /*
282         char *dna_db;
283         char *dna_blast_server;
284         int dna_min_sim;
285         int dna_max_sim;
286         int dna_min_cov;
287         */
288
289
290         /*Method log*/
291         char * method_log;      
292
293         char **struc_to_use;
294         int n_struc_to_use;
295
296         /*Cache*/
297         char * cache;
298
299         /*align_pdb*/
300         char *align_pdb_param_file;
301         char *align_pdb_hasch_mode;
302
303         /*msa_mode*/
304         char *use_seqan;
305         char *msa_mode;
306         char *one2all;
307         char *subset2all;
308         
309         int lalign_n_top;
310         int iterate;
311         /*split*/
312         int split;
313         int split_nseq_thres;
314         int split_score_thres;
315         char split_name[1000];
316         char split_format[1000];
317         Alignment *SPLIT_ALN;
318         
319         int check_pdb_status;
320         /*trim*/
321         int trim;
322         Sequence *trim_subS=NULL;
323         Sequence *trim_S=NULL;
324         Sequence *SEQ_TO_KEEP=NULL;
325         char *trimfile;
326         char trim_format[1000];
327         int clean_seq_name;
328         int n_seq_to_keep;
329         char **seq_to_keep;
330         char **special_mode_list;
331         int n_special_mode;
332         char **special_mode_list1;
333         int n_special_mode1;
334         char **special_mode_list2;
335         int n_special_mode2;
336         /*dpa*/
337         int dpa;
338         char *dpa_master_aln;
339         int dpa_min_score1;
340         int dpa_min_score2;
341         int dpa_maxnseq;
342         int dpa_keep_tmpfile;
343         int dpa_debug;
344         /*error report*/
345         char *full_log;
346
347         /*Multithread*/
348         char *multi_core;
349         int   n_core;
350         
351         char *lib_list;
352         char *prune_lib_mode;
353         
354         int no_error_report;
355         int no_warning=0;
356         char *tip;
357         int run_local_script;
358         char *plugins;
359         char *email;
360         char *proxy;
361         
362         char *rna_lib;
363         /*over_aln*/
364         char  **overaln_param;
365         char    n_overaln_param;
366         char  * exon_boundaries;
367         char  * overaln_mode;
368         char  *overaln_model;
369         int    overaln_P1;
370         int    overaln_P2;
371         int    overaln_P3;
372         int    overaln_P4;
373         
374         int     overaln_threshold;
375         int     overaln_target;
376         int     clean_overaln;
377         
378         argv=standard_initialisation_start (argv, &argc);
379         set_string_variable ("t_coffee", argv[0]);
380         
381 /*Running other programs via T-Coffee*/
382         if (argc>=3 && strm (argv[1], "-other_pg"))
383           {
384             standard_initialisation_start (NULL,NULL);
385             return run_other_pg (argc-2, argv+2);
386           }
387
388 /*PARAMETER PROTOTYPE:    READ PARAMETER FILE     */
389                  get_cl_param(\
390                             /*argc*/      argc             ,\
391                             /*argv*/      argv             ,\
392                             /*output*/    &le              ,\
393                             /*Name*/      "-no_error_report"        ,\
394                             /*Flag*/      &garbage        ,\
395                             /*TYPE*/      "D"              ,\
396                             /*OPTIONAL?*/ OPTIONAL         ,\
397                             /*MAX Nval*/  1                ,\
398                             /*DOC*/       "Limit the maximum memory usage (in Megabytes). 0: no limit" ,\
399                             /*Parameter*/ &no_error_report          ,\
400                             /*Def 1*/     "0"             ,\
401                             /*Def 2*/     "1"             ,\
402                             /*Min_value*/ "any"            ,\
403                             /*Max Value*/ "any"             \
404                                           );         
405
406 /*PARAMETER PROTOTYPE:    READ PARAMETER FILE     */
407                declare_name (parameters);
408                get_cl_param(\
409                             /*argc*/      argc             ,\
410                             /*argv*/      argv             ,\
411                             /*output*/    &le              ,\
412                             /*Name*/      "-parameters"        ,\
413                             /*Flag*/      &garbage        ,\
414                             /*TYPE*/      "R_F"              ,\
415                             /*OPTIONAL?*/ OPTIONAL         ,\
416                             /*MAX Nval*/  1                ,\
417                             /*DOC*/       "get bottom parameters" ,\
418                             /*Parameter*/ &parameters          ,\
419                             /*Def 1*/     "NULL"             ,\
420                             /*Def 2*/     "stdin"             ,\
421                             /*Min_value*/ "any"            ,\
422                             /*Max Value*/ "any"             \
423                    );
424                  
425                
426                special_mode_list1=declare_char (100, STRING);
427             
428                n_special_mode1=get_cl_param(                    \
429                             /*argc*/      argc             ,\
430                             /*argv*/      argv             ,\
431                             /*output*/    &le              ,\
432                             /*Name*/      "-mode"        ,\
433                             /*Flag*/      &garbage        ,\
434                             /*TYPE*/      "S"              ,\
435                             /*OPTIONAL?*/ OPTIONAL         ,\
436                             /*MAX Nval*/  100                ,\
437                             /*DOC*/       "specifies a special mode: genome, quickaln, dali, 3dcoffee" ,\
438                             /*Parameter*/ special_mode_list1          ,\
439                             /*Def 1*/     "unspecified"             ,\
440                             /*Def 2*/     "HARD_CODED"       ,\
441                             /*Min_value*/ "any"            ,\
442                             /*Max Value*/ "any"             \
443                    );
444
445                
446                special_mode_list2=declare_char (100, STRING);
447                n_special_mode2=get_cl_param(\
448                             /*argc*/      argc             ,\
449                             /*argv*/      argv             ,\
450                             /*output*/    &le              ,\
451                             /*Name*/      "-special_mode"        ,\
452                             /*Flag*/      &garbage        ,\
453                             /*TYPE*/      "S"              ,\
454                             /*OPTIONAL?*/ OPTIONAL         ,\
455                             /*MAX Nval*/  100                ,\
456                             /*DOC*/       "[DEPRECATED ** -special_mode is deprected use -mode instead]" ,\
457                             /*Parameter*/ special_mode_list2          ,\
458                             /*Def 1*/     "unspecified"             ,\
459                             /*Def 2*/     "HARD_CODED"       ,\
460                             /*Min_value*/ "any"            ,\
461                             /*Max Value*/ "any"             \
462                    );   
463            
464                special_mode_list=declare_char (n_special_mode1+n_special_mode2, STRING);
465                n_special_mode=0;
466                for (a=0; a<n_special_mode1; a++)
467                  if (!strm (special_mode_list1[a], "unspecified"))sprintf ( special_mode_list[n_special_mode++], "%s", special_mode_list1[a]);
468                for (a=0; a<n_special_mode2; a++)
469                  if (!strm (special_mode_list2[a], "unspecified"))sprintf ( special_mode_list[n_special_mode++], "%s", special_mode_list2[a]);
470                free_char (special_mode_list1, -1);
471                free_char (special_mode_list2, -1);
472            
473                declare_name (t_coffee_defaults);
474                get_cl_param(\
475                             /*argc*/      argc             ,\
476                             /*argv*/      argv             ,\
477                             /*output*/    &le              ,\
478                             /*Name*/      "-t_coffee_defaults"        ,\
479                             /*Flag*/      &t_coffee_defaults_flag     ,\
480                             /*TYPE*/      "R_F"              ,\
481                             /*OPTIONAL?*/ OPTIONAL         ,\
482                             /*MAX Nval*/  1                ,\
483                             /*DOC*/       "get top parameters" ,\
484                             /*Parameter*/ &t_coffee_defaults          ,\
485                             /*Def 1*/     "NULL"             ,\
486                             /*Def 2*/     "NULL"       ,\
487                             /*Min_value*/ "any"            ,\
488                             /*Max Value*/ "any"             \
489                    );
490                /*PARAMETER PROTOTYPE:    -type_only: must stay here: needed by special_mode    */
491                get_cl_param(\
492                             /*argc*/      argc           ,\
493                             /*argv*/      argv           ,\
494                             /*output*/    &le            ,\
495                             /*Name*/      "-type_only"        ,\
496                             /*Flag*/      &type_only       ,\
497                             /*TYPE*/      "FL"            ,\
498                             /*OPTIONAL?*/ OPTIONAL       ,\
499                             /*MAX Nval*/  1              ,\
500                             /*DOC*/       "exit after checking the type and returning it to the stdout",\
501                             /*Parameter*/ &type_only          ,\
502                             /*Def 1*/    "0"              ,\
503                             /*Def 2*/    "1"              ,\
504                             /*Min_value*/ "any"          ,\
505                             /*Max Value*/ "any"           \
506                    );   
507                /*PARAMETER PROTOTYPE:    CHECK_TYPE     */
508                get_cl_param(                                    \
509                             /*argc*/      argc          ,\
510                             /*argv*/      argv          ,       \
511                             /*output*/    &le           ,       \
512                             /*Name*/      "-check_type"  ,      \
513                             /*Flag*/      &check_type    ,      \
514                             /*TYPE*/      "FL"          ,       \
515                             /*OPTIONAL?*/ OPTIONAL      ,       \
516                             /*MAX Nval*/  0             ,               \
517                             /*DOC*/       "Make sure that -type and the real type of the sequences agree"          , \
518                             /*Parameter*/ &check_type    ,              \
519                             /*Def 1*/    "0"            ,               \
520                             /*Def 2*/    "1"            ,               \
521                             /*Min_value*/ "any"         ,               \
522                             /*Max Value*/ "any"                         \
523                                           );
524                /*PARAMETER PROTOTYPE:    INFILE    */
525                declare_name (type);
526                get_cl_param(                                    \
527                             /*argc*/      argc           ,      \
528                             /*argv*/      argv           ,      \
529                             /*output*/    &le            ,      \
530                             /*Name*/      "-type"        ,      \
531                             /*Flag*/      &garbage       ,      \
532                             /*TYPE*/      "S"            ,      \
533                             /*OPTIONAL?*/ OPTIONAL       ,      \
534                             /*MAX Nval*/  1              ,              \
535                             /*DOC*/       "protein or dna. Automatically set, but can be forced with this flag"           , \
536                             /*Parameter*/ &type          ,              \
537                             /*Def 1*/    ""              ,              \
538                             /*Def 2*/    ""              ,              \
539                             /*Min_value*/ "any"          ,              \
540                             /*Max Value*/ "any"                         \
541                                           );    
542
543
544 /* extra>prompt>special>parameters>defaults*/
545  argv=break_list ( argv, &argc, "=;, \n");
546  argv=merge_list ( argv, &argc);
547  if (argc>1 && argv[1][0]!='-')argv=push_string ("-seq ", argv, &argc, 1);
548  
549  if ( name_is_in_list ("-method",argv, argc,100)==-1)
550    {
551      NO_METHODS_IN_CL=1;
552    }
553  
554 if (t_coffee_defaults_flag)
555   {
556     char *pname=NULL;
557     
558     pname=getenv ( "TCOFFEE_DEFAULTS");
559     
560     if (check_file_exists ( t_coffee_defaults))pname=t_coffee_defaults;
561     else if ( getenv ( "TCOFFEE_DEFAULTS"))
562       {
563         pname=getenv ( "TCOFFEE_DEFAULTS");
564         if (check_file_exists(pname));
565         else pname=NULL;
566       }
567     else
568       {
569         declare_name(pname);sprintf (pname, "%s/.t_coffee_defaults",getenv ( "HOME") );
570         if (!check_file_exists (pname)){vfree(pname);pname=NULL;}
571       }
572     
573     if (pname)
574       {
575         argv=push_string (file2string(pname), argv, &argc, 1);
576         t_coffee_defaults=pname;
577       }
578     else
579       {
580         t_coffee_defaults=NULL;
581       }
582   }
583  
584  if ( parameters && parameters[0])argv=push_string (file2string (parameters), argv, &argc, 1);
585
586
587  if (n_special_mode && !type_only)
588    {
589      char *special_mode;
590      char *lseq_type;
591      declare_name(lseq_type);
592      if (type && !strm (type, ""))
593        sprintf (lseq_type,"%s",type);
594      else
595        sprintf (lseq_type,"%s",get_seq_type_from_cl (argc, argv));
596      
597      for ( a=0; a< n_special_mode; a++)
598        {
599          char *new_arg=NULL;
600         
601          special_mode=special_mode_list[a];
602          
603          store_mode (special_mode);
604
605
606          if (special_mode && !special_mode[0]);
607          else if ( strm (special_mode, "regular") || strm (special_mode, "regular_fast")|| strm (special_mode, "default"))new_arg=get_defaults (NULL,lseq_type);
608          else if ( strm (special_mode, "genome"))new_arg=get_genome_defaults(NULL,lseq_type);
609          else if ( strm (special_mode, "quickaln"))new_arg=get_very_fast_defaults(NULL,lseq_type);
610          else if ( strm (special_mode, "dali"))new_arg=get_dali_defaults(NULL,lseq_type);
611          else if ( strm (special_mode, "evaluate"))new_arg=get_evaluate_defaults(NULL,lseq_type);
612          else if ( strm (special_mode, "precomputed"))new_arg=get_precomputed_defaults(NULL,lseq_type);
613          else if ( strm (special_mode, "3dcoffee"))new_arg=get_3dcoffee_defaults(NULL,lseq_type);
614          else if ( strm (special_mode, "expresso"))new_arg=get_expresso_defaults(NULL,lseq_type);
615          else if ( strm (special_mode, "repeats"))new_arg=get_repeat_defaults(NULL,lseq_type);
616          else if ( strm (special_mode, "psicoffee"))new_arg=get_psicoffee_defaults(NULL,lseq_type);
617
618          else if ( strm (special_mode, "accurate") || strm (special_mode, "accurate_slow") || strm (special_mode, "psicoffee_expresso"))new_arg=get_accurate_defaults(NULL, lseq_type);
619          else if ( strm (special_mode, "accurate4DNA"))new_arg=get_accurate4DNA_defaults(NULL,lseq_type);
620          else if ( strm (special_mode, "accurate4RNA"))new_arg=get_accurate4RNA_defaults(NULL,lseq_type);
621          else if ( strm (special_mode, "best4RNA"))new_arg=get_best4RNA_defaults(NULL,lseq_type);
622          else if ( strm (special_mode, "accurate4PROTEIN"))new_arg=get_accurate4PROTEIN_defaults(NULL,lseq_type);
623          
624          else if ( strm (special_mode, "low_memory") || strm (special_mode, "memory"))new_arg=get_low_memory_defaults(NULL,lseq_type);
625
626          
627          else if ( strm (special_mode, "dna"))new_arg=get_dna_defaults(NULL,lseq_type);
628          else if ( strm (special_mode, "cdna"))new_arg=get_dna_defaults(NULL,lseq_type);
629          else if ( strm (special_mode, "protein"))new_arg=get_low_memory_defaults(NULL,lseq_type);
630          else if ( strm (special_mode, "mcoffee"))new_arg=get_mcoffee_defaults(NULL,lseq_type);
631          else if ( strm (special_mode, "dmcoffee"))new_arg=get_dmcoffee_defaults(NULL,lseq_type);
632          else if ( strm (special_mode, "fmcoffee"))new_arg=get_fmcoffee_defaults(NULL,lseq_type);
633          
634          else if ( strm (special_mode, "rcoffee_consan"))new_arg=get_rcoffee_consan_defaults(NULL,lseq_type);
635          else if ( strm (special_mode, "rmcoffee") ||strm (special_mode, "mrcoffee") )new_arg=get_rmcoffee_defaults(NULL,lseq_type);
636          else if ( strm (special_mode, "rcoffee"))new_arg=get_rcoffee_defaults(NULL,lseq_type);
637          
638          else if ( strm (special_mode, "rcoffee_slow_accurate"))new_arg=get_rcoffee_consan_defaults(NULL,lseq_type);
639          else if ( strm (special_mode, "rcoffee_fast_approximate"))new_arg=get_rmcoffee_defaults(NULL,lseq_type);
640          else if ( strm (special_mode, "t_coffee"))new_arg=get_t_coffee_defaults(NULL,lseq_type);
641          
642          
643          else if ( strm (special_mode, "unspecified"));
644          else
645            {
646              fprintf ( stderr, "\nERROR: special_mode %s is unknown [FATAL:%s]\n",special_mode, PROGRAM);
647              myexit (EXIT_FAILURE);
648            }
649          
650          if (new_arg)argv=push_string (new_arg, argv, &argc, 1);
651        }         
652    }
653  
654 if ( getenv ("TCOFFEE_EXTRA_PARAM"))argv=push_string (getenv ("TCOFFEE_EXTRA_PARAM"), argv, &argc, argc); 
655
656
657 argv=break_list ( argv, &argc, "=;, \n");
658 argv=merge_list ( argv, &argc);
659 /*check_cl4t_coffee ( argc, argv); */
660  
661
662 /*PARAMETER PROTOTYPE:    VERSION      */
663                get_cl_param(\
664                             /*argc*/      argc             ,\
665                             /*argv*/      argv             ,\
666                             /*output*/    &le              ,\
667                             /*Name*/      "-version"        ,\
668                             /*Flag*/      &do_version        ,\
669                             /*TYPE*/      "FL"              ,\
670                             /*OPTIONAL?*/ OPTIONAL         ,\
671                             /*MAX Nval*/  1                ,\
672                             /*DOC*/       "forces the program to output the version number and exit" ,\
673                             /*Parameter*/ &do_version          ,\
674                             /*Def 1*/     "0"             ,\
675                             /*Def 2*/     "1"             ,\
676                             /*Min_value*/ "0"            ,\
677                             /*Max Value*/ "1"             \
678                    );
679
680
681 /*PARAMETER PROTOTYPE:    DO EVALUATE      */
682                get_cl_param(\
683                             /*argc*/      argc             ,\
684                             /*argv*/      argv             ,\
685                             /*output*/    &le              ,\
686                             /*Name*/      "-score"        ,\
687                             /*Flag*/      &do_evaluate        ,\
688                             /*TYPE*/      "FL"              ,\
689                             /*OPTIONAL?*/ OPTIONAL         ,\
690                             /*MAX Nval*/  1                ,\
691                             /*DOC*/       "DEPRECATED: use -special_mode evaluate instead " ,\
692                             /*Parameter*/ &do_evaluate          ,\
693                             /*Def 1*/     "0"             ,\
694                             /*Def 2*/     "1"             ,\
695                             /*Min_value*/ "0"            ,\
696                             /*Max Value*/ "1"             \
697                    );
698 if ( !do_evaluate)
699   {
700 /*PARAMETER PROTOTYPE:    DO EVALUATE      */
701                get_cl_param(\
702                             /*argc*/      argc             ,\
703                             /*argv*/      argv             ,\
704                             /*output*/    &le              ,\
705                             /*Name*/      "-evaluate"        ,\
706                             /*Flag*/      &do_evaluate        ,\
707                             /*TYPE*/      "FL"              ,\
708                             /*OPTIONAL?*/ OPTIONAL         ,\
709                             /*MAX Nval*/  1                ,\
710                             /*DOC*/       "Use -special_mode evaluate for a default behavior " ,\
711                             /*Parameter*/ &do_evaluate          ,\
712                             /*Def 1*/     "0"             ,\
713                             /*Def 2*/     "1"             ,\
714                             /*Min_value*/ "0"            ,\
715                             /*Max Value*/ "1"             \
716                    );
717   }
718 /*PARAMETER PROTOTYPE:    DO FORMAT      */
719                get_cl_param(\
720                             /*argc*/      argc             ,\
721                             /*argv*/      argv             ,\
722                             /*output*/    &le              ,\
723                             /*Name*/      "-convert"        ,\
724                             /*Flag*/      &do_convert        ,\
725                             /*TYPE*/      "FL"              ,\
726                             /*OPTIONAL?*/ OPTIONAL         ,\
727                             /*MAX Nval*/  1                ,\
728                             /*DOC*/       "forces the program to make a conversion" ,\
729                             /*Parameter*/ &do_convert          ,\
730                             /*Def 1*/     "0"             ,\
731                             /*Def 2*/     "1"             ,\
732                             /*Min_value*/ "0"            ,\
733                             /*Max Value*/ "1"             \
734                    );        
735
736
737 /*PARAMETER PROTOTYPE*/
738                
739      declare_name (se_name);
740      get_cl_param(\
741                             /*argc*/      argc          ,\
742                             /*argv*/      argv          ,\
743                             /*output*/    &le           ,\
744                             /*Name*/      "-quiet"      ,\
745                             /*Flag*/      &quiet        ,\
746                             /*TYPE*/      "W_F"         ,\
747                             /*OPTIONAL?*/ OPTIONAL      ,\
748                             /*MAX Nval*/  1             ,\
749                             /*DOC*/       "Defines the file in which the log output is written"          ,\
750                             /*Parameter*/ &se_name      ,\
751                             /*Def 1*/     "stderr"      ,\
752                             /*Def 2*/     "/dev/null"   ,\
753                             /*Min_value*/ "any"         ,\
754                             /*Max Value*/ "any"          \
755                    );
756      if (type_only==1)sprintf ( se_name, "/dev/null");
757      
758      /*PARAMETER PROTOTYPE:    DO FORMAT      */
759                get_cl_param(\
760                             /*argc*/      argc             ,\
761                             /*argv*/      argv             ,\
762                             /*output*/    &le              ,\
763                             /*Name*/      "-check_configuration"        ,\
764                             /*Flag*/      &check_configuration       ,\
765                             /*TYPE*/      "FL"              ,\
766                             /*OPTIONAL?*/ OPTIONAL         ,\
767                             /*MAX Nval*/  1                ,\
768                             /*DOC*/       "checks that the required programs are installed" ,\
769                             /*Parameter*/ &check_configuration          ,\
770                             /*Def 1*/     "0"             ,\
771                             /*Def 2*/     "1"             ,\
772                             /*Min_value*/ "0"            ,\
773                             /*Max Value*/ "1"             \
774                             );       
775           /*PARAMETER PROTOTYPE:    UPDATE      */
776                get_cl_param(\
777                             /*argc*/      argc             ,\
778                             /*argv*/      argv             ,\
779                             /*output*/    &le              ,\
780                             /*Name*/      "-update"        ,\
781                             /*Flag*/      &update,\
782                             /*TYPE*/      "FL"              ,\
783                             /*OPTIONAL?*/ OPTIONAL         ,\
784                             /*MAX Nval*/  1                ,\
785                             /*DOC*/       "checks the existence of an updated version" ,\
786                             /*Parameter*/ &update          ,\
787                             /*Def 1*/     "0"             ,\
788                             /*Def 2*/     "1"             ,\
789                             /*Min_value*/ "0"            ,\
790                             /*Max Value*/ "1"             \
791                             );     
792
793                
794
795      if ( check_configuration)
796        {
797          
798          check_configuration4program();
799          return EXIT_SUCCESS;
800          
801        }
802      if ( update)
803        {
804          myexit (check_for_update(DISTRIBUTION_ADDRESS));
805        }
806      if ( do_version)
807        {
808          fprintf ( stdout, "PROGRAM: %s (%s)\n",PROGRAM,VERSION);
809          return EXIT_SUCCESS;
810        }
811
812
813      le=vfopen ( se_name, "w");
814      fprintf ( le, "\nPROGRAM: %s (%s)\n",PROGRAM,VERSION);
815
816 /*PARAMETER PROTOTYPE: RUN NAME*/
817                declare_name (full_log);
818                get_cl_param(\
819                             /*argc*/      argc           ,\
820                             /*argv*/      argv          ,\
821                             /*output*/    &le           ,\
822                             /*Name*/      "-full_log"   ,\
823                             /*Flag*/      &garbage      ,\
824                             /*TYPE*/      "S"          ,\
825                             /*OPTIONAL?*/ OPTIONAL      ,\
826                             /*MAX Nval*/  1             ,\
827                             /*DOC*/       "Sets the prefix of all the output files"          ,\
828                             /*Parameter*/ &full_log     ,\
829                             /*Def 1*/     "NULL"        ,\
830                             /*Def 2*/     "full_log"            ,\
831                             /*Min_value*/ "any"         ,\
832                             /*Max Value*/ "any"          \
833                    );
834                vremove(full_log);
835 /*PARAMETER PROTOTYPE: RUN NAME*/
836                declare_name (run_name);
837                get_cl_param(\
838                             /*argc*/      argc           ,\
839                             /*argv*/      argv          ,\
840                             /*output*/    &le           ,\
841                             /*Name*/      "-run_name"   ,\
842                             /*Flag*/      &garbage      ,\
843                             /*TYPE*/      "S"          ,\
844                             /*OPTIONAL?*/ OPTIONAL      ,\
845                             /*MAX Nval*/  1             ,\
846                             /*DOC*/       "Sets the prefix of all the output files"          ,\
847                             /*Parameter*/ &run_name     ,\
848                             /*Def 1*/     "NULL"        ,\
849                             /*Def 2*/     ""            ,\
850                             /*Min_value*/ "any"         ,\
851                             /*Max Value*/ "any"          \
852                    );
853
854 /*PARAMETER PROTOTYPE: MEM MODE*/
855                declare_name(mem_mode);
856                get_cl_param(\
857                             /*argc*/      argc          ,\
858                             /*argv*/      argv          ,\
859                             /*output*/    &le           ,\
860                             /*Name*/      "-mem_mode"   ,\
861                             /*Flag*/      &garbage      ,\
862                             /*TYPE*/      "S"          ,\
863                             /*OPTIONAL?*/ OPTIONAL      ,\
864                             /*MAX Nval*/  1             ,\
865                             /*DOC*/       "Deprecated" ,\
866                             /*Parameter*/ &mem_mode     ,\
867                             /*Def 1*/     "mem"         ,\
868                             /*Def 2*/     ""            ,\
869                             /*Min_value*/ "any"         ,\
870                             /*Max Value*/ "any"          \
871                    );
872
873 /*PARAMETER PROTOTYPE: EXTEND  */
874                get_cl_param(\
875                             /*argc*/      argc          ,\
876                             /*argv*/      argv          ,\
877                             /*output*/    &le           ,\
878                             /*Name*/      "-extend"     ,\
879                             /*Flag*/      &do_extend    ,\
880                             /*TYPE*/      "D"           ,\
881                             /*OPTIONAL?*/ OPTIONAL      ,\
882                             /*MAX Nval*/  1             ,\
883                             /*DOC*/       "Do Library Extention On the Fly"          ,\
884                             /*Parameter*/ &do_extend    ,\
885                             /*Def 1*/     "1"           ,\
886                             /*Def 2*/     "1"           ,\
887                             /*Min_value*/ "any"         ,\
888                             /*Max Value*/ "any"          \
889                    );
890 /*PARAMETER PROTOTYPE: EXTEND  */
891                declare_name (extend_mode);
892                get_cl_param(\
893                             /*argc*/      argc          ,\
894                             /*argv*/      argv          ,\
895                             /*output*/    &le           ,\
896                             /*Name*/      "-extend_mode"     ,\
897                             /*Flag*/      &garbage    ,\
898                             /*TYPE*/      "S"           ,\
899                             /*OPTIONAL?*/ OPTIONAL      ,\
900                             /*MAX Nval*/  1             ,\
901                             /*DOC*/       "Library extension mode"          ,\
902                             /*Parameter*/ &extend_mode    ,\
903                             /*Def 1*/     "very_fast_triplet"           ,\
904                             /*Def 2*/     ""           ,\
905                             /*Min_value*/ "any"         ,\
906                             /*Max Value*/ "any"          \
907                    );
908                /*PARAMETER PROTOTYPE: EXTEND  */
909                get_cl_param(\
910                             /*argc*/      argc          ,\
911                             /*argv*/      argv          ,\
912                             /*output*/    &le           ,\
913                             /*Name*/      "-max_n_pair"     ,\
914                             /*Flag*/      &garbage    ,\
915                             /*TYPE*/      "D"           ,\
916                             /*OPTIONAL?*/ OPTIONAL      ,\
917                             /*MAX Nval*/  1             ,\
918                             /*DOC*/       "Indicates the Number of Pairs to Compare when making prf Vs prf. 0<=>every pair "          ,\
919                             /*Parameter*/ &max_n_pair    ,\
920                             /*Def 1*/     "10"           ,\
921                             /*Def 2*/     "3"           ,\
922                             /*Min_value*/ "any"         ,\
923                             /*Max Value*/ "any"          \
924                    );
925                
926 /*PARAMETER PROTOTYPE: SEQUENCES TO EXTEND */
927         seq_name_for_quadruplet=declare_char ( 200, STRING);
928         nseq_for_quadruplet=get_cl_param(\
929                             /*argc*/      argc          ,\
930                             /*argv*/      argv          ,\
931                             /*output*/    &le           ,\
932                             /*Name*/      "-seq_name_for_quadruplet"         ,\
933                             /*Flag*/      &garbage      ,\
934                             /*TYPE*/      "S"           ,\
935                             /*OPTIONAL?*/ OPTIONAL      ,\
936                             /*MAX Nval*/  200           ,\
937                             /*DOC*/       "Indicates which sequence must be used to compute quadruplets"          ,\
938                             /*Parameter*/ seq_name_for_quadruplet    ,\
939                             /*Def 1*/     "all",\
940                             /*Def 2*/     ""       ,\
941                             /*Min_value*/ "any"         ,\
942                             /*Max Value*/ "any"          \
943                    );
944 /*PARAMETER PROTOTYPE: COMPACT */
945                declare_name (compact_mode);
946                get_cl_param(\
947                             /*argc*/      argc          ,\
948                             /*argv*/      argv          ,\
949                             /*output*/    &le           ,\
950                             /*Name*/      "-compact"    ,\
951                             /*Flag*/      &do_compact   ,\
952                             /*TYPE*/      "S"          ,\
953                             /*OPTIONAL?*/ OPTIONAL      ,\
954                             /*MAX Nval*/  1             ,\
955                             /*DOC*/       "Deprecated"          ,\
956                             /*Parameter*/ &compact_mode ,\
957                             /*Def 1*/     "default"      ,\
958                             /*Def 2*/     "default"      ,\
959                             /*Min_value*/ "0"           ,\
960                             /*Max Value*/ "1"           \
961                    );
962
963
964 /*PARAMETER PROTOTYPE:        CLEAN*/
965                declare_name ( clean_mode);
966                get_cl_param(\
967                             /*argc*/      argc          ,\
968                             /*argv*/      argv          ,\
969                             /*output*/    &le           ,\
970                             /*Name*/      "-clean"      ,\
971                             /*Flag*/      &do_clean     ,\
972                             /*TYPE*/      "S"           ,\
973                             /*OPTIONAL?*/ OPTIONAL      ,\
974                             /*MAX Nval*/  1             ,\
975                             /*DOC*/       "Deprecated"          ,\
976                             /*Parameter*/ &clean_mode   ,\
977                             /*Def 1*/     "no"          ,\
978                             /*Def 2*/     "shadow"      ,\
979                             /*Min_value*/ "any"         ,\
980                             /*Max Value*/ "any"         \
981                    );
982
983 /*PARAMETER PROTOTYPE:        DO SELF */
984                get_cl_param(\
985                             /*argc*/      argc          ,\
986                             /*argv*/      argv          ,\
987                             /*output*/    &le           ,\
988                             /*Name*/      "-do_self"    ,\
989                             /*Flag*/      &do_self      ,\
990                             /*TYPE*/      "FL"          ,\
991                             /*OPTIONAL?*/ OPTIONAL      ,\
992                             /*MAX Nval*/  0             ,\
993                             /*DOC*/       "Make self extension. Used by Mocca"          ,\
994                             /*Parameter*/ &do_self      ,\
995                             /*Def 1*/     "0"           ,\
996                             /*Def 2*/     "1"           ,\
997                             /*Min_value*/ "0"           ,\
998                             /*Max Value*/ "1"           \
999                    );
1000
1001 /*PARAMETER PROTOTYPE:        DO NORMALISE */
1002                get_cl_param(\
1003                             /*argc*/      argc          ,\
1004                             /*argv*/      argv          ,\
1005                             /*output*/    &le           ,\
1006                             /*Name*/      "-do_normalise"    ,\
1007                             /*Flag*/      &garbage      ,\
1008                             /*TYPE*/      "D"          ,\
1009                             /*OPTIONAL?*/ OPTIONAL      ,\
1010                             /*MAX Nval*/  1             ,\
1011                             /*DOC*/       "Normalisation factor when computing scores"          ,\
1012                             /*Parameter*/ &do_normalise ,\
1013                             /*Def 1*/     "1000"           ,\
1014                             /*Def 2*/     "1000"       ,\
1015                             /*Min_value*/ "-10000"           ,\
1016                             /*Max Value*/ "10000"           \
1017                    );
1018 /*PARAMETER PROTOTYPE:        IN */
1019                template_file_list=declare_char (100, STRING);
1020                n_template_file=get_cl_param(                    \
1021                             /*argc*/      argc          ,\
1022                             /*argv*/      argv          ,\
1023                             /*output*/    &le           ,\
1024                             /*Name*/      "-template_file"         ,\
1025                             /*Flag*/      &garbage      ,\
1026                             /*TYPE*/      "S"           ,\
1027                             /*OPTIONAL?*/ OPTIONAL      ,\
1028                             /*MAX Nval*/  1000           ,\
1029                             /*DOC*/       "List of templates file for the sequences",\
1030                             /*Parameter*/ template_file_list     ,      \
1031                             /*Def 1*/    "",\
1032                             /*Def 2*/     "stdin"       ,\
1033                             /*Min_value*/ "any"         ,\
1034                             /*Max Value*/ "any"          \
1035                                           );
1036 /*PARAMETER PROTOTYPE:        IN */
1037                template_mode_list=declare_char (100, STRING);
1038                n_template_mode=get_cl_param(                    \
1039                             /*argc*/      argc          ,\
1040                             /*argv*/      argv          ,\
1041                             /*output*/    &le           ,\
1042                             /*Name*/      "-template_mode"         ,\
1043                             /*Flag*/      &garbage      ,\
1044                             /*TYPE*/      "S"           ,\
1045                             /*OPTIONAL?*/ OPTIONAL      ,\
1046                             /*MAX Nval*/  1000           ,\
1047                             /*DOC*/       "List of template procedures",\
1048                             /*Parameter*/ template_mode_list     ,      \
1049                             /*Def 1*/    "",\
1050                             /*Def 2*/     "stdin"       ,\
1051                             /*Min_value*/ "any"         ,\
1052                             /*Max Value*/ "any"          \
1053                                           );
1054                for (a=0; a<n_template_mode; a++)
1055                  {
1056                    sprintf (template_file_list[n_template_file++], "%s", template_mode_list [a]);
1057                  }
1058 /*PARAMETER PROTOTYPE:        remove_template_file*/
1059                
1060                get_cl_param(\
1061                             /*argc*/      argc          ,\
1062                             /*argv*/      argv          ,\
1063                             /*output*/    &le           ,\
1064                             /*Name*/      "-remove_template_file"      ,\
1065                             /*Flag*/      &remove_template_file     ,\
1066                             /*TYPE*/      "D"           ,\
1067                             /*OPTIONAL?*/ OPTIONAL      ,\
1068                             /*MAX Nval*/  1             ,\
1069                             /*DOC*/       "Remove all the template files: 0 keep all, 1: only remove the template files 2: remove template files AND template lists "          ,\
1070                             /*Parameter*/ &remove_template_file   ,\
1071                             /*Def 1*/     "0"          ,\
1072                             /*Def 2*/     "1"      ,\
1073                             /*Min_value*/ "any"         ,\
1074                             /*Max Value*/ "any"         \
1075                    );
1076                set_int_variable ("remove_template_file", remove_template_file);
1077                
1078         /*PARAMETER PROTOTYPE:        IN */
1079                profile_template_file_list=declare_char (100, STRING);
1080                n_profile_template_file=get_cl_param(                    \
1081                             /*argc*/      argc          ,\
1082                             /*argv*/      argv          ,\
1083                             /*output*/    &le           ,\
1084                             /*Name*/      "-profile_template_file"         ,\
1085                             /*Flag*/      &garbage      ,\
1086                             /*TYPE*/      "S"           ,\
1087                             /*OPTIONAL?*/ OPTIONAL      ,\
1088                             /*MAX Nval*/  1000           ,\
1089                             /*DOC*/       "List of templates files asscoaciated with profiles",\
1090                             /*Parameter*/ profile_template_file_list     , \
1091                             /*Def 1*/    "",\
1092                             /*Def 2*/     "stdin"       ,\
1093                             /*Min_value*/ "any"         ,\
1094                             /*Max Value*/ "any"          \
1095                                           );
1096                
1097                /*PARAMETER PROTOTYPE:        IN */
1098         list_file=declare_char (2000, STRING);
1099         n_list=get_cl_param(\
1100                             /*argc*/      argc          ,\
1101                             /*argv*/      argv          ,\
1102                             /*output*/    &le           ,\
1103                             /*Name*/      "-in"         ,\
1104                             /*Flag*/      &garbage      ,\
1105                             /*TYPE*/      "S"           ,\
1106                             /*OPTIONAL?*/ OPTIONAL      ,\
1107                             /*MAX Nval*/  2000           ,\
1108                             /*DOC*/       "Reads the Ssequences, Mmethods, Llibraries,Xmatrices,Rprofiles,Pstructures,AAlignments"          ,\
1109                             /*Parameter*/ list_file     ,\
1110                             /*Def 1*/    "",\
1111                             /*Def 2*/     "stdin"       ,\
1112                             /*Min_value*/ "any"         ,\
1113                             /*Max Value*/ "any"          \
1114                                           );
1115         
1116           
1117         /*PARAMETER PROTOTYPE:        IN */
1118         seq_list=declare_char (1000, STRING);
1119         n_seq_list=get_cl_param(                                \
1120                                 /*argc*/      argc          ,   \
1121                                 /*argv*/      argv          ,   \
1122                                 /*output*/    &le           ,   \
1123                                 /*Name*/      "-seq"         ,  \
1124                                 /*Flag*/      &garbage      ,   \
1125                                 /*TYPE*/      "S"           ,   \
1126                                 /*OPTIONAL?*/ OPTIONAL      ,   \
1127                                 /*MAX Nval*/  1000           ,          \
1128                                 /*DOC*/       "List of sequences in any acceptable format", \
1129                                 /*Parameter*/ seq_list     ,            \
1130                                 /*Def 1*/    "",                        \
1131                                 /*Def 2*/     "stdin"       ,           \
1132                                 /*Min_value*/ "any"         ,           \
1133                                 /*Max Value*/ "any"                     \
1134                                               );
1135         aln_file_list=declare_char (1000, STRING);
1136         n_aln_file_list=get_cl_param(                           \
1137                                 /*argc*/      argc          ,   \
1138                                 /*argv*/      argv          ,   \
1139                                 /*output*/    &le           ,   \
1140                                 /*Name*/      "-aln"         ,  \
1141                                 /*Flag*/      &garbage      ,   \
1142                                 /*TYPE*/      "S"           ,   \
1143                                 /*OPTIONAL?*/ OPTIONAL      ,   \
1144                                 /*MAX Nval*/  1000           ,          \
1145                                 /*DOC*/       "List of sequences in any acceptable format", \
1146                                 /*Parameter*/ aln_file_list     ,               \
1147                                 /*Def 1*/    "",                        \
1148                                 /*Def 2*/     "stdin"       ,           \
1149                                 /*Min_value*/ "any"         ,           \
1150                                 /*Max Value*/ "any"                     \
1151                                               );
1152         method_limits=declare_char (1000, STRING);
1153         n_method_limits=get_cl_param(                           \
1154                                 /*argc*/      argc          ,   \
1155                                 /*argv*/      argv          ,   \
1156                                 /*output*/    &le           ,   \
1157                                 /*Name*/      "-method_limits"         ,        \
1158                                 /*Flag*/      &garbage      ,   \
1159                                 /*TYPE*/      "S"           ,   \
1160                                 /*OPTIONAL?*/ OPTIONAL      ,   \
1161                                 /*MAX Nval*/  1000           ,          \
1162                                 /*DOC*/       "List of limits for selected methods: method maxnseq maxlen (-1 = nolimit)", \
1163                                 /*Parameter*/ method_limits     ,               \
1164                                 /*Def 1*/    "",                        \
1165                                 /*Def 2*/     ""       ,                \
1166                                 /*Min_value*/ "any"         ,           \
1167                                 /*Max Value*/ "any"                     \
1168                                               );
1169         method_list=declare_char (1000, STRING);
1170         n_method_list=get_cl_param(                             \
1171                                 /*argc*/      argc          ,   \
1172                                 /*argv*/      argv          ,   \
1173                                 /*output*/    &le           ,   \
1174                                 /*Name*/      "-method"         ,       \
1175                                 /*Flag*/      &garbage      ,   \
1176                                 /*TYPE*/      "S"           ,   \
1177                                 /*OPTIONAL?*/ OPTIONAL      ,   \
1178                                 /*MAX Nval*/  1000           ,          \
1179                                 /*DOC*/       "List of sequences in any acceptable format", \
1180                                 /*Parameter*/ method_list     ,         \
1181                                 /*Def 1*/    "",                        \
1182                                 /*Def 2*/     ""       ,                \
1183                                 /*Min_value*/ "any"         ,           \
1184                                 /*Max Value*/ "any"                     \
1185                                               );
1186         lib_file_list=declare_char (1000, STRING);
1187         n_lib_file_list=get_cl_param(                           \
1188                                 /*argc*/      argc          ,   \
1189                                 /*argv*/      argv          ,   \
1190                                 /*output*/    &le           ,   \
1191                                 /*Name*/      "-lib"         ,  \
1192                                 /*Flag*/      &garbage      ,   \
1193                                 /*TYPE*/      "S"           ,   \
1194                                 /*OPTIONAL?*/ OPTIONAL      ,   \
1195                                 /*MAX Nval*/  1000           ,          \
1196                                 /*DOC*/       "List of sequences in any acceptable format", \
1197                                 /*Parameter*/ lib_file_list     ,               \
1198                                 /*Def 1*/    "",                        \
1199                                 /*Def 2*/     "stdin"       ,           \
1200                                 /*Min_value*/ "any"         ,           \
1201                                 /*Max Value*/ "any"                     \
1202                                               );
1203         profile_list=declare_char ( 2000, STRING);
1204         n_profile_list=get_cl_param(                                    \
1205                             /*argc*/      argc             ,\
1206                             /*argv*/      argv             ,\
1207                             /*output*/    &le              ,\
1208                             /*Name*/      "-profile"        ,\
1209                             /*Flag*/      &garbage        ,\
1210                             /*TYPE*/      "S"              ,\
1211                             /*OPTIONAL?*/ OPTIONAL         ,\
1212                             /*MAX Nval*/  2000                ,\
1213                             /*DOC*/       "Input one or many MSA that will be treated as profiles" ,\
1214                             /*Parameter*/ profile_list          ,\
1215                             /*Def 1*/    ""             ,\
1216                             /*Def 2*/    ""             ,\
1217                             /*Min_value*/ "any"            ,\
1218                             /*Max Value*/ "any"             \
1219                                           );        
1220         declare_name (profile1);
1221         get_cl_param(                                           \
1222                      /*argc*/      argc             ,           \
1223                             /*argv*/      argv             ,\
1224                             /*output*/    &le              ,\
1225                             /*Name*/      "-profile1"        ,\
1226                             /*Flag*/      &garbage        ,\
1227                             /*TYPE*/      "S"              ,\
1228                             /*OPTIONAL?*/ OPTIONAL         ,\
1229                             /*MAX Nval*/  1                ,\
1230                             /*DOC*/       "Input one profile (ClustalW option)" ,\
1231                             /*Parameter*/ &profile1          ,\
1232                             /*Def 1*/    ""             ,\
1233                             /*Def 2*/    ""             ,\
1234                             /*Min_value*/ "any"            ,\
1235                             /*Max Value*/ "any"             \
1236                    );
1237         declare_name (profile2);
1238         get_cl_param(                                           \
1239                             /*argc*/      argc             ,\
1240                             /*argv*/      argv             ,\
1241                             /*output*/    &le              ,\
1242                             /*Name*/      "-profile2"        ,\
1243                             /*Flag*/      &garbage        ,\
1244                             /*TYPE*/      "S"              ,\
1245                             /*OPTIONAL?*/ OPTIONAL         ,\
1246                             /*MAX Nval*/  1                ,\
1247                             /*DOC*/       "Input a profile (ClustalW option)" ,\
1248                             /*Parameter*/ &profile2          ,\
1249                             /*Def 1*/    ""             ,\
1250                             /*Def 2*/    ""             ,\
1251                             /*Min_value*/ "any"            ,\
1252                             /*Max Value*/ "any"             \
1253                    );
1254  
1255         pdb_list=declare_char ( 200, STRING);
1256         n_pdb=get_cl_param(\
1257                             /*argc*/      argc          ,\
1258                             /*argv*/      argv          ,\
1259                             /*output*/    &le           ,\
1260                             /*Name*/      "-pdb"         ,\
1261                             /*Flag*/      &garbage      ,\
1262                             /*TYPE*/      "S"           ,\
1263                             /*OPTIONAL?*/ OPTIONAL      ,\
1264                             /*MAX Nval*/  200           ,\
1265                             /*DOC*/       "Reads/fetch a pdb file: PDBID(PDB_CHAIN)[opt] (FIRST,LAST)[opt],"          ,\
1266                             /*Parameter*/ pdb_list     ,\
1267                             /*Def 1*/    "",\
1268                             /*Def 2*/     ""       ,\
1269                             /*Min_value*/ "any"         ,\
1270                             /*Max Value*/ "any"          \
1271                    );
1272         
1273 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1274         
1275                get_cl_param(\
1276                             /*argc*/      argc          ,\
1277                             /*argv*/      argv          ,\
1278                             /*output*/    &le           ,\
1279                             /*Name*/      "-relax_lib"    ,\
1280                             /*Flag*/      &garbage      ,\
1281                             /*TYPE*/      "D"         ,\
1282                             /*OPTIONAL?*/ OPTIONAL      ,\
1283                             /*MAX Nval*/  1             ,\
1284                             /*DOC*/       "self extend the library, without adding new positions", \
1285                             /*Parameter*/&relax_lib ,\
1286                             /*Def 1*/    "1"      ,\
1287                             /*Def 2*/    "1"      ,\
1288                             /*Min_value*/ "any"         ,\
1289                             /*Max Value*/ "any"          \
1290                    );   
1291 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1292         
1293                get_cl_param(\
1294                             /*argc*/      argc          ,\
1295                             /*argv*/      argv          ,\
1296                             /*output*/    &le           ,\
1297                             /*Name*/      "-filter_lib"    ,\
1298                             /*Flag*/      &garbage      ,\
1299                             /*TYPE*/      "D"         ,\
1300                             /*OPTIONAL?*/ OPTIONAL      ,\
1301                             /*MAX Nval*/  1             ,\
1302                             /*DOC*/       "Removes from the library every value below the threshold",\
1303                             /*Parameter*/&filter_lib ,\
1304                             /*Def 1*/    "0"      ,\
1305                             /*Def 2*/    "10"      ,\
1306                             /*Min_value*/ "any"         ,\
1307                             /*Max Value*/ "any"          \
1308                    );   
1309 /*PARAMETER PROTOTYPE:    SHRINK_LIB     */
1310                
1311                get_cl_param(\
1312                             /*argc*/      argc          ,\
1313                             /*argv*/      argv          ,\
1314                             /*output*/    &le           ,\
1315                             /*Name*/      "-shrink_lib"    ,\
1316                             /*Flag*/      &garbage      ,\
1317                             /*TYPE*/      "D"         ,\
1318                             /*OPTIONAL?*/ OPTIONAL      ,\
1319                             /*MAX Nval*/  1             ,\
1320                             /*DOC*/       "Runks linked_pairwise on the lib to remove every useless diagonal"          ,\
1321                             /*Parameter*/&shrink_lib       ,\
1322                             /*Def 1*/    "0"      ,\
1323                             /*Def 2*/    "1"      ,\
1324                             /*Min_value*/ "any"         ,\
1325                             /*Max Value*/ "any"          \
1326                    );   
1327 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1328         declare_name (out_lib);
1329                get_cl_param(\
1330                             /*argc*/      argc          ,\
1331                             /*argv*/      argv          ,\
1332                             /*output*/    &le           ,\
1333                             /*Name*/      "-out_lib"    ,\
1334                             /*Flag*/      &garbage      ,\
1335                             /*TYPE*/      "W_F"         ,\
1336                             /*OPTIONAL?*/ OPTIONAL      ,\
1337                             /*MAX Nval*/  1             ,\
1338                             /*DOC*/       "Prompts the program to write the computed library file"          ,\
1339                             /*Parameter*/&out_lib       ,\
1340                             /*Def 1*/    "no"      ,\
1341                             /*Def 2*/    "default"      ,\
1342                             /*Min_value*/ "any"         ,\
1343                             /*Max Value*/ "any"          \
1344                    );
1345                /*PARAMETER PROTOTYPE:    OUT_LIB_MODE     */
1346                declare_name (out_lib_mode);
1347                get_cl_param(\
1348                             /*argc*/      argc          ,\
1349                             /*argv*/      argv          ,\
1350                             /*output*/    &le           ,\
1351                             /*Name*/      "-out_lib_mode"    ,\
1352                             /*Flag*/      &garbage      ,\
1353                             /*TYPE*/      "S"         ,\
1354                             /*OPTIONAL?*/ OPTIONAL      ,\
1355                             /*MAX Nval*/  1             ,\
1356                             /*DOC*/       "Save the primary or the extended library:[primary|extende]extended_[pair|lib]_[raw|pc]"          ,\
1357                             /*Parameter*/&out_lib_mode       ,\
1358                             /*Def 1*/    "primary"      ,\
1359                             /*Def 2*/    "extended",\
1360                             /*Min_value*/ "any"         ,\
1361                             /*Max Value*/ "any"          \
1362                    );
1363 /*PARAMETER PROTOTYPE:    LIB_ONLY     */
1364                
1365                get_cl_param(\
1366                             /*argc*/      argc          ,\
1367                             /*argv*/      argv          ,\
1368                             /*output*/    &le           ,\
1369                             /*Name*/      "-lib_only"    ,\
1370                             /*Flag*/      &garbage      ,\
1371                             /*TYPE*/      "D"         ,\
1372                             /*OPTIONAL?*/ OPTIONAL      ,\
1373                             /*MAX Nval*/  1             ,\
1374                             /*DOC*/       "Only Compute the library",\
1375                             /*Parameter*/&lib_only       ,\
1376                             /*Def 1*/    "0"      ,\
1377                             /*Def 2*/    "1"      ,\
1378                             /*Min_value*/ "any"         ,\
1379                             /*Max Value*/ "any"          \
1380                    );
1381
1382 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1383         declare_name (outseqweight);
1384                get_cl_param(\
1385                             /*argc*/      argc          ,\
1386                             /*argv*/      argv          ,\
1387                             /*output*/    &le           ,\
1388                             /*Name*/      "-outseqweight"    ,\
1389                             /*Flag*/      &garbage      ,\
1390                             /*TYPE*/      "W_F"         ,\
1391                             /*OPTIONAL?*/ OPTIONAL      ,\
1392                             /*MAX Nval*/  1             ,\
1393                             /*DOC*/       "Prompts the program to write the sequuence weight values"          ,\
1394                             /*Parameter*/&outseqweight       ,\
1395                             /*Def 1*/    "no"      ,\
1396                             /*Def 2*/    "default"      ,\
1397                             /*Min_value*/ "any"         ,\
1398                             /*Max Value*/ "any"          \
1399                    );
1400                /*PARAMETER PROTOTYPE:    DPA    */
1401                get_cl_param(\
1402                             /*argc*/      argc          ,\
1403                             /*argv*/      argv          ,\
1404                             /*output*/    &le           ,\
1405                             /*Name*/      "-dpa"  ,\
1406                             /*Flag*/      &dpa    ,\
1407                             /*TYPE*/      "FL"          ,\
1408                             /*OPTIONAL?*/ OPTIONAL      ,\
1409                             /*MAX Nval*/  0             ,\
1410                             /*DOC*/       "Use DPA mode"          ,\
1411                             /*Parameter*/ &dpa    ,\
1412                             /*Def 1*/    "0"            ,\
1413                             /*Def 2*/    "1"            ,\
1414                             /*Min_value*/ "any"         ,\
1415                             /*Max Value*/ "any"          \
1416                    );
1417               
1418 /*PARAMETER PROTOTYPE:    SEQ TO ALIGN     */
1419                declare_name (seq_source);
1420                get_cl_param(\
1421                             /*argc*/      argc           ,\
1422                             /*argv*/      argv           ,\
1423                             /*output*/    &le            ,\
1424                             /*Name*/      "-seq_source",\
1425                             /*Flag*/      &garbage       ,\
1426                             /*TYPE*/      "S"          ,\
1427                             /*OPTIONAL?*/ OPTIONAL       ,\
1428                             /*MAX Nval*/  1              ,\
1429                             /*DOC*/       "Indicates the files that will be used as sequence sources, important for dpa. With the default mode alignments must be provided with the Sflag as well as tye Aflag if they contribute novel sequences",\
1430                             /*Parameter*/ &seq_source   ,\
1431                             /*Def 1*/    "ANY"          ,\
1432                             /*Def 2*/    ""              ,\
1433                             /*Min_value*/ "any"          ,\
1434                             /*Max Value*/ "any"           \
1435                    );
1436
1437 /*PARAMETER PROTOTYPE:    COSMETIC PENALTY     */
1438                get_cl_param(\
1439                             /*argc*/      argc          ,\
1440                             /*argv*/      argv          ,\
1441                             /*output*/    &le           ,\
1442                             /*Name*/      "-cosmetic_penalty" ,\
1443                             /*Flag*/      &garbage      ,\
1444                             /*TYPE*/      "D"           ,\
1445                             /*OPTIONAL?*/ OPTIONAL      ,\
1446                             /*MAX Nval*/  1             ,\
1447                             /*DOC*/       "A very low Gap Opening Penalty.It only affects the non stable portions of the alignmnent.Negative values penalize gaps, positive values reward them"          ,\
1448                             /*Parameter*/ &cosmetic_penalty          ,\
1449                             /*Def 1*/    "0"            ,\
1450                             /*Def 2*/    "0"             ,\
1451                             /*Min_value*/ "any"         ,\
1452                             /*Max Value*/ "any"          \
1453                    );          
1454 /*PARAMETER PROTOTYPE:    GAPOPEN     */
1455                get_cl_param(\
1456                             /*argc*/      argc          ,\
1457                             /*argv*/      argv          ,\
1458                             /*output*/    &le           ,\
1459                             /*Name*/      "-gapopen"    ,\
1460                             /*Flag*/      &garbage      ,\
1461                             /*TYPE*/      "D"           ,\
1462                             /*OPTIONAL?*/ OPTIONAL      ,\
1463                             /*MAX Nval*/  1             ,\
1464                             /*DOC*/       "Gap opening penalty. Must be negative, best matches get a score of 1000"          ,\
1465                             /*Parameter*/ &gop          ,\
1466                             /*Def 1*/    "0"            ,\
1467                             /*Def 2*/    ""             ,\
1468                             /*Min_value*/ "any"         ,\
1469                             /*Max Value*/ "any"          \
1470                    );
1471
1472 /*PARAMETER PROTOTYPE:    GAPEXT     */
1473                get_cl_param(\
1474                             /*argc*/      argc          ,\
1475                             /*argv*/      argv          ,\
1476                             /*output*/    &le           ,\
1477                             /*Name*/      "-gapext"     ,\
1478                             /*Flag*/      &garbage      ,\
1479                             /*TYPE*/      "D"           ,\
1480                             /*OPTIONAL?*/ OPTIONAL      ,\
1481                             /*MAX Nval*/  1             ,\
1482                             /*DOC*/       "Gap Extension Penalty. Positive values give rewards to gaps and prevent the alignment of unrelated segments"          ,\
1483                             /*Parameter*/ &gep          ,\
1484                             /*Def 1*/    "0"            ,\
1485                             /*Def 2*/    ""             ,\
1486                             /*Min_value*/ "any"         ,\
1487                             /*Max Value*/ "any"         \
1488                    );
1489
1490 /*PARAMETER PROTOTYPE:    F_GAPOPEN     */
1491                get_cl_param(\
1492                             /*argc*/      argc          ,\
1493                             /*argv*/      argv          ,\
1494                             /*output*/    &le           ,\
1495                             /*Name*/      "-fgapopen"    ,\
1496                             /*Flag*/      &garbage      ,\
1497                             /*TYPE*/      "D"           ,\
1498                             /*OPTIONAL?*/ OPTIONAL      ,\
1499                             /*MAX Nval*/  1             ,\
1500                             /*DOC*/       "Deprecated"          ,\
1501                             /*Parameter*/ &f_gop          ,\
1502                             /*Def 1*/    "0"            ,\
1503                             /*Def 2*/    ""             ,\
1504                             /*Min_value*/ "any"         ,\
1505                             /*Max Value*/ "any"          \
1506                    );
1507 /*PARAMETER PROTOTYPE:    F_GAPEXT     */
1508                get_cl_param(\
1509                             /*argc*/      argc          ,\
1510                             /*argv*/      argv          ,\
1511                             /*output*/    &le           ,\
1512                             /*Name*/      "-fgapext"     ,\
1513                             /*Flag*/      &garbage      ,\
1514                             /*TYPE*/      "D"           ,\
1515                             /*OPTIONAL?*/ OPTIONAL      ,\
1516                             /*MAX Nval*/  1             ,\
1517                             /*DOC*/       "Deprecated"          ,\
1518                             /*Parameter*/ &f_gep          ,\
1519                             /*Def 1*/    "0"            ,\
1520                             /*Def 2*/    ""             ,\
1521                             /*Min_value*/ "any"         ,\
1522                             /*Max Value*/ "any"         \
1523                    );
1524 /*PARAMETER PROTOTYPE:    NEW_TREE     */
1525                get_cl_param(\
1526                             /*argc*/      argc          ,\
1527                             /*argv*/      argv          ,\
1528                             /*output*/    &le           ,\
1529                             /*Name*/      "-nomatch"     ,\
1530                             /*Flag*/      &garbage      ,\
1531                             /*TYPE*/      "D"           ,\
1532                             /*OPTIONAL?*/ OPTIONAL      ,\
1533                             /*MAX Nval*/  1             ,\
1534                             /*DOC*/       "Deprecated"          ,\
1535                             /*Parameter*/ &nomatch          ,\
1536                             /*Def 1*/    "0"            ,\
1537                             /*Def 2*/    "0"             ,\
1538                             /*Min_value*/ "any"         ,\
1539                             /*Max Value*/ "any"         \
1540                    );          
1541                declare_name ( tree_file);
1542                get_cl_param(\
1543                             /*argc*/      argc          ,\
1544                             /*argv*/      argv          ,\
1545                             /*output*/    &le           ,\
1546                             /*Name*/      "-newtree"    ,\
1547                             /*Flag*/      &garbage      ,\
1548                             /*TYPE*/      "W_F"         ,\
1549                             /*OPTIONAL?*/ OPTIONAL      ,\
1550                             /*MAX Nval*/  1             ,\
1551                             /*DOC*/       "Name of the output guide tree"          ,\
1552                             /*Parameter*/&tree_file     ,\
1553                             /*Def 1*/    "default"      ,\
1554                             /*Def 2*/    ""             ,\
1555                             /*Min_value*/ "any"         ,\
1556                             /*Max Value*/ "any"         \
1557                    );
1558                declare_name ( ph_tree_file);
1559                get_cl_param(\
1560                             /*argc*/      argc          ,\
1561                             /*argv*/      argv          ,\
1562                             /*output*/    &le           ,\
1563                             /*Name*/      "-tree"    ,\
1564                             /*Flag*/      &garbage      ,\
1565                             /*TYPE*/      "W_F"         ,\
1566                             /*OPTIONAL?*/ OPTIONAL      ,\
1567                             /*MAX Nval*/  1             ,\
1568                             /*DOC*/       "Name of the output guide tree"          ,\
1569                             /*Parameter*/&ph_tree_file     ,\
1570                             /*Def 1*/    "NO"      ,\
1571                             /*Def 2*/    "default"             ,\
1572                             /*Min_value*/ "any"         ,\
1573                             /*Max Value*/ "any"         \
1574                    );
1575                
1576 /*PARAMETER PROTOTYPE:    USETREE     */
1577                declare_name ( use_tree);
1578                get_cl_param(\
1579                             /*argc*/      argc          ,\
1580                             /*argv*/      argv          ,\
1581                             /*output*/    &le           ,\
1582                             /*Name*/      "-usetree",\
1583                             /*Flag*/      &garbage      ,\
1584                             /*TYPE*/      "R_F"         ,\
1585                             /*OPTIONAL?*/ OPTIONAL      ,\
1586                             /*MAX Nval*/  1             ,\
1587                             /*DOC*/       "Use an existing guide tree"          ,\
1588                             /*Parameter*/ &use_tree     ,\
1589                             /*Def 1*/    "NULL"         ,\
1590                             /*Def 2*/    "NULL"         ,\
1591                             /*Min_value*/ "any"         ,\
1592                             /*Max Value*/ "any"         \
1593                    );
1594                /*PARAMETER PROTOTYPE:    */
1595                declare_name ( tree_mode);
1596                get_cl_param(\
1597                             /*argc*/      argc          ,\
1598                             /*argv*/      argv          ,\
1599                             /*output*/    &le           ,\
1600                             /*Name*/      "-tree_mode"  ,\
1601                             /*Flag*/      &garbage      ,\
1602                             /*TYPE*/      "S"           ,\
1603                             /*OPTIONAL?*/ OPTIONAL      ,\
1604                             /*MAX Nval*/  1             ,\
1605                             /*DOC*/       "nj, upgma, cwph",\
1606                             /*Parameter*/ &tree_mode    ,\
1607                             /*Def 1*/    "nj"         ,\
1608                             /*Def 2*/    "nj"         ,\
1609                             /*Min_value*/ "1"         ,\
1610                             /*Max Value*/ "1"          \
1611                    );
1612 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1613                declare_name ( distance_matrix_mode);
1614                get_cl_param(\
1615                             /*argc*/      argc          ,\
1616                             /*argv*/      argv          ,\
1617                             /*output*/    &le           ,\
1618                             /*Name*/      "-distance_matrix_mode"  ,\
1619                             /*Flag*/      &garbage      ,\
1620                             /*TYPE*/      "S"           ,\
1621                             /*OPTIONAL?*/ OPTIONAL      ,\
1622                             /*MAX Nval*/  1             ,\
1623                             /*DOC*/       "Computation of the distances for the tree: slow, fast, very_fast, ktup"          ,\
1624                             /*Parameter*/ &distance_matrix_mode    ,\
1625                             /*Def 1*/    "ktup"         ,\
1626                             /*Def 2*/    "idscore"         ,\
1627                             /*Min_value*/ "any"         ,\
1628                             /*Max Value*/ "any"          \
1629                    );
1630 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1631                declare_name ( distance_matrix_sim_mode);
1632                get_cl_param(\
1633                             /*argc*/      argc          ,\
1634                             /*argv*/      argv          ,\
1635                             /*output*/    &le           ,\
1636                             /*Name*/      "-distance_matrix_sim_mode"  ,\
1637                             /*Flag*/      &garbage      ,\
1638                             /*TYPE*/      "S"           ,\
1639                             /*OPTIONAL?*/ OPTIONAL      ,\
1640                             /*MAX Nval*/  1             ,\
1641                             /*DOC*/       "Choice of the distance measure: <mat>_sim1, _sim2, _sim3, _cov, _gap"          ,\
1642                             /*Parameter*/ &distance_matrix_sim_mode    ,\
1643                             /*Def 1*/    "idmat_sim1"         ,\
1644                             /*Def 2*/    "idmat_sim1"         ,\
1645                             /*Min_value*/ "any"         ,\
1646                             /*Max Value*/ "any"          \
1647                    );
1648 /*PARAMETER PROTOTYPE:    OUT_LIB     */
1649                get_cl_param(\
1650                             /*argc*/      argc          ,\
1651                             /*argv*/      argv          ,\
1652                             /*output*/    &le           ,\
1653                             /*Name*/      "-quicktree"  ,\
1654                             /*Flag*/      &quicktree    ,\
1655                             /*TYPE*/      "FL"          ,\
1656                             /*OPTIONAL?*/ OPTIONAL      ,\
1657                             /*MAX Nval*/  0             ,\
1658                             /*DOC*/       "Use distance_matrix_mode=very_fast"          ,\
1659                             /*Parameter*/ &quicktree    ,\
1660                             /*Def 1*/    "0"            ,\
1661                             /*Def 2*/    "1"            ,\
1662                             /*Min_value*/ "any"         ,\
1663                             /*Max Value*/ "any"          \
1664                    );
1665                if ( quicktree)sprintf ( distance_matrix_mode, "very_fast");
1666 /*PARAMETER PROTOTYPE:    OUTFILE     */
1667                declare_name ( out_aln);
1668                tot_out_aln=declare_char (200, STRING);
1669                 get_cl_param(\
1670                             /*argc*/      argc          ,\
1671                             /*argv*/      argv          ,\
1672                             /*output*/    &le           ,\
1673                             /*Name*/      "-outfile"    ,\
1674                             /*Flag*/      &garbage      ,\
1675                             /*TYPE*/      "W_F"         ,\
1676                             /*OPTIONAL?*/ OPTIONAL      ,\
1677                             /*MAX Nval*/  1             ,\
1678                             /*DOC*/       "Name of the output alignment"          ,\
1679                             /*Parameter*/ &out_aln      ,\
1680                             /*Def 1*/    "default"      ,\
1681                             /*Def 2*/    ""             ,\
1682                             /*Min_value*/ "any"         ,\
1683                             /*Max Value*/ "any"          \
1684                    );
1685
1686 /*PARAMETER PROTOTYPE:    MAXIMISE     */               
1687                get_cl_param(\
1688                             /*argc*/      argc          ,\
1689                             /*argv*/      argv          ,\
1690                             /*output*/    &le           ,\
1691                             /*Name*/      "-maximise"   ,\
1692                             /*Flag*/      &maximise     ,\
1693                             /*TYPE*/      "FL"          ,\
1694                             /*OPTIONAL?*/ OPTIONAL      ,\
1695                             /*MAX Nval*/  0             ,\
1696                             /*DOC*/       "Deprecated"          ,\
1697                             /*Parameter*/ &maximise     ,\
1698                             /*Def 1*/    "1"            ,\
1699                             /*Def 2*/    "1"            ,\
1700                             /*Min_value*/ "any"         ,\
1701                             /*Max Value*/ "any"         \
1702                    );
1703                
1704 /*PARAMETER PROTOTYPE:    OUTPUT_FORMAT    */
1705                out_aln_format=declare_char ( 200, STRING);
1706                n_out_aln_format=get_cl_param(\
1707                             /*argc*/      argc           ,\
1708                             /*argv*/      argv           ,\
1709                             /*output*/    &le            ,\
1710                             /*Name*/      "-output"      ,\
1711                             /*Flag*/      &garbage       ,\
1712                             /*TYPE*/      "S"            ,\
1713                             /*OPTIONAL?*/ OPTIONAL       ,\
1714                             /*MAX Nval*/  200              ,\
1715                             /*DOC*/       "Specifies one or many formats that must be output: clustalw_aln, msf_aln. The file extension is the output format"           ,\
1716                             /*Parameter*/ out_aln_format,\
1717                             /*Def 1*/    "aln,html"           ,\
1718                             /*Def 2*/    "1"             ,\
1719                             /*Min_value*/ "any"          ,\
1720                             /*Max Value*/ "any"           \
1721                    );
1722 /*PARAMETER PROTOTYPE:    INFILE    */
1723                declare_name (infile);
1724                get_cl_param(\
1725                             /*argc*/      argc           ,\
1726                             /*argv*/      argv           ,\
1727                             /*output*/    &le            ,\
1728                             /*Name*/      "-infile"      ,\
1729                             /*Flag*/      &garbage       ,\
1730                             /*TYPE*/      "R_F"            ,\
1731                             /*OPTIONAL?*/ OPTIONAL       ,\
1732                             /*MAX Nval*/  1              ,\
1733                             /*DOC*/       "input a pre-computed alignment, or a file to reformat"           ,\
1734                             /*Parameter*/ &infile        ,\
1735                             /*Def 1*/    ""              ,\
1736                             /*Def 2*/    ""              ,\
1737                             /*Min_value*/ "any"          ,\
1738                             /*Max Value*/ "any"           \
1739                    );          
1740
1741 /*PARAMETER PROTOTYPE:    INFILE    */
1742                declare_name (matrix);
1743                get_cl_param(\
1744                             /*argc*/      argc           ,\
1745                             /*argv*/      argv           ,\
1746                             /*output*/    &le            ,\
1747                             /*Name*/      "-matrix"      ,\
1748                             /*Flag*/      &garbage       ,\
1749                             /*TYPE*/      "S"            ,\
1750                             /*OPTIONAL?*/ OPTIONAL       ,\
1751                             /*MAX Nval*/  1              ,\
1752                             /*DOC*/       "Specifies the substitution matrix.",\
1753                             /*Parameter*/ &matrix        ,\
1754                             /*Def 1*/    "default"              ,\
1755                             /*Def 2*/    "default"    ,\
1756                             /*Min_value*/ "any"          ,\
1757                             /*Max Value*/ "any"           \
1758                    );       
1759 /*PARAMETER PROTOTYPE:    TG_MODE    */
1760                
1761                get_cl_param(\
1762                             /*argc*/      argc           ,\
1763                             /*argv*/      argv           ,\
1764                             /*output*/    &le            ,\
1765                             /*Name*/      "-tg_mode"      ,\
1766                             /*Flag*/      &garbage       ,\
1767                             /*TYPE*/      "D"            ,\
1768                             /*OPTIONAL?*/ OPTIONAL       ,\
1769                             /*MAX Nval*/  1              ,\
1770                             /*DOC*/       "0: Penalise Term gap with gapopen and gapext\n1: gapopen only\n2: No penalty\n",\
1771                             /*Parameter*/ &tg_mode        ,\
1772                             /*Def 1*/    "1",\
1773                             /*Def 2*/    "0",\
1774                             /*Min_value*/ "any"          ,\
1775                             /*Max Value*/ "any"           \
1776                    );      
1777 /*PARAMETER PROTOTYPE:    DP_MODE    */
1778                declare_name (profile_mode);
1779                get_cl_param(\
1780                             /*argc*/      argc           ,\
1781                             /*argv*/      argv           ,\
1782                             /*output*/    &le            ,\
1783                             /*Name*/      "-profile_mode"      ,\
1784                             /*Flag*/      &garbage       ,\
1785                             /*TYPE*/      "S"            ,\
1786                             /*OPTIONAL?*/ OPTIONAL       ,\
1787                             /*MAX Nval*/  1              ,\
1788                             /*DOC*/       "Function used to compute profile2profile scores",\
1789                             /*Parameter*/ &profile_mode        ,\
1790                             /*Def 1*/    "cw_profile_profile",\
1791                             /*Def 2*/    "cw_profile_profile",\
1792                             /*Min_value*/ "any"          ,\
1793                             /*Max Value*/ "any"           \
1794                    );
1795
1796                declare_name (profile_comparison);
1797                get_cl_param(\
1798                             /*argc*/      argc           ,\
1799                             /*argv*/      argv           ,\
1800                             /*output*/    &le            ,\
1801                             /*Name*/      "-profile_comparison"      ,\
1802                             /*Flag*/      &garbage       ,\
1803                             /*TYPE*/      "S"            ,\
1804                             /*OPTIONAL?*/ OPTIONAL       ,\
1805                             /*MAX Nval*/  1              ,\
1806                             /*DOC*/       "Method used to compare two profiles: full<N>: compares <every | N best> pair of sequence and every pair of structure if a structure method is used,profile: compares only the profiles.  ",\
1807                             /*Parameter*/ &profile_comparison        ,\
1808                             /*Def 1*/    "profile",\
1809                             /*Def 2*/    "full50",\
1810                             /*Min_value*/ "any"          ,\
1811                             /*Max Value*/ "any"           \
1812                    );
1813 /*PARAMETER PROTOTYPE:    DP_MODE    */
1814                declare_name (dp_mode);
1815                get_cl_param(\
1816                             /*argc*/      argc           ,\
1817                             /*argv*/      argv           ,\
1818                             /*output*/    &le            ,\
1819                             /*Name*/      "-dp_mode"      ,\
1820                             /*Flag*/      &garbage       ,\
1821                             /*TYPE*/      "S"            ,\
1822                             /*OPTIONAL?*/ OPTIONAL       ,\
1823                             /*MAX Nval*/  1              ,\
1824                             /*DOC*/       "Type of alignment algorithm used by T-Coffee: gotoh_pair_wise, myers_millers_pair_wise, "           ,\
1825                             /*Parameter*/ &dp_mode        ,\
1826                             /*Def 1*/    "linked_pair_wise",\
1827                             /*Def 2*/    "cfasta_pair_wise",\
1828                             /*Min_value*/ "any"          ,\
1829                             /*Max Value*/ "any"           \
1830                    );          
1831 /*PARAMETER PROTOTYPE:    KTUP    */
1832                get_cl_param(\
1833                             /*argc*/      argc           ,\
1834                             /*argv*/      argv           ,\
1835                             /*output*/    &le            ,\
1836                             /*Name*/      "-ktuple"      ,\
1837                             /*Flag*/      &garbage       ,\
1838                             /*TYPE*/      "D"            ,\
1839                             /*OPTIONAL?*/ OPTIONAL       ,\
1840                             /*MAX Nval*/  1              ,\
1841                             /*DOC*/       "Word size when using the heursitic dynamic programming modes fasta_pair_wise and cfasta_pair_wise "           ,\
1842                             /*Parameter*/ &ktup          ,\
1843                             /*Def 1*/    "1",\
1844                             /*Def 2*/    "1",\
1845                             /*Min_value*/ "any"          ,\
1846                             /*Max Value*/ "any"           \
1847                    );          
1848 /*PARAMETER PROTOTYPE:    FASTA_STEP    */
1849                get_cl_param(\
1850                             /*argc*/      argc           ,\
1851                             /*argv*/      argv           ,\
1852                             /*output*/    &le            ,\
1853                             /*Name*/      "-ndiag"      ,\
1854                             /*Flag*/      &garbage       ,\
1855                             /*TYPE*/      "D"            ,\
1856                             /*OPTIONAL?*/ OPTIONAL       ,\
1857                             /*MAX Nval*/  1              ,\
1858                             /*DOC*/       "Number of diagonals to consider when using the heursitic dynamic programming modes fasta_pair_wise and cfasta_pair_wise"           ,\
1859                             /*Parameter*/ &fasta_step          ,\
1860                             /*Def 1*/    "0",\
1861                             /*Def 2*/    "10",\
1862                             /*Min_value*/ "any"          ,\
1863                             /*Max Value*/ "any"           \
1864                    );   
1865 /*PARAMETER PROTOTYPE:    FASTA_STEP    */
1866                get_cl_param(\
1867                             /*argc*/      argc           ,\
1868                             /*argv*/      argv           ,\
1869                             /*output*/    &le            ,\
1870                             /*Name*/      "-diag_threshold"      ,\
1871                             /*Flag*/      &garbage       ,\
1872                             /*TYPE*/      "D"            ,\
1873                             /*OPTIONAL?*/ OPTIONAL       ,\
1874                             /*MAX Nval*/  1              ,\
1875                             /*DOC*/       "ND"           ,\
1876                             /*Parameter*/ &diag_threshold ,\
1877                             /*Def 1*/    "0",\
1878                             /*Def 2*/    "10",\
1879                             /*Min_value*/ "any"          ,\
1880                             /*Max Value*/ "any"           \
1881                    );       
1882 /*PARAMETER PROTOTYPE:    diag_mode    */
1883                get_cl_param(\
1884                             /*argc*/      argc           ,\
1885                             /*argv*/      argv           ,\
1886                             /*output*/    &le            ,\
1887                             /*Name*/      "-diag_mode"      ,\
1888                             /*Flag*/      &garbage       ,\
1889                             /*TYPE*/      "D"            ,\
1890                             /*OPTIONAL?*/ OPTIONAL       ,\
1891                             /*MAX Nval*/  1              ,\
1892                             /*DOC*/       "0: Use the whole Diag\n1: Use the best match\n"           ,\
1893                             /*Parameter*/ &diag_mode          ,\
1894                             /*Def 1*/    "0",\
1895                             /*Def 2*/    "1",
1896                             /*Min_value*/ "any"          ,\
1897                             /*Max Value*/ "any"           \
1898                    );   
1899 /*PARAMETER PROTOTYPE:    SIM_MATRIX    */
1900                declare_name (sim_matrix);
1901                get_cl_param(\
1902                             /*argc*/      argc           ,\
1903                             /*argv*/      argv           ,\
1904                             /*output*/    &le            ,\
1905                             /*Name*/      "-sim_matrix"      ,\
1906                             /*Flag*/      &garbage       ,\
1907                             /*TYPE*/      "S"            ,\
1908                             /*OPTIONAL?*/ OPTIONAL       ,\
1909                             /*MAX Nval*/  1              ,\
1910                             /*DOC*/       "Degenerated matrix used to compute a similarity"           ,\
1911                             /*Parameter*/ &sim_matrix        ,\
1912                             /*Def 1*/    "vasiliky",\
1913                             /*Def 2*/    "idmat",\
1914                             /*Min_value*/ "any"          ,\
1915                             /*Max Value*/ "any"           \
1916                    );
1917
1918 /*PARAMETER PROTOTYPE:    INFILE    */
1919                declare_name (transform);
1920                get_cl_param(\
1921                             /*argc*/      argc           ,\
1922                             /*argv*/      argv           ,\
1923                             /*output*/    &le            ,\
1924                             /*Name*/      "-transform"        ,\
1925                             /*Flag*/      &garbage       ,\
1926                             /*TYPE*/      "S"            ,\
1927                             /*OPTIONAL?*/ OPTIONAL       ,\
1928                             /*MAX Nval*/  1              ,\
1929                             /*DOC*/       "dna2rna, rna2dna, dna2prot", \
1930                             /*Parameter*/ &transform          ,\
1931                             /*Def 1*/    ""              ,\
1932                             /*Def 2*/    ""              ,\
1933                             /*Min_value*/ "any"          ,\
1934                             /*Max Value*/ "any"           \
1935                    );   
1936
1937 /*PARAMETER PROTOTYPE:    INFILE    */
1938                declare_name (outorder);
1939                get_cl_param(\
1940                             /*argc*/      argc           ,\
1941                             /*argv*/      argv           ,\
1942                             /*output*/    &le            ,\
1943                             /*Name*/      "-outorder"        ,\
1944                             /*Flag*/      &garbage       ,\
1945                             /*TYPE*/      "S"            ,\
1946                             /*OPTIONAL?*/ OPTIONAL       ,\
1947                             /*MAX Nval*/  1              ,\
1948                             /*DOC*/       "Specifies the order of the sequences in the msa: input or aligned"           ,\
1949                             /*Parameter*/ &outorder       ,\
1950                             /*Def 1*/    "input"          ,\
1951                             /*Def 2*/    "input"        ,\
1952                             /*Min_value*/ "any"          ,\
1953                             /*Max Value*/ "any"           \
1954                    );
1955
1956 /*PARAMETER PROTOTYPE:    INFILE    */
1957                declare_name (inorder);
1958                get_cl_param(\
1959                             /*argc*/      argc           ,\
1960                             /*argv*/      argv           ,\
1961                             /*output*/    &le            ,\
1962                             /*Name*/      "-inorder"        ,\
1963                             /*Flag*/      &garbage       ,\
1964                             /*TYPE*/      "S"            ,\
1965                             /*OPTIONAL?*/ OPTIONAL       ,\
1966                             /*MAX Nval*/  1              ,\
1967                             /*DOC*/       "aligned: sort the sequences in alphabetic order before starting thus making the input order irrelevant but delivering a library in arbitratry order, keep: input order is used in the library but results become input order dependant"           ,\
1968                             /*Parameter*/ &inorder       ,\
1969                             /*Def 1*/    "aligned"          ,\
1970                             /*Def 2*/    "input"        ,\
1971                             /*Min_value*/ "any"          ,\
1972                             /*Max Value*/ "any"           \
1973                    );
1974
1975 /*PARAMETER PROTOTYPE:    INFILE    */
1976                declare_name (output_res_num);
1977                get_cl_param(\
1978                             /*argc*/      argc           ,\
1979                             /*argv*/      argv           ,\
1980                             /*output*/    &le            ,\
1981                             /*Name*/      "-seqnos"        ,\
1982                             /*Flag*/      &garbage       ,\
1983                             /*TYPE*/      "S"            ,\
1984                             /*OPTIONAL?*/ OPTIONAL       ,\
1985                             /*MAX Nval*/  1              ,\
1986                             /*DOC*/       "Adds Residue Numbers to the MSA"           ,\
1987                             /*Parameter*/ &output_res_num ,\
1988                             /*Def 1*/    "off"            ,\
1989                             /*Def 2*/    "on"             ,\
1990                             /*Min_value*/ "any"           ,\
1991                             /*Max Value*/ "any"            \
1992                    );
1993 /*PARAMETER PROTOTYPE:    INFILE    */
1994                declare_name (residue_case);
1995                get_cl_param(\
1996                             /*argc*/      argc           ,\
1997                             /*argv*/      argv           ,\
1998                             /*output*/    &le            ,\
1999                             /*Name*/      "-case"        ,\
2000                             /*Flag*/      &garbage       ,\
2001                             /*TYPE*/      "S"            ,\
2002                             /*OPTIONAL?*/ OPTIONAL       ,\
2003                             /*MAX Nval*/  1              ,\
2004                             /*DOC*/       "Causes the case to be: kept:lower:upper."           ,\
2005                             /*Parameter*/ &residue_case         ,\
2006                             /*Def 1*/    "keep"            ,\
2007                             /*Def 2*/    "upper"             ,\
2008                             /*Min_value*/ "any"           ,\
2009                             /*Max Value*/ "any"            \
2010                    );
2011
2012 /*PARAMETER PROTOTYPE:    CPU     */
2013                
2014                get_cl_param(\
2015                             /*argc*/      argc          ,\
2016                             /*argv*/      argv          ,\
2017                             /*output*/    &le           ,\
2018                             /*Name*/      "-cpu"        ,\
2019                             /*Flag*/      &garbage      ,\
2020                             /*TYPE*/      "D"           ,\
2021                             /*OPTIONAL?*/ OPTIONAL      ,\
2022                             /*MAX Nval*/  1             ,\
2023                             /*DOC*/       "Makes it possible to add a pre-specified amount of cpu time to the measured usage"          ,\
2024                             /*Parameter*/ &extra_cpu    ,\
2025                             /*Def 1*/    "0"            ,\
2026                             /*Def 2*/    "0"            ,\
2027                             /*Min_value*/ "any"         ,\
2028                             /*Max Value*/ "any"          \
2029                    );
2030
2031 /*PARAMETER PROTOTYPE:    MAXNSEQ     */
2032                
2033                get_cl_param(\
2034                             /*argc*/      argc          ,\
2035                             /*argv*/      argv          ,\
2036                             /*output*/    &le           ,\
2037                             /*Name*/      "-maxnseq"        ,\
2038                             /*Flag*/      &garbage      ,\
2039                             /*TYPE*/      "D"           ,\
2040                             /*OPTIONAL?*/ OPTIONAL      ,\
2041                             /*MAX Nval*/  1             ,\
2042                             /*DOC*/       "Maximum number of sequences (-1=no max)"          ,\
2043                             /*Parameter*/ &maxnseq    ,\
2044                             /*Def 1*/    "1000"            ,\
2045                             /*Def 2*/    "0"            ,\
2046                             /*Min_value*/ "any"         ,\
2047                             /*Max Value*/ "any"          \
2048                    );
2049
2050 /*PARAMETER PROTOTYPE:    MAXLEN     */
2051                
2052                get_cl_param(\
2053                             /*argc*/      argc          ,\
2054                             /*argv*/      argv          ,\
2055                             /*output*/    &le           ,\
2056                             /*Name*/      "-maxlen"        ,\
2057                             /*Flag*/      &garbage      ,\
2058                             /*TYPE*/      "D"           ,\
2059                             /*OPTIONAL?*/ OPTIONAL      ,\
2060                             /*MAX Nval*/  1             ,\
2061                             /*DOC*/       "Maximum length of a sequence (-1=no max)"          ,\
2062                             /*Parameter*/ &maxlen    ,\
2063                             /*Def 1*/    "-1"            ,\
2064                             /*Def 2*/    "-1"            ,\
2065                             /*Min_value*/ "any"         ,\
2066                             /*Max Value*/ "any"          \
2067                    );
2068
2069
2070 /*PARAMETER PROTOTYPE:    WEIGHT      */
2071                declare_name ( weight);
2072                get_cl_param(\
2073                             /*argc*/      argc             ,\
2074                             /*argv*/      argv             ,\
2075                             /*output*/    &le              ,\
2076                             /*Name*/      "-weight"        ,\
2077                             /*Flag*/      &garbage        ,\
2078                             /*TYPE*/      "S"              ,\
2079                             /*OPTIONAL?*/ OPTIONAL         ,\
2080                             /*MAX Nval*/  1                ,\
2081                             /*DOC*/       "Defines the library weight: sim OR  sim_(matrix) OR winsim" ,\
2082                             /*Parameter*/ &weight          ,\
2083                             /*Def 1*/    "default"             ,\
2084                             /*Def 2*/    "sim"             ,\
2085                             /*Min_value*/ "any"            ,\
2086                             /*Max Value*/ "any"             \
2087                    );     /*PARAMETER PROTOTYPE:    WEIGHT      */
2088                declare_name ( seq_weight);
2089                
2090                get_cl_param(\
2091                             /*argc*/      argc             ,\
2092                             /*argv*/      argv             ,\
2093                             /*output*/    &le              ,\
2094                             /*Name*/      "-seq_weight"        ,\
2095                             /*Flag*/      &garbage        ,\
2096                             /*TYPE*/      "S"              ,\
2097                             /*OPTIONAL?*/ OPTIONAL         ,\
2098                             /*MAX Nval*/  1                ,\
2099                             /*DOC*/       "Defines the sequences weighting scheme t_coffee" ,\
2100                             /*Parameter*/ &seq_weight          ,\
2101                             /*Def 1*/    "t_coffee"             ,\
2102                             /*Def 2*/    "t_coffee"             ,\
2103                             /*Min_value*/ "any"            ,\
2104                             /*Max Value*/ "any"             \
2105                    );       
2106
2107 /*PARAMETER PROTOTYPE:    DO ALIGN      */
2108                get_cl_param(\
2109                             /*argc*/      argc             ,\
2110                             /*argv*/      argv             ,\
2111                             /*output*/    &le              ,\
2112                             /*Name*/      "-align"        ,\
2113                             /*Flag*/      &do_align        ,\
2114                             /*TYPE*/      "FL"              ,\
2115                             /*OPTIONAL?*/ OPTIONAL         ,\
2116                             /*MAX Nval*/  0                ,\
2117                             /*DOC*/       "forces the program to make the alignment" ,\
2118                             /*Parameter*/ &do_align          ,\
2119                             /*Def 1*/     "1"             ,\
2120                             /*Def 2*/     "1"             ,\
2121                             /*Min_value*/ "any"            ,\
2122                             /*Max Value*/ "any"             \
2123                    );
2124 /*PARAMETER PROTOTYPE:    DO DOMAIN      */
2125                get_cl_param(\
2126                             /*argc*/      argc             ,\
2127                             /*argv*/      argv             ,\
2128                             /*output*/    &le              ,\
2129                             /*Name*/      "-mocca"        ,\
2130                             /*Flag*/      &do_domain        ,\
2131                             /*TYPE*/      "FL"              ,\
2132                             /*OPTIONAL?*/ OPTIONAL         ,\
2133                             /*MAX Nval*/  0                ,\
2134                             /*DOC*/       "forces the program to extract domains" ,\
2135                             /*Parameter*/ &do_domain          ,\
2136                             /*Def 1*/     "0"             ,\
2137                             /*Def 2*/     "1"             ,\
2138                             /*Min_value*/ "any"            ,\
2139                             /*Max Value*/ "any"             \
2140                    );  
2141                if ( !do_domain)
2142                  {
2143 /*PARAMETER PROTOTYPE:    DO DOMAIN      */
2144                    get_cl_param(                                \
2145                             /*argc*/      argc             ,    \
2146                             /*argv*/      argv             ,\
2147                             /*output*/    &le              ,\
2148                             /*Name*/      "-domain"        ,\
2149                             /*Flag*/      &do_domain        ,\
2150                             /*TYPE*/      "FL"              ,\
2151                             /*OPTIONAL?*/ OPTIONAL         ,\
2152                             /*MAX Nval*/  0                ,\
2153                             /*DOC*/       "forces the program to extract domains" ,\
2154                             /*Parameter*/ &do_domain          ,\
2155                             /*Def 1*/     "0"             ,\
2156                             /*Def 2*/     "1"             ,\
2157                             /*Min_value*/ "any"            ,\
2158                             /*Max Value*/ "any"             \
2159                                           );  
2160                  }
2161 /*PARAMETER PROTOTYPE:    Domain Param      */
2162                get_cl_param(\
2163                             /*argc*/      argc             ,\
2164                             /*argv*/      argv             ,\
2165                             /*output*/    &le              ,\
2166                             /*Name*/      "-start"        ,\
2167                             /*Flag*/      &domain_start        ,\
2168                             /*TYPE*/      "D"              ,\
2169                             /*OPTIONAL?*/ OPTIONAL         ,\
2170                             /*MAX Nval*/  1                ,\
2171                             /*DOC*/       "start of the master domain in the mocca mode" ,\
2172                             /*Parameter*/ &domain_start          ,\
2173                             /*Def 1*/     "0"             ,\
2174                             /*Def 2*/     "1"             ,\
2175                             /*Min_value*/ "any"            ,\
2176                             /*Max Value*/ "any"             \
2177                    );        
2178 get_cl_param(\
2179                             /*argc*/      argc             ,\
2180                             /*argv*/      argv             ,\
2181                             /*output*/    &le              ,\
2182                             /*Name*/      "-len"        ,\
2183                             /*Flag*/      &domain_len        ,\
2184                             /*TYPE*/      "D"              ,\
2185                             /*OPTIONAL?*/ OPTIONAL         ,\
2186                             /*MAX Nval*/  1                ,\
2187                             /*DOC*/       "length of the master domain in the mocca mode" ,\
2188                             /*Parameter*/ &domain_len          ,\
2189                             /*Def 1*/     "0"             ,\
2190                             /*Def 2*/     "1"             ,\
2191                             /*Min_value*/ "any"            ,\
2192                             /*Max Value*/ "any"             \
2193                    );
2194
2195 get_cl_param(\
2196                             /*argc*/      argc             ,\
2197                             /*argv*/      argv             ,\
2198                             /*output*/    &le              ,\
2199                             /*Name*/      "-scale"        ,\
2200                             /*Flag*/      &domain_scale        ,\
2201                             /*TYPE*/      "D"              ,\
2202                             /*OPTIONAL?*/ OPTIONAL         ,\
2203                             /*MAX Nval*/  1                ,\
2204                             /*DOC*/       "Decreases the t_coffee score by Scale, so that non match get negative values" ,\
2205                             /*Parameter*/ &domain_scale          ,\
2206                             /*Def 1*/     "0"             ,\
2207                             /*Def 2*/     "1"             ,\
2208                             /*Min_value*/ "any"            ,\
2209                             /*Max Value*/ "any"             \
2210                    );
2211 get_cl_param(\
2212                             /*argc*/      argc             ,\
2213                             /*argv*/      argv             ,\
2214                             /*output*/    &le              ,\
2215                             /*Name*/      "-mocca_interactive"        ,\
2216                             /*Flag*/      &domain_interactive        ,\
2217                             /*TYPE*/      "FL"             ,\
2218                             /*OPTIONAL?*/ OPTIONAL         ,\
2219                             /*MAX Nval*/  0                ,\
2220                             /*DOC*/       "Runs Mocca in an interactive manneer" ,\
2221                             /*Parameter*/ &domain_interactive,\
2222                             /*Def 1*/     "0"             ,\
2223                             /*Def 2*/     "1"             ,\
2224                             /*Min_value*/ "any"            ,\
2225                             /*Max Value*/ "any"             \
2226                    );
2227 /*PARAMETER PROTOTYPE:    WEIGHT      */
2228                declare_name (method_evaluate_mode);
2229                get_cl_param(\
2230                             /*argc*/      argc             ,\
2231                             /*argv*/      argv             ,\
2232                             /*output*/    &le              ,\
2233                             /*Name*/      "-method_evaluate_mode"        ,\
2234                             /*Flag*/      &garbage        ,\
2235                             /*TYPE*/      "S"              ,\
2236                             /*OPTIONAL?*/ OPTIONAL         ,\
2237                             /*MAX Nval*/  1                ,\
2238                             /*DOC*/       "Specifies which method should be used to evaluate the score at the pairwise level" ,\
2239                             /*Parameter*/ &method_evaluate_mode          ,\
2240                             /*Def 1*/    "default"             ,\
2241                             /*Def 2*/    "default"             ,\
2242                             /*Min_value*/ "any"            ,\
2243                             /*Max Value*/ "any"             \
2244                                           );         
2245  /*PARAMETER PROTOTYPE:    WEIGHT      */
2246                declare_name (evaluate_mode);
2247                get_cl_param(\
2248                             /*argc*/      argc             ,\
2249                             /*argv*/      argv             ,\
2250                             /*output*/    &le              ,\
2251                             /*Name*/      "-evaluate_mode"        ,\
2252                             /*Flag*/      &garbage        ,\
2253                             /*TYPE*/      "S"              ,\
2254                             /*OPTIONAL?*/ OPTIONAL         ,\
2255                             /*MAX Nval*/  1                ,\
2256                             /*DOC*/       "Mode used to produce the color output:t_coffee_fast,t_coffee_slow  " ,\
2257                             /*Parameter*/ &evaluate_mode          ,\
2258                             /*Def 1*/    "t_coffee_fast"             ,\
2259                             /*Def 2*/    "dali"             ,\
2260                             /*Min_value*/ "any"            ,\
2261                             /*Max Value*/ "any"             \
2262                    );        
2263                get_cl_param(\
2264                             /*argc*/      argc             ,\
2265                             /*argv*/      argv             ,\
2266                             /*output*/    &le              ,\
2267                             /*Name*/      "-get_type"        ,\
2268                             /*Flag*/      &get_type        ,\
2269                             /*TYPE*/      "FL"              ,\
2270                             /*OPTIONAL?*/ OPTIONAL         ,\
2271                             /*MAX Nval*/  1                ,\
2272                             /*DOC*/       "forces t_coffee top get the type of the sequences" ,\
2273                             /*Parameter*/ &get_type          ,\
2274                             /*Def 1*/    "0"             ,\
2275                             /*Def 2*/    "1"             ,\
2276                             /*Min_value*/ "0"            ,\
2277                             /*Max Value*/ "1"             \
2278                    );        
2279
2280 get_cl_param(\
2281                             /*argc*/      argc             ,\
2282                             /*argv*/      argv             ,\
2283                             /*output*/    &le              ,\
2284                             /*Name*/      "-clean_aln"        ,\
2285                             /*Flag*/      &clean_aln        ,\
2286                             /*TYPE*/      "D"              ,\
2287                             /*OPTIONAL?*/ OPTIONAL         ,\
2288                             /*MAX Nval*/  1                ,\
2289                             /*DOC*/       "Forces weak portion of aln to be realigned" ,\
2290                             /*Parameter*/ &clean_aln          ,\
2291                             /*Def 1*/    "0"             ,\
2292                             /*Def 2*/    "1"             ,\
2293                             /*Min_value*/ "0"            ,\
2294                             /*Max Value*/ "1"             \
2295                    );
2296 get_cl_param(\
2297                             /*argc*/      argc             ,\
2298                             /*argv*/      argv             ,\
2299                             /*output*/    &le              ,\
2300                             /*Name*/      "-clean_threshold"        ,\
2301                             /*Flag*/      &clean_threshold        ,\
2302                             /*TYPE*/      "D"              ,\
2303                             /*OPTIONAL?*/ OPTIONAL         ,\
2304                             /*MAX Nval*/  1                ,\
2305                             /*DOC*/       "Threshold for the portions of the MSA that will are realigned by '-clean_evaluate_mode'. The threshold refers to the CORE score set by '-evaluate_mode'" ,\
2306                             /*Parameter*/ &clean_threshold          ,\
2307                             /*Def 1*/     "1"             ,\
2308                             /*Def 2*/     "1"             ,\
2309                             /*Min_value*/ "any"            ,\
2310                             /*Max Value*/ "any"             \
2311                    );
2312 get_cl_param(\
2313                             /*argc*/      argc             ,\
2314                             /*argv*/      argv             ,\
2315                             /*output*/    &le              ,\
2316                             /*Name*/      "-clean_iteration"        ,\
2317                             /*Flag*/      &clean_iteration        ,\
2318                             /*TYPE*/      "D"              ,\
2319                             /*OPTIONAL?*/ OPTIONAL         ,\
2320                             /*MAX Nval*/  1                ,\
2321                             /*DOC*/       "Number of rounds for '-clean_aln'" ,\
2322                             /*Parameter*/ &clean_iteration          ,\
2323                             /*Def 1*/     "1"             ,\
2324                             /*Def 2*/     "1"             ,\
2325                             /*Min_value*/ "any"            ,\
2326                             /*Max Value*/ "any"             \
2327                    );
2328 declare_name (clean_evaluate_mode);
2329 get_cl_param(\
2330                             /*argc*/      argc             ,\
2331                             /*argv*/      argv             ,\
2332                             /*output*/    &le              ,\
2333                             /*Name*/      "-clean_evaluate_mode"        ,\
2334                             /*Flag*/      &garbage        ,\
2335                             /*TYPE*/      "S"              ,\
2336                             /*OPTIONAL?*/ OPTIONAL         ,\
2337                             /*MAX Nval*/  1                ,\
2338                             /*DOC*/       "Mode used to score residues (see evaluate_mode)" ,\
2339                             /*Parameter*/ &clean_evaluate_mode          ,\
2340                             /*Def 1*/    "t_coffee_fast"             ,\
2341                             /*Def 2*/    "t_coffee_fast"             ,\
2342                             /*Min_value*/ "any"            ,\
2343                             /*Max Value*/ "any"             \
2344                    );       
2345
2346 /*PARAMETER PROTOTYPE:    DO EXTENDED MATRIX      */
2347                get_cl_param(\
2348                             /*argc*/      argc             ,\
2349                             /*argv*/      argv             ,\
2350                             /*output*/    &le              ,\
2351                             /*Name*/      "-extend_matrix"        ,\
2352                             /*Flag*/      &do_extended_matrix        ,\
2353                             /*TYPE*/      "FL"              ,\
2354                             /*OPTIONAL?*/ OPTIONAL         ,\
2355                             /*MAX Nval*/  0                ,\
2356                             /*DOC*/       "Deprecated" ,\
2357                             /*Parameter*/ &do_extended_matrix          ,\
2358                             /*Def 1*/     "0"             ,\
2359                             /*Def 2*/     "1"             ,\
2360                             /*Min_value*/ "any"            ,\
2361                             /*Max Value*/ "any"             \
2362                    );  
2363 get_cl_param(\
2364                             /*argc*/      argc             ,\
2365                             /*argv*/      argv             ,\
2366                             /*output*/    &le              ,\
2367                             /*Name*/      "-prot_min_sim"        ,\
2368                             /*Flag*/      &prot_min_sim        ,\
2369                             /*TYPE*/      "D"              ,\
2370                             /*OPTIONAL?*/ OPTIONAL         ,\
2371                             /*MAX Nval*/  1                ,\
2372                             /*DOC*/       "Minimum similarity between a sequence and its PDB target" ,\
2373                             /*Parameter*/ &prot_min_sim          ,\
2374                             /*Def 1*/     "0"             ,\
2375                             /*Def 2*/     "20"             ,\
2376                             /*Min_value*/ "any"            ,\
2377                             /*Max Value*/ "any"             \
2378                    );
2379  set_int_variable ("prot_min_sim", prot_min_sim);
2380
2381 get_cl_param(\
2382                             /*argc*/      argc             ,\
2383                             /*argv*/      argv             ,\
2384                             /*output*/    &le              ,\
2385                             /*Name*/      "-prot_max_sim"        ,\
2386                             /*Flag*/      &prot_max_sim        ,\
2387                             /*TYPE*/      "D"              ,\
2388                             /*OPTIONAL?*/ OPTIONAL         ,\
2389                             /*MAX Nval*/  1                ,\
2390                             /*DOC*/       "Maximum similarity between a sequence and its BLAST relatives" ,\
2391                             /*Parameter*/ &prot_max_sim          ,\
2392                             /*Def 1*/     "90"             ,\
2393                             /*Def 2*/     "100"             ,\
2394                             /*Min_value*/ "any"            ,\
2395                             /*Max Value*/ "any"             \
2396                    );
2397  set_int_variable ("prot_max_sim", prot_max_sim);
2398  
2399 get_cl_param(\
2400                             /*argc*/      argc             ,\
2401                             /*argv*/      argv             ,\
2402                             /*output*/    &le              ,\
2403                             /*Name*/      "-prot_min_cov"        ,\
2404                             /*Flag*/      &prot_min_cov        ,\
2405                             /*TYPE*/      "D"              ,\
2406                             /*OPTIONAL?*/ OPTIONAL         ,\
2407                             /*MAX Nval*/  1                ,\
2408                             /*DOC*/       "Minimum coverage of a sequence by its BLAST relatives" ,\
2409                             /*Parameter*/ &prot_min_cov          ,\
2410                             /*Def 1*/     "0"             ,\
2411                             /*Def 2*/     "0"             ,\
2412                             /*Min_value*/ "any"            ,\
2413                             /*Max Value*/ "any"             \
2414                    );
2415 set_int_variable ("prot_min_cov", prot_min_cov);
2416
2417 get_cl_param(\
2418                             /*argc*/      argc             ,\
2419                             /*argv*/      argv             ,\
2420                             /*output*/    &le              ,\
2421                             /*Name*/      "-pdb_min_sim"        ,\
2422                             /*Flag*/      &pdb_min_sim        ,\
2423                             /*TYPE*/      "D"              ,\
2424                             /*OPTIONAL?*/ OPTIONAL         ,\
2425                             /*MAX Nval*/  1                ,\
2426                             /*DOC*/       "Minimum similarity between a sequence and its PDB target" ,\
2427                             /*Parameter*/ &pdb_min_sim          ,\
2428                             /*Def 1*/     "35"             ,\
2429                             /*Def 2*/     "35"             ,\
2430                             /*Min_value*/ "any"            ,\
2431                             /*Max Value*/ "any"             \
2432                    );
2433
2434  set_int_variable ("pdb_min_sim", pdb_min_sim);
2435  get_cl_param(                                                  \
2436                             /*argc*/      argc             ,\
2437                             /*argv*/      argv             ,\
2438                             /*output*/    &le              ,\
2439                             /*Name*/      "-pdb_max_sim"        ,\
2440                             /*Flag*/      &pdb_max_sim        ,\
2441                             /*TYPE*/      "D"              ,\
2442                             /*OPTIONAL?*/ OPTIONAL         ,\
2443                             /*MAX Nval*/  1                ,\
2444                             /*DOC*/       "Maximum similarity between a sequence and its PDB target" ,\
2445                             /*Parameter*/ &pdb_max_sim          ,\
2446                             /*Def 1*/     "100"             ,\
2447                             /*Def 2*/     "0"             ,\
2448                             /*Min_value*/ "any"            ,\
2449                             /*Max Value*/ "any"             \
2450                    );
2451  set_int_variable ("pdb_max_sim", pdb_max_sim);
2452  get_cl_param(                                                  \
2453                             /*argc*/      argc             ,\
2454                             /*argv*/      argv             ,\
2455                             /*output*/    &le              ,\
2456                             /*Name*/      "-pdb_min_cov"        ,\
2457                             /*Flag*/      &pdb_min_cov        ,\
2458                             /*TYPE*/      "D"              ,\
2459                             /*OPTIONAL?*/ OPTIONAL         ,\
2460                             /*MAX Nval*/  1                ,\
2461                             /*DOC*/       "Minimum coverage of a sequence by its PDB target" ,\
2462                             /*Parameter*/ &pdb_min_cov          ,\
2463                             /*Def 1*/     "50"             ,\
2464                             /*Def 2*/     "25"             ,\
2465                             /*Min_value*/ "any"            ,\
2466                             /*Max Value*/ "any"             \
2467                    );
2468 set_int_variable ("pdb_min_cov", pdb_min_cov);
2469  
2470
2471  
2472 declare_name (pdb_blast_server);
2473  get_cl_param(\
2474                             /*argc*/      argc          ,\
2475                             /*argv*/      argv          ,\
2476                             /*output*/    &le           ,\
2477                             /*Name*/      "-pdb_blast_server"    ,\
2478                             /*Flag*/      &garbage      ,\
2479                             /*TYPE*/      "W_F"         ,\
2480                             /*OPTIONAL?*/ OPTIONAL      ,\
2481                             /*MAX Nval*/  1             ,\
2482                             /*DOC*/       "ND"          ,\
2483                             /*Parameter*/&pdb_blast_server       ,\
2484                             /*Def 1*/    "EBI"      ,\
2485                             /*Def 2*/    "default"      ,\
2486                             /*Min_value*/ "any"         ,\
2487                             /*Max Value*/ "any"          \
2488                    );
2489 declare_name (prot_blast_server);
2490  get_cl_param(\
2491                             /*argc*/      argc          ,\
2492                             /*argv*/      argv          ,\
2493                             /*output*/    &le           ,\
2494                             /*Name*/      "-blast"    ,\
2495                             /*Flag*/      &garbage      ,\
2496                             /*TYPE*/      "W_F"         ,\
2497                             /*OPTIONAL?*/ OPTIONAL      ,\
2498                             /*MAX Nval*/  1             ,\
2499                             /*DOC*/       "ND"          ,\
2500                             /*Parameter*/&prot_blast_server       ,\
2501                             /*Def 1*/    ""      ,\
2502                             /*Def 2*/    ""      ,\
2503                             /*Min_value*/ "any"         ,\
2504                             /*Max Value*/ "any"          \
2505                    );
2506  //make sure that -blast and -blast_server are both supported blast>blast_server 
2507  if ( !prot_blast_server[0])
2508    {
2509      get_cl_param(                                              \
2510                             /*argc*/      argc          ,\
2511                             /*argv*/      argv          ,\
2512                             /*output*/    &le           ,\
2513                             /*Name*/      "-blast_server"    ,\
2514                             /*Flag*/      &garbage      ,\
2515                             /*TYPE*/      "W_F"         ,\
2516                             /*OPTIONAL?*/ OPTIONAL      ,\
2517                             /*MAX Nval*/  1             ,\
2518                             /*DOC*/       "ND"          ,\
2519                             /*Parameter*/&prot_blast_server       ,\
2520                             /*Def 1*/    "EBI"      ,\
2521                             /*Def 2*/    "default"      ,\
2522                             /*Min_value*/ "any"         ,\
2523                             /*Max Value*/ "any"          \
2524                    );
2525    }
2526  // HERE ("%s", blast_server);
2527  if ( strm (prot_blast_server, "env"))prot_blast_server=get_env_variable ("blast_server_4_TCOFFEE",IS_FATAL);
2528  set_string_variable ("blast_server", prot_blast_server);
2529  
2530
2531  
2532  declare_name (pdb_db);
2533  get_cl_param(\
2534                             /*argc*/      argc          ,\
2535                             /*argv*/      argv          ,\
2536                             /*output*/    &le           ,\
2537                             /*Name*/      "-pdb_db"    ,\
2538                             /*Flag*/      &garbage      ,\
2539                             /*TYPE*/      "W_F"         ,\
2540                             /*OPTIONAL?*/ OPTIONAL      ,\
2541                             /*MAX Nval*/  1             ,\
2542                             /*DOC*/       "Non Redundant PDB database"          ,\
2543                             /*Parameter*/&pdb_db       ,\
2544                             /*Def 1*/    "pdb"      ,\
2545                             /*Def 2*/    "default"      ,\
2546                             /*Min_value*/ "any"         ,\
2547                             /*Max Value*/ "any"          \
2548                    );
2549  if ( strm (pdb_db, "env"))pdb_db=get_env_variable ("pdb_db_4_TCOFFEE", IS_FATAL);
2550  set_string_variable ("pdb_db", pdb_db);
2551  
2552
2553 declare_name (prot_db);
2554  get_cl_param(\
2555                             /*argc*/      argc          ,\
2556                             /*argv*/      argv          ,\
2557                             /*output*/    &le           ,\
2558                             /*Name*/      "-protein_db"    ,\
2559                             /*Flag*/      &garbage      ,\
2560                             /*TYPE*/      "W_F"         ,\
2561                             /*OPTIONAL?*/ OPTIONAL      ,\
2562                             /*MAX Nval*/  1             ,\
2563                             /*DOC*/       "ND"          ,\
2564                             /*Parameter*/&prot_db       ,\
2565                             /*Def 1*/    "uniprot"      ,\
2566                             /*Def 2*/    "default"      ,\
2567                             /*Min_value*/ "any"         ,\
2568                             /*Max Value*/ "any"          \
2569                    );
2570  if ( strm (prot_db, "env"))prot_db=get_env_variable ("protein_db_4_TCOFFEE", IS_FATAL);
2571  set_string_variable ("prot_db", prot_db);
2572  
2573  declare_name (method_log);
2574  get_cl_param(                                                  \
2575                             /*argc*/      argc          ,\
2576                             /*argv*/      argv          ,\
2577                             /*output*/    &le           ,\
2578                             /*Name*/      "-method_log"    ,\
2579                             /*Flag*/      &garbage      ,\
2580                             /*TYPE*/      "W_F"         ,\
2581                             /*OPTIONAL?*/ OPTIONAL      ,\
2582                             /*MAX Nval*/  1             ,\
2583                             /*DOC*/       "ND"          ,\
2584                             /*Parameter*/&method_log       ,\
2585                             /*Def 1*/    "no"      ,\
2586                             /*Def 2*/    "default"      ,\
2587                             /*Min_value*/ "any"         ,\
2588                             /*Max Value*/ "any"          \
2589                    );
2590 /*PARAMETER PROTOTYPE:        IN */
2591         struc_to_use=declare_char ( 200, STRING);
2592         n_struc_to_use=get_cl_param(\
2593                             /*argc*/      argc          ,\
2594                             /*argv*/      argv          ,\
2595                             /*output*/    &le           ,\
2596                             /*Name*/      "-struc_to_use"         ,\
2597                             /*Flag*/      &garbage      ,\
2598                             /*TYPE*/      "S"           ,\
2599                             /*OPTIONAL?*/ OPTIONAL      ,\
2600                             /*MAX Nval*/  200           ,\
2601                             /*DOC*/       "Specifies the structures that must be used when combining sequences and structures. The default is to use all the structures."          ,\
2602                             /*Parameter*/ struc_to_use     ,\
2603                             /*Def 1*/    "",\
2604                             /*Def 2*/     "stdin"       ,\
2605                             /*Min_value*/ "any"         ,\
2606                             /*Max Value*/ "any"          \
2607                    );
2608
2609 declare_name (cache);
2610  get_cl_param(\
2611                             /*argc*/      argc          ,\
2612                             /*argv*/      argv          ,\
2613                             /*output*/    &le           ,\
2614                             /*Name*/      "-cache"    ,\
2615                             /*Flag*/      &garbage      ,\
2616                             /*TYPE*/      "W_F"         ,\
2617                             /*OPTIONAL?*/ OPTIONAL      ,\
2618                             /*MAX Nval*/  1             ,\
2619                             /*DOC*/       "Specifies that a cache must be used to save the structures and their comparison, as well as the blast searches.\navailable modes are: use,ignore,update,local, directory name"          ,\
2620                             /*Parameter*/ &cache       ,\
2621                             /*Def 1*/    "use"      ,\
2622                             /*Def 2*/    "update"      ,\
2623                             /*Min_value*/ "any"         ,\
2624                             /*Max Value*/ "any"          \
2625                    );
2626 declare_name (align_pdb_param_file);
2627  get_cl_param(\
2628                             /*argc*/      argc          ,\
2629                             /*argv*/      argv          ,\
2630                             /*output*/    &le           ,\
2631                             /*Name*/      "-align_pdb_param_file"    ,\
2632                             /*Flag*/      &garbage      ,\
2633                             /*TYPE*/      "W_F"         ,\
2634                             /*OPTIONAL?*/ OPTIONAL      ,\
2635                             /*MAX Nval*/  1             ,\
2636                             /*DOC*/       "parameter_file"          ,\
2637                             /*Parameter*/ &align_pdb_param_file       ,\
2638                             /*Def 1*/    "no"      ,\
2639                             /*Def 2*/    "no"      ,\
2640                             /*Min_value*/ "any"         ,\
2641                             /*Max Value*/ "any"          \
2642                    );
2643 declare_name (align_pdb_hasch_mode);
2644  get_cl_param(\
2645                             /*argc*/      argc          ,\
2646                             /*argv*/      argv          ,\
2647                             /*output*/    &le           ,\
2648                             /*Name*/      "-align_pdb_hasch_mode"    ,\
2649                             /*Flag*/      &garbage      ,\
2650                             /*TYPE*/      "W_F"         ,\
2651                             /*OPTIONAL?*/ OPTIONAL      ,\
2652                             /*MAX Nval*/  1             ,\
2653                             /*DOC*/       "parameter_file"          ,\
2654                             /*Parameter*/ &align_pdb_hasch_mode       ,\
2655                             /*Def 1*/    "hasch_ca_trace_bubble"      ,\
2656                             /*Def 2*/    "hasch_ca_trace_bubble"      ,\
2657                             /*Min_value*/ "any"         ,\
2658                             /*Max Value*/ "any"          \
2659                    );
2660 declare_name (use_seqan);
2661  get_cl_param(\
2662                             /*argc*/      argc          ,\
2663                             /*argv*/      argv          ,\
2664                             /*output*/    &le           ,\
2665                             /*Name*/      "-external_aligner"    ,\
2666                             /*Flag*/      &garbage      ,\
2667                             /*TYPE*/      "S"         ,\
2668                             /*OPTIONAL?*/ OPTIONAL      ,\
2669                             /*MAX Nval*/  1             ,\
2670                             /*DOC*/       "Use seqan to compute the MSA",\
2671                             /*Parameter*/ &use_seqan      ,\
2672                             /*Def 1*/    "NO"      ,\
2673                             /*Def 2*/    "seqan_tcoffee"      ,\
2674                             /*Min_value*/ "any"         ,\
2675                             /*Max Value*/ "any"          \
2676                    );
2677 declare_name (msa_mode);
2678  get_cl_param(\
2679                             /*argc*/      argc          ,\
2680                             /*argv*/      argv          ,\
2681                             /*output*/    &le           ,\
2682                             /*Name*/      "-msa_mode"    ,\
2683                             /*Flag*/      &garbage      ,\
2684                             /*TYPE*/      "S"         ,\
2685                             /*OPTIONAL?*/ OPTIONAL      ,\
2686                             /*MAX Nval*/  1             ,\
2687                             /*DOC*/       "Algorithm used to compute the MSA: tree | graph"          ,\
2688                             /*Parameter*/ &msa_mode      ,\
2689                             /*Def 1*/    "tree"      ,\
2690                             /*Def 2*/    "tree"      ,\
2691                             /*Min_value*/ "any"         ,\
2692                             /*Max Value*/ "any"          \
2693                    );
2694 declare_name (one2all);
2695  get_cl_param(\
2696                             /*argc*/      argc          ,\
2697                             /*argv*/      argv          ,\
2698                             /*output*/    &le           ,\
2699                             /*Name*/      "-one2all"    ,\
2700                             /*Flag*/      &garbage      ,\
2701                             /*TYPE*/      "S"         ,\
2702                             /*OPTIONAL?*/ OPTIONAL      ,\
2703                             /*MAX Nval*/  1             ,\
2704                             /*DOC*/       "Align all the sequences to the master sequence"          ,\
2705                             /*Parameter*/ &one2all      ,\
2706                             /*Def 1*/    "NULL"      ,\
2707                             /*Def 2*/    "1"      ,\
2708                             /*Min_value*/ "any"         ,\
2709                             /*Max Value*/ "any"          \
2710                    );
2711 declare_name (subset2all);
2712  get_cl_param(\
2713                             /*argc*/      argc          ,\
2714                             /*argv*/      argv          ,\
2715                             /*output*/    &le           ,\
2716                             /*Name*/      "-subset2all"    ,\
2717                             /*Flag*/      &garbage      ,\
2718                             /*TYPE*/      "S"         ,\
2719                             /*OPTIONAL?*/ OPTIONAL      ,\
2720                             /*MAX Nval*/  1             ,\
2721                             /*DOC*/       "Align all the sequences to the master sequence"          ,\
2722                             /*Parameter*/ &subset2all      ,\
2723                             /*Def 1*/    "NULL"      ,\
2724                             /*Def 2*/    "1"      ,\
2725                             /*Min_value*/ "any"         ,\
2726                             /*Max Value*/ "any"          \
2727                    );
2728
2729  get_cl_param(\
2730                             /*argc*/      argc          ,\
2731                             /*argv*/      argv          ,\
2732                             /*output*/    &le           ,\
2733                             /*Name*/      "-lalign_n_top"    ,\
2734                             /*Flag*/      &garbage      ,\
2735                             /*TYPE*/      "D"         ,\
2736                             /*OPTIONAL?*/ OPTIONAL      ,\
2737                             /*MAX Nval*/  1             ,\
2738                             /*DOC*/       "Number of local alignments reported by the local method (lalign) when building the library"          ,\
2739                             /*Parameter*/ &lalign_n_top      ,\
2740                             /*Def 1*/    "10"      ,\
2741                             /*Def 2*/    "10"      ,\
2742                             /*Min_value*/ "any"         ,\
2743                             /*Max Value*/ "any"          \
2744                    );
2745 get_cl_param(\
2746                             /*argc*/      argc          ,\
2747                             /*argv*/      argv          ,\
2748                             /*output*/    &le           ,\
2749                             /*Name*/      "-iterate"    ,\
2750                             /*Flag*/      &garbage      ,\
2751                             /*TYPE*/      "D"         ,\
2752                             /*OPTIONAL?*/ OPTIONAL      ,\
2753                             /*MAX Nval*/  1             ,\
2754                             /*DOC*/       "NUmber of iteration on the progressive alignment [0: no iteration, -1: Nseq iterations]",\
2755                             /*Parameter*/ &iterate      ,\
2756                             /*Def 1*/    "0"      ,\
2757                             /*Def 2*/    "100"      ,\
2758                             /*Min_value*/ "any"         ,\
2759                             /*Max Value*/ "any"          \
2760                    );
2761
2762 get_cl_param(\
2763                             /*argc*/      argc          ,\
2764                             /*argv*/      argv          ,\
2765                             /*output*/    &le           ,\
2766                             /*Name*/      "-trim"    ,\
2767                             /*Flag*/      &garbage      ,\
2768                             /*TYPE*/      "D"         ,\
2769                             /*OPTIONAL?*/ OPTIONAL      ,\
2770                             /*MAX Nval*/  1             ,\
2771                             /*DOC*/       "trim dataset",\
2772                             /*Parameter*/ &trim      ,\
2773                             /*Def 1*/    "0"      ,\
2774                             /*Def 2*/    "1"      ,\
2775                             /*Min_value*/ "any"         ,\
2776                             /*Max Value*/ "any"          \
2777                    );
2778 get_cl_param(\
2779                             /*argc*/      argc          ,\
2780                             /*argv*/      argv          ,\
2781                             /*output*/    &le           ,\
2782                             /*Name*/      "-split"    ,\
2783                             /*Flag*/      &garbage      ,\
2784                             /*TYPE*/      "D"         ,\
2785                             /*OPTIONAL?*/ OPTIONAL      ,\
2786                             /*MAX Nval*/  1             ,\
2787                             /*DOC*/       "split dataset",\
2788                             /*Parameter*/ &split      ,\
2789                             /*Def 1*/    "0"      ,\
2790                             /*Def 2*/    "1"      ,\
2791                             /*Min_value*/ "any"         ,\
2792                             /*Max Value*/ "any"          \
2793                    );
2794 declare_name(trimfile);
2795 get_cl_param(\
2796                             /*argc*/      argc          ,\
2797                             /*argv*/      argv          ,\
2798                             /*output*/    &le           ,\
2799                             /*Name*/      "-trimfile"    ,\
2800                             /*Flag*/      &garbage      ,\
2801                             /*TYPE*/      "S"         ,\
2802                             /*OPTIONAL?*/ OPTIONAL      ,\
2803                             /*MAX Nval*/  1             ,\
2804                             /*DOC*/       "trim dataset filename",\
2805                             /*Parameter*/ &trimfile      ,\
2806                             /*Def 1*/    "default"      ,\
2807                             /*Def 2*/    ""      ,\
2808                             /*Min_value*/ "any"         ,\
2809                             /*Max Value*/ "any"          \
2810                    );
2811 get_cl_param(\
2812                             /*argc*/      argc          ,\
2813                             /*argv*/      argv          ,\
2814                             /*output*/    &le           ,\
2815                             /*Name*/      "-split"    ,\
2816                             /*Flag*/      &garbage      ,\
2817                             /*TYPE*/      "D"         ,\
2818                             /*OPTIONAL?*/ OPTIONAL      ,\
2819                             /*MAX Nval*/  1             ,\
2820                             /*DOC*/       "split dataset",\
2821                             /*Parameter*/ &split      ,\
2822                             /*Def 1*/    "0"      ,\
2823                             /*Def 2*/    "1"      ,\
2824                             /*Min_value*/ "any"         ,\
2825                             /*Max Value*/ "any"          \
2826                    );
2827
2828 if (trim && !split)split=trim;
2829
2830 get_cl_param(\
2831                             /*argc*/      argc          ,\
2832                             /*argv*/      argv          ,\
2833                             /*output*/    &le           ,\
2834                             /*Name*/      "-split_nseq_thres"    ,\
2835                             /*Flag*/      &garbage      ,\
2836                             /*TYPE*/      "D"         ,\
2837                             /*OPTIONAL?*/ OPTIONAL      ,\
2838                             /*MAX Nval*/  1             ,\
2839                             /*DOC*/       "Maximum Number of sequences within a subgroup",\
2840                             /*Parameter*/ &split_nseq_thres      ,\
2841                             /*Def 1*/    "0"      ,\
2842                             /*Def 2*/    "1"      ,\
2843                             /*Min_value*/ "any"         ,\
2844                             /*Max Value*/ "any"          \
2845                    );
2846 get_cl_param(\
2847                             /*argc*/      argc          ,\
2848                             /*argv*/      argv          ,\
2849                             /*output*/    &le           ,\
2850                             /*Name*/      "-split_score_thres"    ,\
2851                             /*Flag*/      &garbage      ,\
2852                             /*TYPE*/      "D"         ,\
2853                             /*OPTIONAL?*/ OPTIONAL      ,\
2854                             /*MAX Nval*/  1             ,\
2855                             /*DOC*/       "Minimum score within a split dataset",\
2856                             /*Parameter*/ &split_score_thres      ,\
2857                             /*Def 1*/    "0"      ,\
2858                             /*Def 2*/    "1"      ,\
2859                             /*Min_value*/ "any"         ,\
2860                             /*Max Value*/ "any"          \
2861                    );
2862 get_cl_param(\
2863                             /*argc*/      argc          ,\
2864                             /*argv*/      argv          ,\
2865                             /*output*/    &le           ,\
2866                             /*Name*/      "-check_pdb_status"    ,\
2867                             /*Flag*/      &garbage      ,\
2868                             /*TYPE*/      "D"         ,\
2869                             /*OPTIONAL?*/ OPTIONAL      ,\
2870                             /*MAX Nval*/  1             ,\
2871                             /*DOC*/       "Reports the existance of a PDB file",\
2872                             /*Parameter*/ &check_pdb_status      ,\
2873                             /*Def 1*/    "0"      ,\
2874                             /*Def 2*/    "1"      ,\
2875                             /*Min_value*/ "any"         ,\
2876                             /*Max Value*/ "any"          \
2877                    );
2878 get_cl_param(\
2879                             /*argc*/      argc          ,\
2880                             /*argv*/      argv          ,\
2881                             /*output*/    &le           ,\
2882                             /*Name*/      "-clean_seq_name"    ,\
2883                             /*Flag*/      &garbage      ,\
2884                             /*TYPE*/      "D"         ,\
2885                             /*OPTIONAL?*/ OPTIONAL      ,\
2886                             /*MAX Nval*/  1             ,\
2887                             /*DOC*/       "Remove Special Char from sequence names",\
2888                             /*Parameter*/ &clean_seq_name      ,\
2889                             /*Def 1*/    "0"      ,\
2890                             /*Def 2*/    "1"      ,\
2891                             /*Min_value*/ "any"         ,\
2892                             /*Max Value*/ "any"          \
2893                    );
2894
2895
2896 /*PARAMETER PROTOTYPE:    SEQ TO ALIGN     */
2897                seq_to_keep=declare_char ( 2000, STRING);
2898                n_seq_to_keep=get_cl_param(\
2899                             /*argc*/      argc           ,\
2900                             /*argv*/      argv           ,\
2901                             /*output*/    &le            ,\
2902                             /*Name*/      "-seq_to_keep",\
2903                             /*Flag*/      &garbage       ,\
2904                             /*TYPE*/      "S"          ,\
2905                             /*OPTIONAL?*/ OPTIONAL       ,\
2906                             /*MAX Nval*/  200              ,\
2907                             /*DOC*/       "File containing the name of the sequences to keep when triming OR a list of names)",\
2908                             /*Parameter*/ seq_to_keep   ,\
2909                             /*Def 1*/    "NULL"          ,\
2910                             /*Def 2*/    ""              ,\
2911                             /*Min_value*/ "any"          ,\
2912                             /*Max Value*/ "any"           \
2913                    );
2914 /*******************************************************************************************************/            
2915 /*                                                                                                     */             
2916 /*                           TCoffee_dpa Parameter:START                                               */
2917 /*                                                                                                     */           
2918 /*******************************************************************************************************/
2919 /*PARAMETER PROTOTYPE:    dpa_master_aln     */
2920                declare_name (dpa_master_aln);
2921                get_cl_param(\
2922                             /*argc*/      argc           ,\
2923                             /*argv*/      argv           ,\
2924                             /*output*/    &le            ,\
2925                             /*Name*/      "-dpa_master_aln",\
2926                             /*Flag*/      &garbage       ,\
2927                             /*TYPE*/      "S"          ,\
2928                             /*OPTIONAL?*/ OPTIONAL       ,\
2929                             /*MAX Nval*/  1              ,\
2930                             /*DOC*/       "Approximate Alignment: File|method",\
2931                             /*Parameter*/ &dpa_master_aln   ,\
2932                             /*Def 1*/    ""       ,\
2933                             /*Def 2*/    ""              ,\
2934                             /*Min_value*/ "any"          ,\
2935                             /*Max Value*/ "any"           \
2936                    );
2937                /*PARAMETER PROTOTYPE:    dpa_maxnseq    */
2938                
2939                get_cl_param(\
2940                             /*argc*/      argc           ,\
2941                             /*argv*/      argv           ,\
2942                             /*output*/    &le            ,\
2943                             /*Name*/      "-dpa_maxnseq",\
2944                             /*Flag*/      &garbage       ,\
2945                             /*TYPE*/      "D"          ,\
2946                             /*OPTIONAL?*/ OPTIONAL       ,\
2947                             /*MAX Nval*/  1              ,\
2948                             /*DOC*/       "Maximum number of sequences to be aligned with DPA",\
2949                             /*Parameter*/ &dpa_maxnseq   ,\
2950                             /*Def 1*/    "0"       ,\
2951                             /*Def 2*/    "50"              ,\
2952                             /*Min_value*/ "any"          ,\
2953                             /*Max Value*/ "any"           \
2954                    );
2955 /*PARAMETER PROTOTYPE:    dpa_min_score1    */
2956                
2957                get_cl_param(\
2958                             /*argc*/      argc           ,\
2959                             /*argv*/      argv           ,\
2960                             /*output*/    &le            ,\
2961                             /*Name*/      "-dpa_min_score1",\
2962                             /*Flag*/      &garbage       ,\
2963                             /*TYPE*/      "D"          ,\
2964                             /*OPTIONAL?*/ OPTIONAL       ,\
2965                             /*MAX Nval*/  200              ,\
2966                             /*DOC*/       "Minimum percent ID to merge sequences in the approximate alignment",\
2967                             /*Parameter*/ &dpa_min_score1   ,\
2968                             /*Def 1*/    ""       ,\
2969                             /*Def 2*/    ""              ,\
2970                             /*Min_value*/ "0"          ,\
2971                             /*Max Value*/ "100"           \
2972                    );          
2973 /*PARAMETER PROTOTYPE:    dpa_min_score2    */
2974                
2975                get_cl_param(\
2976                             /*argc*/      argc           ,\
2977                             /*argv*/      argv           ,\
2978                             /*output*/    &le            ,\
2979                             /*Name*/      "-dpa_min_score2",\
2980                             /*Flag*/      &garbage       ,\
2981                             /*TYPE*/      "D"          ,\
2982                             /*OPTIONAL?*/ OPTIONAL       ,\
2983                             /*MAX Nval*/  200              ,\
2984                             /*DOC*/       "Threshold for aligning a group in the slow double progressive alignment (automatically readjusted)",\
2985                             /*Parameter*/ &dpa_min_score2   ,\
2986                             /*Def 1*/    ""       ,\
2987                             /*Def 2*/    ""              ,\
2988                             /*Min_value*/ "0"          ,\
2989                             /*Max Value*/ "100"           \
2990                    );          
2991 /*PARAMETER PROTOTYPE:    dpa_keep_tmp_file     */
2992                get_cl_param(\
2993                             /*argc*/      argc             ,\
2994                             /*argv*/      argv             ,\
2995                             /*output*/    &le              ,\
2996                             /*Name*/      "-dpa_keep_tmpfile"        ,\
2997                             /*Flag*/      &dpa_keep_tmpfile        ,\
2998                             /*TYPE*/      "FL"              ,\
2999                             /*OPTIONAL?*/ OPTIONAL         ,\
3000                             /*MAX Nval*/  1                ,\
3001                             /*DOC*/       "Prevents deletion of the tmpfile generated by t_coffee_dpa",\
3002                             /*Parameter*/ &do_version          ,\
3003                             /*Def 1*/     "0"             ,\
3004                             /*Def 2*/     "1"             ,\
3005                             /*Min_value*/ "0"            ,\
3006                             /*Max Value*/ "1"             \
3007
3008                             );
3009 /*PARAMETER PROTOTYPE:    dpa_debug     */
3010                get_cl_param(\
3011                             /*argc*/      argc             ,\
3012                             /*argv*/      argv             ,\
3013                             /*output*/    &le              ,\
3014                             /*Name*/      "-dpa_debug"        ,\
3015                             /*Flag*/      &dpa_debug        ,\
3016                             /*TYPE*/      "D"              ,\
3017                             /*OPTIONAL?*/ OPTIONAL         ,\
3018                             /*MAX Nval*/  1                ,\
3019                             /*DOC*/       "DEbug mode for DPA ( causes dpa tmp files to be kept)",\
3020                             /*Parameter*/ &do_version          ,\
3021                             /*Def 1*/     "0"             ,\
3022                             /*Def 2*/     "1"             ,\
3023                             /*Min_value*/ "0"            ,\
3024                             /*Max Value*/ "1"             \
3025
3026                             );
3027                        
3028 /*PARAMETER PROTOTYPE:    multi_core    */
3029                declare_name (multi_core);
3030                get_cl_param(\
3031                             /*argc*/      argc           ,\
3032                             /*argv*/      argv           ,\
3033                             /*output*/    &le            ,\
3034                             /*Name*/      "-multi_core",\
3035                             /*Flag*/      &garbage       ,\
3036                             /*TYPE*/      "S"          ,\
3037                             /*OPTIONAL?*/ OPTIONAL       ,\
3038                             /*MAX Nval*/  1              ,\
3039                             /*DOC*/       "Multi core: template_jobs_relax_msa",\
3040                             /*Parameter*/ &multi_core   ,\
3041                             /*Def 1*/    "templates_jobs_relax_msa"       ,\
3042                             /*Def 2*/    "templates_jobs_relax_msa"              ,\
3043                             /*Min_value*/ "0"          ,\
3044                             /*Max Value*/ "100"           \
3045                    );     
3046                if (multi_core[0])set_string_variable ("multi_core",multi_core);
3047 /*PARAMETER PROTOTYPE:    multi_core    */
3048                get_cl_param(                                    \
3049                             /*argc*/      argc           ,\
3050                             /*argv*/      argv           ,\
3051                             /*output*/    &le            ,\
3052                             /*Name*/      "-n_core",\
3053                             /*Flag*/      &garbage       ,\
3054                             /*TYPE*/      "D"          ,\
3055                             /*OPTIONAL?*/ OPTIONAL       ,\
3056                             /*MAX Nval*/  1              ,\
3057                             /*DOC*/       "Number of cores to be used by machine [default=0 => all those defined in the environement]",\
3058                             /*Parameter*/ &n_core   ,\
3059                             /*Def 1*/    "0"       ,\
3060                             /*Def 2*/    "0"              ,\
3061                             /*Min_value*/ "0"          ,\
3062                             /*Max Value*/ "100"           \
3063                    );     
3064                if (n_core)set_int_variable ("n_core",n_core);
3065                
3066                
3067 /*PARAMETER PROTOTYPE:    lib_list    */
3068                declare_name (lib_list);
3069                get_cl_param(\
3070                             /*argc*/      argc           ,\
3071                             /*argv*/      argv           ,\
3072                             /*output*/    &le            ,\
3073                             /*Name*/      "-lib_list",\
3074                             /*Flag*/      &garbage       ,\
3075                             /*TYPE*/      "S"          ,\
3076                             /*OPTIONAL?*/ OPTIONAL       ,\
3077                             /*MAX Nval*/  1              ,\
3078                             /*DOC*/       "A File that contains every pair/group of sequence to process when computing the lib, Format:<nseq> <index1><index2>",\
3079                             /*Parameter*/ &lib_list   ,\
3080                             /*Def 1*/    ""       ,\
3081                             /*Def 2*/    "default"              ,\
3082                             /*Min_value*/ "0"          ,\
3083                             /*Max Value*/ "100"           \
3084                    );        
3085                
3086                /*PARAMETER PROTOTYPE:    lib_list    */
3087                declare_name (prune_lib_mode);
3088                get_cl_param(\
3089                             /*argc*/      argc           ,\
3090                             /*argv*/      argv           ,\
3091                             /*output*/    &le            ,\
3092                             /*Name*/      "-prune_lib_mode",\
3093                             /*Flag*/      &garbage       ,\
3094                             /*TYPE*/      "S"          ,\
3095                             /*OPTIONAL?*/ OPTIONAL       ,\
3096                             /*MAX Nval*/  1              ,\
3097                             /*DOC*/       "A File that contains every pair/group of sequence to process when computing the lib, Format:<nseq> <index1><index2>",\
3098                             /*Parameter*/ &prune_lib_mode   ,\
3099                             /*Def 1*/    "5"       ,\
3100                             /*Def 2*/    "5"              ,\
3101                             /*Min_value*/ "0"          ,\
3102                             /*Max Value*/ "100"           \
3103                    );          
3104                set_string_variable ("prune_lib_mode",prune_lib_mode);
3105                
3106                /*PARAMETER PROTOTYPE:    multi_thread    */
3107                declare_name (tip);
3108                get_cl_param(\
3109                             /*argc*/      argc           ,\
3110                             /*argv*/      argv           ,\
3111                             /*output*/    &le            ,\
3112                             /*Name*/      "-tip",\
3113                             /*Flag*/      &garbage       ,\
3114                             /*TYPE*/      "S"          ,\
3115                             /*OPTIONAL?*/ OPTIONAL       ,\
3116                             /*MAX Nval*/  1              ,\
3117                             /*DOC*/       "Controls The Output of A TIP When Computation is over [one,all,none]",\
3118                             /*Parameter*/ &tip   ,\
3119                             /*Def 1*/    "one"       ,\
3120                             /*Def 2*/    "all"              ,\
3121                             /*Min_value*/ "any"          ,\
3122                             /*Max Value*/ "any"           \
3123                    );   
3124                /*PARAMETER PROTOTYPE:    RNA LIB    */
3125                declare_name (rna_lib);
3126                get_cl_param(\
3127                             /*argc*/      argc           ,\
3128                             /*argv*/      argv           ,\
3129                             /*output*/    &le            ,\
3130                             /*Name*/      "-rna_lib",\
3131                             /*Flag*/      &garbage       ,\
3132                             /*TYPE*/      "S"          ,\
3133                             /*OPTIONAL?*/ OPTIONAL       ,\
3134                             /*MAX Nval*/  1              ,\
3135                             /*DOC*/       "",\
3136                             /*Parameter*/ &rna_lib   ,\
3137                             /*Def 1*/    ""       ,\
3138                             /*Def 2*/    ""              ,\
3139                             /*Min_value*/ "any"          ,\
3140                             /*Max Value*/ "any"           \
3141                    );              
3142                get_cl_param(                                    \
3143                             /*argc*/      argc           ,\
3144                             /*argv*/      argv           ,\
3145                             /*output*/    &le            ,\
3146                             /*Name*/      "-no_warning",\
3147                             /*Flag*/      &garbage       ,\
3148                             /*TYPE*/      "D"          ,\
3149                             /*OPTIONAL?*/ OPTIONAL       ,\
3150                             /*MAX Nval*/  1              ,\
3151                             /*DOC*/       "Suppresses all Warnings",\
3152                             /*Parameter*/ &no_warning   ,\
3153                             /*Def 1*/    "0"       ,\
3154                             /*Def 2*/    "1"              ,\
3155                             /*Min_value*/ "0"          ,\
3156                             /*Max Value*/ "1"           \
3157                    );              
3158                get_cl_param(                                    \
3159                             /*argc*/      argc           ,\
3160                             /*argv*/      argv           ,      \
3161                             /*output*/    &le            ,\
3162                             /*Name*/      "-run_local_script",\
3163                             /*Flag*/      &garbage       ,      \
3164                             /*TYPE*/      "D"          ,        \
3165                             /*OPTIONAL?*/ OPTIONAL       ,      \
3166                             /*MAX Nval*/  1              ,              \
3167                             /*DOC*/       "Run Local Script if in current directory",   \
3168                             /*Parameter*/ &run_local_script   ,         \
3169                             /*Def 1*/    "0"       ,                    \
3170                             /*Def 2*/    "1"              ,             \
3171                             /*Min_value*/ "0"          ,                \
3172                             /*Max Value*/ "1"                           \
3173                    );              
3174                set_int_variable ("run_local_script", run_local_script);
3175                declare_name (plugins);
3176                get_cl_param(                                    \
3177                             /*argc*/      argc           ,\
3178                             /*argv*/      argv           ,      \
3179                             /*output*/    &le            ,\
3180                             /*Name*/      "-plugins",\
3181                             /*Flag*/      &garbage       ,      \
3182                             /*TYPE*/      "S"          ,        \
3183                             /*OPTIONAL?*/ OPTIONAL       ,      \
3184                             /*MAX Nval*/  1              ,              \
3185                             /*DOC*/       "Set the directory containing the plugins",   \
3186                             /*Parameter*/ &plugins   ,          \
3187                             /*Def 1*/    "default"       ,                      \
3188                             /*Def 2*/    ""              ,              \
3189                             /*Min_value*/ "any"          ,              \
3190                             /*Max Value*/ "any"                         \
3191                    );              
3192                if ( !strm (plugins, "default"))
3193                  {
3194                    set_path_4_plugins (plugins);
3195                  }
3196                
3197
3198                declare_name (proxy);
3199                get_cl_param(\
3200                             /*argc*/      argc           ,\
3201                             /*argv*/      argv           ,\
3202                             /*output*/    &le            ,\
3203                             /*Name*/      "-proxy",\
3204                             /*Flag*/      &garbage       ,\
3205                             /*TYPE*/      "S"          ,\
3206                             /*OPTIONAL?*/ OPTIONAL       ,\
3207                             /*MAX Nval*/  1              ,\
3208                             /*DOC*/       "proxy used to access to webservices, when required",\
3209                             /*Parameter*/ &proxy   ,\
3210                             /*Def 1*/    "unset"       ,\
3211                             /*Def 2*/    " "              ,\
3212                             /*Min_value*/ "any"          ,\
3213                             /*Max Value*/ "any"           \
3214                    );   
3215                if ( !strm (proxy, "unset"))set_string_variable ("cl_proxy",proxy);
3216                declare_name (email);
3217                get_cl_param(\
3218                             /*argc*/      argc           ,\
3219                             /*argv*/      argv           ,\
3220                             /*output*/    &le            ,\
3221                             /*Name*/      "-email",\
3222                             /*Flag*/      &garbage       ,\
3223                             /*TYPE*/      "S"          ,\
3224                             /*OPTIONAL?*/ OPTIONAL       ,\
3225                             /*MAX Nval*/  1              ,\
3226                             /*DOC*/       "email provided to webservices, when required",\
3227                             /*Parameter*/ &email   ,\
3228                             /*Def 1*/    ""       ,\
3229                             /*Def 2*/    ""              ,\
3230                             /*Min_value*/ "any"          ,\
3231                             /*Max Value*/ "any"           \
3232                    );   
3233                if ( strstr (email, "@"))
3234                  {
3235                    set_string_variable ("email", email);
3236                    set_string_variable ("cl_email", email);
3237                  }
3238                
3239                get_cl_param(                                    \
3240                             /*argc*/      argc           ,\
3241                             /*argv*/      argv           ,\
3242                             /*output*/    &le            ,\
3243                             /*Name*/      "-clean_overaln",\
3244                             /*Flag*/      &garbage       ,\
3245                             /*TYPE*/      "D"          ,\
3246                             /*OPTIONAL?*/ OPTIONAL       ,\
3247                             /*MAX Nval*/  1              ,\
3248                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3249                             /*Parameter*/ &clean_overaln   ,\
3250                             /*Def 1*/    "0"          ,\
3251                             /*Def 2*/    "1"              ,\
3252                             /*Min_value*/ "any"          ,\
3253                             /*Max Value*/ "any"           \
3254                                           );
3255                overaln_param=declare_char ( 10, STRING);
3256                n_overaln_param=get_cl_param(                    \
3257                             /*argc*/      argc           ,\
3258                             /*argv*/      argv           ,\
3259                             /*output*/    &le            ,\
3260                             /*Name*/      "-overaln_param",\
3261                             /*Flag*/      &garbage       ,\
3262                             /*TYPE*/      "S"          ,\
3263                             /*OPTIONAL?*/ OPTIONAL       ,\
3264                             /*MAX Nval*/  10              ,\
3265                             /*DOC*/       "Parameters for the overaln",\
3266                             /*Parameter*/ overaln_param   ,\
3267                             /*Def 1*/    "NULL"          ,\
3268                             /*Def 2*/    ""              ,\
3269                             /*Min_value*/ "any"          ,\
3270                             /*Max Value*/ "any"           \
3271                    );
3272                declare_name (overaln_mode);
3273                get_cl_param(\
3274                             /*argc*/      argc           ,\
3275                             /*argv*/      argv           ,\
3276                             /*output*/    &le            ,\
3277                             /*Name*/      "-overaln_mode",\
3278                             /*Flag*/      &garbage       ,\
3279                             /*TYPE*/      "S"          ,\
3280                             /*OPTIONAL?*/ OPTIONAL       ,\
3281                             /*MAX Nval*/  1              ,\
3282                             /*DOC*/       "lower || uanlaign",\
3283                             /*Parameter*/ &overaln_mode   ,\
3284                             /*Def 1*/    ""       ,\
3285                             /*Def 2*/    ""              ,\
3286                             /*Min_value*/ "any"          ,\
3287                             /*Max Value*/ "any"           \
3288                    );   
3289                if (overaln_mode[0])set_string_variable ("overaln_mode", overaln_mode);
3290                declare_name (overaln_model);
3291                get_cl_param(\
3292                             /*argc*/      argc           ,\
3293                             /*argv*/      argv           ,\
3294                             /*output*/    &le            ,\
3295                             /*Name*/      "-overaln_model",\
3296                             /*Flag*/      &garbage       ,\
3297                             /*TYPE*/      "S"          ,\
3298                             /*OPTIONAL?*/ OPTIONAL       ,\
3299                             /*MAX Nval*/  1              ,\
3300                             /*DOC*/       "fsa1 (no exon boundaries), fsa2 (exon boundaries)",\
3301                             /*Parameter*/ &overaln_model   ,\
3302                             /*Def 1*/    ""       ,\
3303                             /*Def 2*/    ""              ,\
3304                             /*Min_value*/ "any"          ,\
3305                             /*Max Value*/ "any"           \
3306                    );   
3307                if (overaln_mode[0])set_string_variable ("overaln_model", overaln_model);
3308                
3309                get_cl_param(                                    \
3310                             /*argc*/      argc           ,\
3311                             /*argv*/      argv           ,\
3312                             /*output*/    &le            ,\
3313                             /*Name*/      "-overaln_threshold",\
3314                             /*Flag*/      &garbage       ,\
3315                             /*TYPE*/      "D"          ,\
3316                             /*OPTIONAL?*/ OPTIONAL       ,\
3317                             /*MAX Nval*/  1              ,\
3318                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3319                             /*Parameter*/ &overaln_threshold   ,\
3320                             /*Def 1*/    "0"          ,\
3321                             /*Def 2*/    ""              ,\
3322                             /*Min_value*/ "any"          ,\
3323                             /*Max Value*/ "any"           \
3324                             );
3325                set_int_variable ("overaln_threshold", overaln_threshold);
3326
3327                get_cl_param(                                    \
3328                             /*argc*/      argc           ,\
3329                             /*argv*/      argv           ,\
3330                             /*output*/    &le            ,\
3331                             /*Name*/      "-overaln_target",\
3332                             /*Flag*/      &garbage       ,\
3333                             /*TYPE*/      "D"          ,\
3334                             /*OPTIONAL?*/ OPTIONAL       ,\
3335                             /*MAX Nval*/  1              ,\
3336                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3337                             /*Parameter*/ &overaln_target   ,\
3338                             /*Def 1*/    "0"          ,\
3339                             /*Def 2*/    ""              ,\
3340                             /*Min_value*/ "any"          ,\
3341                             /*Max Value*/ "any"           \
3342                    );
3343                set_int_variable ("overaln_target", overaln_threshold);
3344
3345                get_cl_param(                                    \
3346                             /*argc*/      argc           ,\
3347                             /*argv*/      argv           ,\
3348                             /*output*/    &le            ,\
3349                             /*Name*/      "-overaln_P1",\
3350                             /*Flag*/      &garbage       ,\
3351                             /*TYPE*/      "D"          ,\
3352                             /*OPTIONAL?*/ OPTIONAL       ,\
3353                             /*MAX Nval*/  1              ,\
3354                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3355                             /*Parameter*/ &overaln_P1   ,\
3356                             /*Def 1*/    "0"          ,\
3357                             /*Def 2*/    ""              ,\
3358                             /*Min_value*/ "any"          ,\
3359                             /*Max Value*/ "any"           \
3360                    );
3361                if (overaln_P1)set_int_variable ("overaln_P1", overaln_P1);
3362
3363                get_cl_param(                                    \
3364                             /*argc*/      argc           ,\
3365                             /*argv*/      argv           ,\
3366                             /*output*/    &le            ,\
3367                             /*Name*/      "-overaln_P2",\
3368                             /*Flag*/      &garbage       ,\
3369                             /*TYPE*/      "D"          ,\
3370                             /*OPTIONAL?*/ OPTIONAL       ,\
3371                             /*MAX Nval*/  1              ,\
3372                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3373                             /*Parameter*/ &overaln_P2   ,\
3374                             /*Def 1*/    "0"          ,\
3375                             /*Def 2*/    ""              ,\
3376                             /*Min_value*/ "any"          ,\
3377                             /*Max Value*/ "any"           \
3378                    );
3379                 if (overaln_P2)set_int_variable ("overaln_P2", overaln_P2);
3380                
3381                 get_cl_param(                                   \
3382                             /*argc*/      argc           ,\
3383                             /*argv*/      argv           ,\
3384                             /*output*/    &le            ,\
3385                             /*Name*/      "-overaln_P3",\
3386                             /*Flag*/      &garbage       ,\
3387                             /*TYPE*/      "D"          ,\
3388                             /*OPTIONAL?*/ OPTIONAL       ,\
3389                             /*MAX Nval*/  1              ,\
3390                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3391                             /*Parameter*/ &overaln_P3   ,\
3392                             /*Def 1*/    "0"          ,\
3393                             /*Def 2*/    ""              ,\
3394                             /*Min_value*/ "any"          ,\
3395                             /*Max Value*/ "any"           \
3396                    );
3397                if (overaln_P3)set_int_variable ("overaln_P3", overaln_P3);
3398
3399                get_cl_param(                                    \
3400                             /*argc*/      argc           ,\
3401                             /*argv*/      argv           ,\
3402                             /*output*/    &le            ,\
3403                             /*Name*/      "-overaln_P4",\
3404                             /*Flag*/      &garbage       ,\
3405                             /*TYPE*/      "D"          ,\
3406                             /*OPTIONAL?*/ OPTIONAL       ,\
3407                             /*MAX Nval*/  1              ,\
3408                             /*DOC*/       "Ratio between overaligned exon id Vs legitimates *100",\
3409                             /*Parameter*/ &overaln_P4   ,\
3410                             /*Def 1*/    "0"          ,\
3411                             /*Def 2*/    ""              ,\
3412                             /*Min_value*/ "any"          ,\
3413                             /*Max Value*/ "any"           \
3414                    );
3415                if (overaln_P4)set_int_variable ("overaln_P4", overaln_P4);
3416                
3417                
3418                declare_name (exon_boundaries);
3419                get_cl_param(\
3420                             /*argc*/      argc           ,\
3421                             /*argv*/      argv           ,\
3422                             /*output*/    &le            ,\
3423                             /*Name*/      "-exon_boundaries",\
3424                             /*Flag*/      &garbage       ,\
3425                             /*TYPE*/      "S"          ,\
3426                             /*OPTIONAL?*/ OPTIONAL       ,\
3427                             /*MAX Nval*/  1              ,\
3428                             /*DOC*/       "exon_boundaries [EBI boj format]",\
3429                             /*Parameter*/ &exon_boundaries   ,\
3430                             /*Def 1*/    ""       ,\
3431                             /*Def 2*/    ""              ,\
3432                             /*Min_value*/ "any"          ,\
3433                             /*Max Value*/ "any"           \
3434                    );   
3435                if ( exon_boundaries[0])set_string_variable ("exon_boundaries", exon_boundaries);
3436                
3437                
3438                
3439                
3440 /*******************************************************************************************************/            
3441 /*                                                                                                     */             
3442 /*                           Standard Initialization:END                                               */
3443 /*                                                                                                     */           
3444 /*******************************************************************************************************/
3445                standard_initialisation_end   ( argv, &argc);
3446 /*******************************************************************************************************/            
3447 /*                                                                                                     */             
3448 /*                           TCoffee_dpa Parameter:END                                                 */
3449 /*                                                                                                     */           
3450 /*******************************************************************************************************/
3451                
3452                
3453                
3454                if (argc==1 || name_is_in_list("-help", argv, argc, STRING)!=-1 )
3455                  {
3456                    display_method_names ("display", stdout);
3457                    return EXIT_SUCCESS;
3458                  }
3459                get_cl_param( argc, argv,&le, NULL,NULL,NULL,0,0,NULL);       
3460                prepare_cache (cache);     
3461 /*******************************************************************************************************/            
3462 /*                                                                                                     */             
3463 /*                           FILL list_file (contains seq, aln and meth)                               */
3464 /*                                                                                                     */           
3465 /*******************************************************************************************************/            
3466
3467             
3468                
3469 /*Re-introduce the sequences introduced with -infile*/
3470 /*Standard*/ 
3471                
3472                if ( infile[0] && !do_evaluate)
3473                    {
3474                    sprintf ( list_file[n_list++], "%s",infile);            
3475                    }
3476 /*DO EVALUATE: The aln to evaluate must be provided via -infile*/              
3477                else  if (do_evaluate)
3478                    {
3479                      if (!infile[0] ||  !(main_read_aln ( infile, NULL)))
3480                        {
3481                          fprintf ( stderr,"\nERROR: When using -evaluate, Provide a multiple sequence alignment via the -infile flag [FATAL:%s]\n", PROGRAM);
3482                          myexit (EXIT_FAILURE);
3483                        }
3484                      else if (! main_read_aln ( infile,NULL))
3485                        {
3486                          fprintf ( stderr,"\nERROR: FILE %s is NOT a valid alignment [FATAL:%s]\n", infile, PROGRAM);
3487                          myexit (EXIT_FAILURE);
3488                        }
3489                      else if ( infile[0]=='A' ||infile[0]=='S')
3490                        {
3491                          sprintf ( list_file[n_list++], "S%s",infile+1);
3492                        }
3493                      else sprintf ( list_file[n_list++], "S%s",infile);
3494                    }
3495
3496
3497  
3498 /*Make Sure -infile is set*/
3499                if (!infile[0]&& (do_evaluate || do_convert))
3500                  {
3501                    
3502                    if ( do_evaluate || do_convert)sprintf ( infile, "%s",seq_list[0]); 
3503                  }
3504
3505 /*EXPAND -in*/   
3506                /*Introduce the sequences from the -profile flag*/     
3507                if ( profile1 && profile1[0])
3508                  {
3509                    sprintf ( list_file[n_list++], "R%s",profile1);
3510                  }
3511                if ( profile2 && profile2[0])
3512                  {
3513                    sprintf ( list_file[n_list++], "R%s",profile2);
3514                  }
3515                
3516                for ( a=0; a< n_profile_list; a++)
3517                  {
3518                    FILE *fp;
3519                    if ( (fp=find_token_in_file (profile_list[a], NULL, "FILE_LIST"))!=NULL)
3520                      {
3521                        int z;
3522                        char rname[1000];
3523                        vfclose (fp);
3524                        fp=vfopen (profile_list[a], "r");
3525                        
3526                        while ( (z=fgetc(fp))!=EOF)
3527                          { 
3528                            ungetc(z, fp);
3529                            fscanf (fp, "%s\n", rname);
3530                            if ( check_file_exists(rname))sprintf ( list_file[n_list++], "R%s", rname);
3531                          }
3532                        vfclose (fp);
3533                      }
3534                    else if (format_is_conc_aln (profile_list[a]))
3535                      {
3536                        Alignment *P;
3537                        char *cname;
3538                        
3539                        P=input_conc_aln (profile_list[a],NULL);
3540                        while (P)
3541                          {
3542                            cname=vtmpnam (NULL);
3543                            output_fasta_aln (cname, P);
3544                            P=P->A;
3545                            sprintf ( list_file[n_list++], "R%s",cname);
3546                          }
3547                        free_aln (P);
3548                      }
3549                  
3550                    else 
3551                      {
3552                        sprintf ( list_file[n_list++], "R%s",profile_list[a]);
3553                      }
3554                  }
3555                /*Introduce the sequences from the -seq flag*/
3556                for (a=0; a<n_seq_list; a++)
3557                  {
3558                    if (check_file_exists(seq_list[a]))
3559                      sprintf (list_file[n_list++], "S%s",seq_list[a]);
3560                    else if ( check_file_exists (seq_list[a]+1))
3561                      sprintf (list_file[n_list++], "%s",seq_list[a]);
3562                  }
3563                /*introduce the alignments from the -aln flag*/
3564                //Importnat: Must be introduced AFTER the profiles
3565                for (a=0; a<n_aln_file_list; a++)
3566                  {
3567                    sprintf (list_file[n_list++], "A%s",aln_file_list[a]);
3568                  }
3569                /*introduce the alignments from the -method flag*/
3570                for (a=0; a<n_method_list; a++)
3571                  {
3572                    sprintf (list_file[n_list++], "M%s",method_list[a]);
3573                  }
3574                /*introduce the alignments from the -library flag*/
3575                for (a=0; a<n_lib_file_list; a++)
3576                  {
3577                    sprintf (list_file[n_list++], "L%s",lib_file_list[a]);
3578                  }
3579                /*introduce sequences from the exon_boundaries flag flag*/
3580                if ( exon_boundaries && exon_boundaries[0] && check_file_exists (exon_boundaries))
3581                  {
3582                    Sequence *ExS;
3583                    Alignment *ExA;
3584                    char *tmpf;
3585                    //make sure boundaries do not get into the sequences*/
3586                    ExS=main_read_seq (exon_boundaries);
3587                    ExS=seq2clean_seq (ExS, "BOJboj");
3588                    main_output_fasta_seq (tmpf=vtmpnam (NULL),ExA=seq2aln (ExS,NULL,RM_GAP), NO_HEADER);
3589                    sprintf (list_file[n_list++], "S%s",tmpf);
3590                    free_sequence (ExS, ExS->nseq);
3591                    free_aln (ExA);
3592                  }
3593                /*FETCH THE STRUCTURES INTRODUCED WITH -pdb and add them to -in*/
3594                if ( n_pdb)
3595                  {
3596                    for ( a=0; a< n_pdb; a++)
3597                      {
3598                        if ( is_number (pdb_list[a]));
3599                        else
3600                          {
3601                          pdb_start=pdb_end=0;
3602                          if ( a+1< n_pdb && is_number (pdb_list[a+1]))pdb_start=atoi (pdb_list[a+1]);
3603                          if ( a+2< n_pdb && is_number (pdb_list[a+2]))pdb_end=atoi (pdb_list[a+2]);
3604                          
3605                          pdb_name=get_pdb_struc ( pdb_list[a],pdb_start, pdb_end);
3606                          if (pdb_name){sprintf (list_file[n_list++], "P%s", pdb_name);}
3607                          /*Warning: do not free pdb_name: it is statically allocated by get_pdb_struc*/
3608                          }                   
3609                      }
3610                  }
3611                
3612                /*Check That Enough Methods/Libraries/Alignments Have been Chiped in*/
3613               
3614                if (list_file)
3615                  {
3616                    int *nn;
3617                    nn=vcalloc ( 256, sizeof (int));
3618                    for (a=0; a<n_list; a++)
3619                      {
3620                        if ( !check_file_exists(list_file[a]))nn[(int)list_file[a][0]]++;
3621                        else
3622                          {
3623                            if (is_seq (list_file[a]))nn['S']++;
3624                            else if ( is_aln (list_file[a]))nn['A']++;
3625                            else if ( is_lib (list_file[a]))nn['L']++;
3626                            else if ( is_method (list_file[a]))nn['M']++;
3627                            else 
3628                              add_warning ( CL->local_stderr, "\nWARNING: File %s was not properly tag. Potential ambiguity\n",list_file[a]);
3629                          }
3630                      }
3631                    
3632         
3633                    if ( (nn['A']+nn['L']+nn['M'])==0)
3634                      {
3635                        sprintf ( list_file[n_list++], "Mproba_pair"); //new default
3636                        //sprintf ( list_file[n_list++], "Mlalign_id_pair");
3637                        //sprintf ( list_file[n_list++], "Mslow_pair");
3638                      }
3639                    vfree (nn);
3640                  }
3641                
3642 /*FILL THE F STRUCTURE (Contains Information for Output names For the defaults)*/                      
3643                if (n_list==0 || argc<=1)
3644                  {
3645                    fprintf ( stderr, "\nERROR: You have NOT provided enough arguments [FATAL:%s]", PROGRAM);
3646                    myexit (EXIT_FAILURE);
3647                  }
3648                   
3649               
3650                else if ( argv[1][0]!='-' && (check_file_exists( argv[1]) || check_file_exists(argv[1]+1)))
3651                  {
3652                    if (check_file_exists(argv[1]))F=parse_fname(argv[1]);
3653                    else if ( check_file_exists(argv[1]+1))F=parse_fname(argv[1]+1);
3654                    
3655                  }
3656                else if (infile[0])
3657                  {
3658                    
3659                    if ( check_file_exists (infile))F=parse_fname(infile);
3660                    else if (check_file_exists (infile+1))F =parse_fname(infile+1);
3661                  }
3662                else 
3663                   {
3664
3665                   for ( a=0; a< n_list; a++)
3666                       {
3667                         if (!is_method(list_file[a])) 
3668                           {
3669                               
3670                             
3671                              if ( check_file_exists( list_file[a])){F=parse_fname(list_file[a]);break;}                  
3672                              else if ( is_in_set ( list_file[a][0], "ASLX") && check_file_exists( list_file[a]+1)){F=parse_fname(list_file[a]+1);break;}
3673                              else if ( is_in_set ( list_file[a][0], "R") && check_file_exists( list_file[a]+1))
3674                                {
3675                                  char lname[100];
3676                                  F=parse_fname(list_file[a]+1);
3677                                  sprintf ( lname, "%s_1", F->name);
3678                                  sprintf ( F->name, "%s", lname);
3679                                  break;
3680                                }
3681                              
3682                              else if ( is_in_set ( list_file[a][0], "P") && is_pdb_struc (list_file[a]+1))
3683                                {
3684                                  F=parse_fname(is_pdb_struc (list_file[a]+1));break;
3685                                  
3686                                }
3687                           }  
3688                       }
3689                 
3690                   }
3691            
3692
3693                /*Get Structures*/
3694                for ( a=0; a< n_list; a++)
3695                  {
3696                    if ( list_file[a][0]=='P' && !check_file_exists(list_file[a]))
3697                      {
3698                        char buf[1000];
3699                        sprintf(buf, "%s", list_file[a]+1);
3700                        sprintf(list_file[a], "P%s",is_pdb_struc (buf));
3701                      }
3702                  }
3703
3704                /*FATAL: NO SEQUENCES*/
3705                if (!F)
3706                  {
3707                    fprintf ( stderr, "\nERROR: You have not provided any sequence [FATAL:%s]\n",PROGRAM);
3708                    myexit (EXIT_FAILURE);
3709                  }
3710                if (run_name)F=parse_fname(run_name);
3711                else F->path[0]='\0';
3712                
3713              
3714                identify_list_format      (list_file, n_list);
3715               
3716              
3717                fprintf (le, "\nINPUT FILES\n");
3718                for ( a=0; a< n_list; a++)
3719                    {
3720                      fprintf (le, "\tInput File (%c) %s ",list_file[a][0],list_file[a]+1); 
3721                      if ( list_file[a][0]=='A' || list_file[a][0]=='S' || list_file[a][0]=='P'|| list_file[a][0]=='R' ) 
3722                        {
3723                          fprintf (le, " Format %s\n", f=identify_seq_format ( list_file[a]+1));
3724         
3725                          if (!f || f[0]=='\0')
3726                            {
3727                              fprintf ( stderr, "\nERROR: The format of %s is not supported[FATAL:%s]", list_file[a]+1,PROGRAM);
3728                              myexit (EXIT_FAILURE);
3729                            }
3730                          vfree (f);
3731                        }
3732                      else fprintf (le, "\n");
3733                    }
3734
3735                             
3736 /*CONVERT, ALIGN OR EVALUATE: CHOSE THE RIGHT VERB*/
3737                /*Set the Hierarchy of the verbs*/
3738                /*The first one decides...*/
3739               
3740                
3741                do_list=vcalloc ( 100, sizeof (int*));
3742                n_do=0;
3743                do_list[n_do++]=&do_extended_matrix;
3744                do_list[n_do++]=&do_convert;
3745                do_list[n_do++]=&do_evaluate;
3746                do_list[n_do++]=&do_domain;
3747                do_list[n_do++]=&do_align;
3748                
3749
3750                for ( a=0; a< n_do; a++)
3751                  {
3752                  if ( do_list[a][0])
3753                    {
3754                    for ( b=0; b< n_do; b++)if ( b!=a)do_list[b][0]=0;
3755                    break;
3756                    }
3757                  }
3758
3759
3760             
3761 /*SET THE DEFAULT NAMES*/
3762                if ( do_convert)
3763                    {
3764                      if ( strm (tree_file, "default"))sprintf ( tree_file, "no");
3765                    }
3766                
3767              
3768
3769                if (  do_evaluate)
3770                    {
3771                    sprintf ( out_lib, "no");
3772                    sprintf ( tree_file, "no");
3773                    clean_aln=0;
3774                    }
3775  
3776      
3777                if ( F && strm ( tree_file, "default"))sprintf ( tree_file ,"%s%s.dnd",F->path     ,F->name);
3778                if ( F && strm ( ph_tree_file, "default"))sprintf ( ph_tree_file ,"%s%s.ph",F->path     ,F->name);
3779                
3780                for (a=0; a< n_out_aln_format; a++)
3781                  {
3782                    if (is_out_format_list (out_aln_format[a]));
3783                    else
3784                      {
3785                        fprintf (stderr, "\n%s is not a valid format [FATAL:%s]\n", out_aln_format[a], PROGRAM);
3786                        myexit (EXIT_FAILURE);
3787                      }
3788                  }
3789                
3790                for (a=0; a<n_out_aln_format; a++)
3791                  {
3792                    out_aln_format[a]=format_name2aln_format_name(out_aln_format[a]);
3793                  }
3794                
3795                if ( F && strm ( out_aln  , "default"))
3796                   {
3797                   for (a=0; a< n_out_aln_format; a++)
3798                     {
3799                       
3800                       sprintf ( tot_out_aln[a]   ,"%s%s.%s"      ,F->path,F->name,out_aln_format[a]);
3801                     }
3802                   }
3803                else
3804                   {
3805                     sprintf ( tot_out_aln[0], "%s", out_aln);
3806                     for (a=1; a< n_out_aln_format; a++)
3807                       sprintf ( tot_out_aln[a]   ,"%s%s.%s", F->path  ,out_aln, out_aln_format[a]);
3808                   }
3809                
3810                
3811
3812                if ( F && strm ( out_lib  , "default"))sprintf ( out_lib   ,"%s%s.tc_lib",F->path     , F->name);
3813                
3814                if ( type && type[0])
3815                   {
3816                       if (strm2 (type,"Protein", "protein"))sprintf ( type, "PROTEIN");
3817                       if (strm2 (type,"DNA", "dna"))sprintf ( type, "DNA");
3818                       if (strm2 (type,"RNA", "rna"))sprintf ( type, "RNA");
3819                       
3820                   }
3821                
3822
3823                if (   !use_tree && check_file_exists (tree_file))vremove (tree_file);
3824                else if ( !use_tree || (use_tree && strm (use_tree, "default")));
3825                else sprintf ( tree_file, "%s", use_tree);
3826                
3827 /*******************************************************************************************************/            
3828 /*                                                                                                     */             
3829 /*                           Input Sequences and Library                                               */
3830 /*                                                                                                     */             
3831 /*******************************************************************************************************/
3832                
3833                set_methods_limits (method_limits,n_method_limits,list_file, n_list, &maxnseq, &maxlen);
3834                /*Set Global Values*/
3835               
3836                
3837                
3838 /*START*/
3839                /*1 READ THE SEQUENCES*/
3840                S=read_seq_in_n_list   (list_file, n_list, type,seq_source);
3841                if ( check_type)
3842                  {
3843                    if (!strm (S->type, get_array_type (S->nseq, S->seq)))
3844                      {
3845                        fprintf ( stderr, "\nINCORRECT SEQUENCE TYPE (USE %s ONLY) [FATAL:%s]", S->type, PROGRAM);
3846                        myexit (EXIT_FAILURE);
3847                      }
3848                  }
3849
3850                if (S->nseq<=1 && !do_domain)
3851                  {
3852                    printf_exit (EXIT_FAILURE,stderr, "\nERROR: Your Dataset Contains %d Sequence. For multiple alignments you need at least 2 sequences[FATAL:%s]", S->nseq,PROGRAM);
3853                  }
3854
3855                store_seq_type (S->type);
3856                
3857                if ( type_only==1)
3858                  {
3859                    fprintf ( stdout, "%s", S->type);
3860                    return EXIT_SUCCESS;
3861                  }
3862                /*Translate Sequences*/
3863                if ( transform && transform[0])
3864                  {
3865                    S=transform_sequence (S, transform);
3866                  }
3867
3868                /*Abort if the sequences are too long */
3869                if (maxlen!=-1 && S->max_len>maxlen)
3870                   {
3871                       fprintf ( stderr, "\nSEQUENCES TOO LONG [Longuest=%d][MAX=%d][FATAL:%s]\n", S->max_len,maxlen, PROGRAM);
3872                       myexit (EXIT_FAILURE);
3873  
3874                   }
3875                
3876                if (dpa)
3877                   {
3878                     list_file=list_file2dpa_list_file (list_file,&n_list,maxnseq,S);
3879                     S=read_seq_in_n_list   (list_file, n_list, type,seq_source);
3880                   }
3881                else if ( maxnseq!=-1 && S->nseq>maxnseq)
3882                  {
3883                       fprintf ( stderr, "\nTOO MANY SEQUENCES [N=%d][MAX=%d][FATAL:%s]\n", S->nseq,maxnseq, PROGRAM);
3884                       myexit (EXIT_FAILURE);
3885  
3886                   }
3887                
3888               
3889                S=seq2template_seq(S, "SELF_S_",F);
3890                /* Get the Templates*/
3891                if ( n_template_file)
3892                  {
3893                    fprintf ( le, "\nLooking For Sequence Templates:\n");
3894                    for ( a=0; a< n_template_file; a++)
3895                      {
3896                        //correct for missing extension modes
3897                        if (strm (template_file_list[a],"RNA") && !strstr (extend_mode, "rna"))sprintf ( extend_mode, "rna2");
3898                        
3899                    
3900                        fprintf ( le, "\n\tTemplate Type: [%s] Mode Or File: [%s] [Start", template_type2type_name(template_file_list[a]), template_file_list[a]);
3901                        S=seq2template_seq(S, template_file_list[a], F);
3902                        fprintf ( le, "]");
3903                        
3904                        if (S==NULL)
3905                          {
3906                            add_warning (stderr, "\nImpossible to find %s Templates\nCheck that your blast server is properly installed [See documentation][FATAL:%s]\n", template_file_list[a],PROGRAM);
3907                            exit (EXIT_FAILURE);
3908                          }
3909                      }
3910                    if (seq2n_X_template ( S, "_*_"))sprintf (S->template_file, "%s",seq2template_file (S, NULL));
3911                  }
3912                else
3913                  {
3914                    int ptf=0;
3915                    for ( a=0; a<S->nseq; a++)
3916                      {
3917                        if ( seq_has_template ( S, a, "_P_"))ptf=1;
3918                      }
3919                    if (ptf)
3920                      {
3921                        int j;
3922                        sprintf ( S->template_file   ,"%s%s.template_file",F->path     , F->name);
3923                        seq2template_file (S,S->template_file);
3924                        display_output_filename ( stdout, "Template_List","fasta_seq", S->template_file, STORE); 
3925                      }
3926                  }
3927                
3928         
3929                if (n_profile_template_file)
3930                  {
3931                    fprintf ( le, "\nLooking For Profile  Templates");
3932                    for ( a=0; a< n_profile_template_file; a++)
3933                      {
3934                        fprintf ( le, "\n\tTemplate Type: [%s] Mode Or File: [%s] [Start", template_type2type_name(profile_template_file_list[a]), profile_template_file_list[a]);
3935                        S=profile_seq2template_seq(S, profile_template_file_list[a], F);
3936                        fprintf ( le, "]");
3937                        if (S==NULL)
3938                          {
3939                            add_warning(stderr, "Impossible to find %s Templates\nCheck that your blast server is properly installed [See documentation][FATAL:%s]\n",profile_template_file_list[a], PROGRAM);
3940                            exit (EXIT_FAILURE);
3941                          }
3942                      }
3943                  }
3944
3945                S=seq2template_type (S);
3946                le=display_sequences_names   ( S, le, check_pdb_status, TEMPLATES);
3947                
3948                
3949                
3950                                     
3951               
3952
3953                if ( get_type)
3954                  {
3955                    S=get_sequence_type (S);
3956                    fprintf ( stdout , "%s\n", S->type);
3957                    free_sequence(S, S->nseq);
3958                    return 1;
3959                  }
3960
3961              
3962                /*Reorder the sequences*/
3963                new_order=duplicate_char (S->name, -1, -1);             
3964                if ( strm (inorder, "aligned"))new_order=sort_string_array   (new_order, S->nseq);
3965
3966                initial_order=duplicate_char (S->name, -1, -1);  
3967                S=reorder_seq(S,new_order,S->nseq);
3968                free_char (new_order, -1);
3969
3970                          
3971
3972                /*3 PREPARE THE CONSTRAINT LIST*/
3973                
3974                CL=declare_constraint_list ( S,NULL, NULL, 0,(strm(mem_mode, "disk"))?tmpfile():NULL, NULL); 
3975                sprintf ( CL->method_evaluate_mode, "%s", method_evaluate_mode);
3976                (CL->TC)->use_seqan=use_seqan;
3977                CL->local_stderr=le;
3978                
3979                /*Estimate the distance Matrix*/
3980                CL->DM=cl2distance_matrix ( CL,NOALN,distance_matrix_mode, distance_matrix_sim_mode,1);
3981                
3982                /*one to all alignment*/
3983                if (one2all && one2all[0])prepare_one2all (one2all,S, lib_list);
3984                else if ( subset2all)
3985                  {
3986                    prepare_subset2all (subset2all,S, lib_list,CL);
3987                  }
3988                
3989                if (  matrix && matrix[0])
3990                  {
3991                    sprintf ( CL->method_matrix,"%s", matrix);
3992                    
3993                  }
3994                /*Set the filtering*/
3995                CL->filter_lib=filter_lib;
3996                /*Set the evaluation Functions*/
3997                CL->profile_mode=get_profile_mode_function (profile_mode, NULL);
3998                sprintf ( CL->profile_comparison, "%s", profile_comparison);
3999                if ( n_struc_to_use)
4000                  {
4001                    CL->STRUC_LIST=declare_sequence (1,1,n_struc_to_use);
4002                    CL->STRUC_LIST->nseq=0;
4003                    for ( a=0; a< n_struc_to_use; a++)
4004                      {
4005                        
4006                        sprintf ( (CL->STRUC_LIST)->name[(CL->STRUC_LIST)->nseq++],"%s",struc_to_use[a]);
4007                      }
4008                  }
4009                sprintf (CL->align_pdb_param_file, "%s", align_pdb_param_file);
4010                sprintf (CL->align_pdb_hasch_mode, "%s", align_pdb_hasch_mode);
4011                
4012               
4013                
4014                /*Blast Parameters*/
4015                (CL->Prot_Blast)->min_id=prot_min_sim;
4016                (CL->Prot_Blast)->max_id=prot_max_sim;
4017                (CL->Prot_Blast)->min_cov=prot_min_cov;         
4018                sprintf ( (CL->Prot_Blast)->blast_server, "%s", prot_blast_server);
4019                sprintf ( (CL->Prot_Blast)->db, "%s", prot_db);
4020                
4021                (CL->Pdb_Blast)->min_id=pdb_min_sim;
4022                
4023                (CL->Pdb_Blast)->max_id=pdb_max_sim;
4024                (CL->Pdb_Blast)->min_cov=pdb_min_cov;           
4025                sprintf ( (CL->Pdb_Blast)->blast_server, "%s", pdb_blast_server);
4026                sprintf ( (CL->Pdb_Blast)->db, "%s", pdb_db);
4027                CL->check_pdb_status=check_pdb_status;
4028                /*split parameters */
4029                CL->split=split;
4030                CL->split_nseq_thres=split_nseq_thres;
4031                CL->split_score_thres=split_score_thres;
4032                /*Blast Parameters
4033                (CL->DNA_Blast)->min_id=dna_min_sim;
4034                (CL->DNA_Blast)->max_id=dna_max_sim;
4035                (CL->DNA_Blast)->min_cov=dna_min_cov;           
4036                sprintf ( (CL->DNA_Blast)->blast_server, "%s", dna_blast_server);
4037                sprintf ( (CL->DNA_Blast)->db, "%s", dna_db);
4038                */
4039              
4040                if ( method_log)
4041                  {
4042                    if ( strm (method_log, "default"))
4043                      {
4044                        sprintf ( CL->method_log, "%s%s.method_log",F->path, F->name);
4045                      }
4046                    else if ( !strm (method_log, "no"))
4047                      {
4048                       sprintf ( CL->method_log, "%s", method_log);
4049                      }
4050                    set_string_variable ("method_log", method_log);
4051                  }
4052                
4053                
4054                CL->lalign_n_top=lalign_n_top;
4055                sprintf ( CL->multi_thread, "%s", multi_core);
4056                sprintf ( CL->lib_list, "%s", lib_list);
4057                sprintf (CL->rna_lib, "%s", rna_lib);
4058 /* Important: This is where the library is compiled!!!!*/
4059                
4060                if ((CL->S)->nseq>1 && !do_convert)
4061                  {
4062                    CL=read_n_constraint_list (list_file,n_list,NULL, mem_mode,weight,type, le, CL, seq_source);              
4063                    
4064                  }
4065                else if ( do_convert && out_lib[0])
4066                  {
4067                    if ( infile[0])
4068                      {sprintf (list_file[0], "%s", name2type_name(infile));
4069                      CL=read_n_constraint_list (list_file,1,NULL, mem_mode,weight,type, le, CL, seq_source);   
4070                      }
4071                    else
4072                      {
4073                      CL=read_n_constraint_list (list_file,n_list,NULL, mem_mode,weight,type, le, CL, seq_source);            
4074                      }
4075                  }
4076                if ( CL->M)clean_aln=0;
4077
4078                if ( is_number (weight))
4079                  {
4080                    int weight_value;
4081                    weight_value=atoi(weight);
4082                    for (a=0; a<CL->ne; a++)
4083                      {
4084                        vwrite_clist(CL, a, WE, weight_value);
4085                      }
4086                  }
4087               
4088                free_pair_wise ();//Free ststic memory allocated in some of the pairwise functions
4089                
4090
4091                //Shrink: re-run slow_pair using the library, remove everything
4092                
4093               
4094                /*If the List is empty*/
4095                if ( (CL->S)->nseq>1 && CL->ne==0 && !CL->M &&!(do_convert && n_list>0))
4096                  {
4097                    fprintf ( stderr, "\n******************ERROR*****************************************\n");
4098                    
4099                    fprintf ( stderr, "\nYou have not provided any method or enough Sequences[FATAL]");
4100                    fprintf ( stderr, "\nIf you have used the '-in' Flag, ADD the methods you wish to use:");
4101                    fprintf ( stderr, "\n\t-in <your sequences> Mlalign_id_pair Mfast_pair\n");
4102                    fprintf ( stderr, "\nAnd make sure you provide at least TWO sequences\n");   
4103                    for ( a=0; a< argc; a++)fprintf ( stderr, "%s ", argv[a]);
4104                    fprintf ( stderr, "\n*****************************************************************\n");
4105                    myexit(EXIT_FAILURE);
4106                  }
4107               
4108                    
4109                CL->normalise=do_normalise;
4110  
4111                if ( type && type[0])sprintf ( (CL->S)->type, "%s", type); 
4112                CL->extend_jit=(do_extend>0)?1:0;
4113                
4114                CL->extend_threshold=(do_extend==1)?0:do_extend;
4115                CL->do_self=do_self;
4116                sprintf (CL->extend_clean_mode,   "%s", clean_mode);
4117                sprintf (CL->extend_compact_mode, "%s", compact_mode);
4118                if ( CL->extend_jit && CL->extend_threshold !=0)filter_list (CL,0, CL->ne, CL->extend_threshold);               
4119                CL->pw_parameters_set=1;
4120
4121
4122
4123                CL->nomatch=nomatch;
4124                set_int_variable ("nomatch", nomatch);
4125                /*Gep and Gop*/
4126                if ( !gep &&  !gop && CL->M)
4127                    {
4128                     CL->gop=get_avg_matrix_mm ( CL->M, (strm3((CL->S)->type,"PROTEIN", "Protein", "protein")?AA_ALPHABET:"gcuta"))*10;
4129                     CL->gep=CL->gop/10;
4130                     fprintf ( CL->local_stderr, "\nAUTOMATIC PENALTIES: gapopen=%d gapext=%d", CL->gop, CL->gep);
4131                    }
4132                else if ( !CL->M && cosmetic_penalty && !gep && !gop)
4133                    {
4134                     CL->gep=0;
4135                     CL->gop=cosmetic_penalty;
4136                    }
4137                else
4138                    {
4139                      CL->gep=gep;
4140                      CL->gop=gop;
4141                      fprintf ( CL->local_stderr, "\nMANUAL PENALTIES: gapopen=%d gapext=%d", CL->gop, CL->gep);
4142                    }
4143                
4144                /*Frame Penalties*/
4145                CL->f_gep=f_gep;
4146                CL->f_gop=f_gop;
4147
4148                
4149                CL->maximise=maximise;
4150                
4151                if (strm(retrieve_seq_type(),"DNA")|| strm(retrieve_seq_type(),"RNA") )
4152                    CL->ktup=MAX(2,ktup);
4153                else
4154                    CL->ktup=ktup;
4155                
4156                CL->use_fragments=diag_mode;
4157                CL->fasta_step=fasta_step;
4158                CL->diagonal_threshold=diag_threshold;
4159                
4160                sprintf ( CL->matrix_for_aa_group, "%s", sim_matrix);
4161                sprintf ( CL->dp_mode, "%s", dp_mode);
4162                CL->TG_MODE=tg_mode;
4163                      
4164                sprintf ( CL->evaluate_mode, "%s", evaluate_mode);
4165                fprintf (le, "\n\n\tLibrary Total Size: [%d]\n", CL->ne); 
4166                
4167                
4168                CL=choose_extension_mode (extend_mode, CL);
4169                CL->max_n_pair=max_n_pair;
4170               
4171               processed_lib=0;
4172               if (CL->ne>0 && out_lib[0]!='\0' && !strm (out_lib, "no"))
4173                  {
4174                    
4175                    if (strstr (out_lib_mode, "extended"))
4176                      {
4177                        char emode[1000];
4178                        
4179                        //Do the processing before saving the extended lib*/
4180                        processed_lib=1;
4181                        if ( filter_lib) CL=filter_constraint_list (CL,CL->weight_field, filter_lib);
4182                        for (a=0; a<relax_lib; a++)CL=relax_constraint_list (CL);
4183                        for (a=0; a<shrink_lib; a++)CL=shrink_constraint_list (CL);
4184                        sprintf ( emode, "lib_%s", out_lib_mode);
4185                        
4186                        OUT=vfopen (out_lib, "w");
4187                        OUT=save_extended_constraint_list(CL,emode,OUT);
4188                      }
4189                    else
4190                      {
4191                        OUT=save_constraint_list ( CL, 0, CL->ne, out_lib, NULL, "ascii",CL->S);
4192                      }
4193                    vfclose (OUT);
4194                    CL->local_stderr=display_output_filename (le, "TCLIB","tc_lib_format_01",out_lib, CHECK);
4195                  }
4196               
4197               /*
4198                 check for the connectivity of the constraint list
4199               if ( !constraint_list_is_connected (CL))
4200                 {
4201                   add_warning ( stderr, "ERROR: unconnected sequences in the constraint_list [FATAL:%s]\n", PROGRAM);
4202                   myexit (EXIT_FAILURE);
4203                 }
4204               */
4205               if ( lib_only)return EXIT_SUCCESS;
4206               
4207            
4208               if (!processed_lib)
4209                 {
4210                    if ( filter_lib) CL=filter_constraint_list (CL,CL->weight_field, filter_lib);
4211                    for (a=0; a<relax_lib; a++)CL=relax_constraint_list (CL);
4212                    for (a=0; a<shrink_lib; a++)CL=shrink_constraint_list (CL);
4213                 }
4214               
4215               sprintf ( CL->distance_matrix_mode, "%s", distance_matrix_mode);
4216               sprintf ( CL->distance_matrix_sim_mode, "%s", distance_matrix_sim_mode);
4217               
4218               sprintf ( CL->tree_mode, "%s", tree_mode);
4219               //Re-estim�ate the distance matrix with consistency//
4220                if ( strm ("cscore", distance_matrix_mode))
4221                  { 
4222                    CL->DM=cl2distance_matrix ( CL,NOALN,distance_matrix_mode, distance_matrix_sim_mode,1);
4223                  }
4224               /*WEIGHT CONSTRAINT LIST*/
4225
4226               if ( !do_convert)
4227                 {
4228                  
4229                   CL->DM=cl2distance_matrix (CL, NOALN, NULL, NULL,0);
4230         
4231                   CL=weight_constraint_list(CL, seq_weight);
4232                   
4233                   if (output_seq_weights (CL->W, outseqweight))
4234                     CL->local_stderr=display_output_filename( CL->local_stderr,"WEIGHT","tc_weight",outseqweight, CHECK);
4235                   le=display_weights(CL->W, le);
4236                 }
4237               
4238               
4239              
4240               /*Prepare quadruplets*/
4241               if ( nseq_for_quadruplet && !strm(seq_name_for_quadruplet[0], "all"))
4242                 {
4243                   CL->nseq_for_quadruplet=nseq_for_quadruplet;
4244                   CL->seq_for_quadruplet=vcalloc ((CL->S)->nseq, sizeof (int));
4245                   for (a=0; a< CL->nseq_for_quadruplet; a++)
4246                     {
4247                       printf ( "\nquad: %s", seq_name_for_quadruplet[a]);
4248                       if ( (b=name_is_in_list (seq_name_for_quadruplet[a],(CL->S)->name,(CL->S)->nseq, 100))!=-1)CL->seq_for_quadruplet[b]=1;
4249                       else add_warning ( stderr, "\nWARNING: Sequence %s is not in the set and cannot be used for quadruplet extension\n",seq_name_for_quadruplet[a]); 
4250                     }
4251                 }
4252               else if ( nseq_for_quadruplet && strm(seq_name_for_quadruplet[0], "all"))
4253                 {
4254                   
4255                   CL->nseq_for_quadruplet=(CL->S)->nseq;
4256                   CL->seq_for_quadruplet=vcalloc ((CL->S)->nseq, sizeof (int));
4257                   for (a=0; a< CL->nseq_for_quadruplet; a++)
4258                     {
4259                       CL->seq_for_quadruplet[a]=1;
4260                     }
4261                 }
4262          
4263 /*******************************************************************************************************/            
4264 /*                                                                                                     */             
4265 /*                           Prepare The Alignment                                                     */
4266 /*                                                                                                     */             
4267 /*******************************************************************************************************/
4268              
4269               if ( do_align )
4270                    {
4271                    A=seq2aln  ((CL->S),NULL,1);
4272                    ungap_array(A->seq_al,A->nseq);                 
4273                    
4274                    /*Chose the right Mode for evaluating Columns*/
4275                    
4276                    if ( A->nseq==1);
4277                    else if ( strm ( msa_mode, "seq_aln"))
4278                      {
4279                        A=seq_aln (A,(CL->S)->nseq, CL);
4280                      }
4281                    else if ( strm ( msa_mode, "sorted_aln"))
4282                      {
4283                        A=sorted_aln (A, CL);
4284                      }
4285                    else if ( strm ( msa_mode, "full_sorted_aln"))
4286                      {
4287                        full_sorted_aln (A, CL);
4288                        output_constraints (out_lib, "sim", A);
4289                        CL->local_stderr=display_output_filename (le, "TCLIB","tc_lib_format_01",out_lib, CHECK);
4290                        return EXIT_SUCCESS;
4291                      }
4292                    
4293                    else if ( strm ( msa_mode, "profile_aln"))
4294                      {
4295                        A=iterative_tree_aln (A, 0, CL);
4296                        A=profile_aln (A, CL);
4297                      }
4298                    else if ( strm ( msa_mode, "iterative_aln"))
4299                      {
4300                        A=iterative_tree_aln (A, 0, CL);
4301                        A=iterative_aln (A,10, CL);
4302                      }
4303                     else if ( strm ( msa_mode, "iterative_tree_aln"))
4304                      {
4305                        A=iterative_tree_aln (A,1, CL);
4306                      }
4307                     else if ( strm ( msa_mode, "dpa_aln"))
4308                       {
4309                         A=dpa_aln (A, CL);
4310                       }
4311                     else if ( strm ( msa_mode, "new_dpa_aln"))
4312                       {
4313                         A=new_dpa_aln (A, CL);
4314                       }
4315                     else if ( strm ( msa_mode, "delayed_tree_aln"))
4316                      {
4317                        A=make_delayed_tree_aln (A,2, CL);
4318                      }
4319                    else if ( strm ( msa_mode, "groups"))
4320                      {
4321                        A=seq2aln_group (A,dpa_maxnseq, CL);
4322                        out_aln_format[0]="conc_aln";
4323                        n_out_aln_format=1;
4324                      }
4325                    else if ( strm ( msa_mode, "upgma"))
4326                      {
4327                        A=upgma_tree_aln (A, A->nseq, CL);
4328                      }
4329                    else if ( strm ( msa_mode, "graph"))
4330                         {
4331                           fprintf ( stderr, "\nDO GRAPH ALIGNMENT");
4332                           A=graph_aln ( A, CL, (CL->S));
4333                         } 
4334                    else if ( strm ( msa_mode, "tsp"))
4335                         {
4336                           fprintf ( stderr, "\nDO TSP ALIGNMENT");
4337                           A=tsp_aln ( A, CL, (CL->S));
4338                         }
4339                    else if ( strm ( msa_mode, "precomputed"))
4340                      {
4341                        if (infile[0]) {free_aln (A);A=main_read_aln ( infile, declare_aln(CL->S));}
4342                        else{fprintf ( stderr, "\nERROR: distance_matrix_mode=aln requires an aln passed via the -infile flag [FATAL:%s]", PROGRAM);crash ("");}
4343                        
4344                        sprintf ( CL->dp_mode, "precomputed_pair_wise");
4345                        sprintf ( CL->distance_matrix_mode, "aln");
4346                        CL->tree_aln=A=reorder_aln ( A, (CL->S)->name,(CL->S)->nseq);
4347                        
4348                        pc=tree_file;
4349                        if ( strm (tree_file, "default") || !check_file_exists (tree_file))
4350                          T=make_tree ( A,CL,gop, gep,(CL->S),pc, maximise);           
4351                        else if ( strm (tree_file, "no"))
4352                          T=make_tree ( A,CL,gop, gep,(CL->S),NULL, maximise);
4353                        else
4354                          {
4355                            T=read_tree (pc,&tot_node,(CL->S)->nseq,  (CL->S)->name);
4356                          }
4357                        
4358                        SNL=tree_aln ((T[3][0])->left,(T[3][0])->right,A,(CL->S)->nseq, CL);
4359                      }
4360                    else if ( strm ( msa_mode, "tree"))
4361                      {
4362                        if ( strm (CL->distance_matrix_mode, "aln"))
4363                          {
4364                            if (infile[0]) {free_aln (A);A=main_read_aln ( infile, declare_aln(CL->S));}
4365                            else{fprintf ( stderr, "\nERROR: distance_matrix_mode=aln requires an aln passed via the -infile flag [FATAL:%s]", PROGRAM);crash ("");}
4366                            CL->tree_aln=A;
4367                          }
4368                        pc=tree_file;
4369                        if ( strm (tree_file, "default") || !check_file_exists (tree_file))
4370                          T=make_tree ( A,CL,gop, gep,(CL->S),pc,maximise);            
4371                        else if ( strm (tree_file, "no"))
4372                          T=make_tree ( A,CL,gop, gep,(CL->S),NULL, maximise);
4373                        else
4374                          {
4375                            fprintf ( le, "\nREAD PRECOMPUTED TREE: %s\n", pc);
4376                            T=read_tree (pc,&tot_node,(CL->S)->nseq,  (CL->S)->name);
4377                          }
4378                        SNL=tree_aln ((T[3][0])->left,(T[3][0])->right,A,(CL->S)->nseq, CL);
4379                        A->nseq=(CL->S)->nseq;
4380                      }
4381                    
4382                    else
4383                      {
4384                        fprintf ( stderr, "\nERROR: msa_mode %s is unknown [%s:FATAL]\n", msa_mode, PROGRAM);
4385                        crash ("");
4386                      }
4387                      
4388                    }
4389                else if ( (do_evaluate || do_convert))
4390                    {
4391
4392                 
4393                    A=(infile[0])?main_read_aln ( infile, declare_aln(CL->S)):NULL;
4394                    
4395                    if (!A)A=seq2aln((CL->S), NULL,0);
4396                    
4397                    
4398                    A->S=CL->S;            
4399                    A->nseq=(CL->S)->nseq;
4400                   
4401                    
4402                    }
4403               
4404               
4405               else if (do_domain)
4406                    {
4407                      CL->moca=vcalloc ( 1, sizeof ( Moca));
4408                      if (strm ( "cfasta_pair_wise", dp_mode))sprintf (CL->dp_mode, "%s","domain_pair_wise"); 
4409                      (CL->moca)->moca_start=domain_start;
4410                      (CL->moca)->moca_len  =domain_len;
4411                      (CL->moca)->moca_scale=(domain_scale==0)?-(CL->normalise/20):domain_scale;
4412                      (CL->moca)->moca_interactive=domain_interactive;
4413                      
4414
4415
4416                      if (!cosmetic_penalty && !gep && !gop)
4417                        {
4418                          CL->gop=-200;
4419                          CL->gep=-100;
4420                        }
4421
4422                      CL=prepare_cl_for_moca (CL);
4423                      aln_list=moca_aln (CL);
4424                      free_int ( CL->packed_seq_lu, -1);
4425                      CL->packed_seq_lu=NULL;
4426
4427                      a=0;
4428                      while ( aln_list[a])
4429                        {                         
4430                        for ( b=0; b< n_out_aln_format; b++)
4431                           {                         
4432
4433                             output_format_aln (out_aln_format[b],aln_list[a],EA=fast_coffee_evaluate_output(aln_list[a], CL), tot_out_aln[b]);
4434                             le=display_output_filename( le,"MSA",out_aln_format[b], tot_out_aln[b], CHECK);
4435                           }
4436                        a++;
4437                        }
4438                    return EXIT_SUCCESS;
4439                    }
4440               else if ( do_extended_matrix)
4441                 {
4442                   A=seq2aln(CL->S, NULL, 1);
4443                   A->CL=CL;
4444                   for ( a=0; a< n_out_aln_format; a++)
4445                     {
4446                       output_format_aln (out_aln_format[a],A,EA, tot_out_aln[a]);
4447                       le=display_output_filename( le,"MSA",out_aln_format[a], tot_out_aln[a], CHECK);
4448                     }
4449
4450                   return EXIT_SUCCESS;
4451                 }
4452
4453
4454 /*******************************************************************************************************/            
4455 /*                                                                                                     */             
4456 /*                           PREPARE THE ALIGNMENT FOR OUTPUT                                          */
4457 /*                                                                                                     */             
4458 /*******************************************************************************************************/
4459               
4460               if (A)
4461                   {
4462                     /*
4463                     for ( a=0; a< A->nseq; a++)
4464                       {
4465                            for ( b=0; b< A->len_aln ; b++)
4466                              if ( A->seq_al[a][b]=='O' || A->seq_al[a][b]=='o')A->seq_al[a][b]='-';
4467                          }
4468                     */
4469
4470                     
4471                   
4472                     
4473                     if ( check_file_exists(outorder))
4474                         {
4475                           Sequence *OS;
4476                           OS=get_fasta_sequence (outorder, NULL);
4477                           if ( prf_in_seq (CL->S))A->expanded_order=OS->name;
4478                           else A=reorder_aln ( A,OS->name,A->nseq);
4479                         }
4480                       else if ( strm(outorder, "aligned") && T)
4481                         {
4482                           A=reorder_aln ( A,A->tree_order,A->nseq);
4483                          
4484                         }
4485                       else 
4486                         { 
4487                           
4488                           A=reorder_aln ( A, (CL->S)->name,(CL->S)->nseq);  
4489                           A=reorder_aln ( A, initial_order,(CL->S)->nseq);  
4490                          
4491                         }
4492                      
4493                       A->output_res_num=strm3 ( output_res_num, "on", "On", "ON");
4494                       
4495                       if ( strm2 (residue_case, "keep", "retain"))A->residue_case=KEEP_CASE;
4496                       else if (strm3 (residue_case, "upper", "Upper", "UPPER"))A->residue_case=UPPER_CASE;
4497                       else if (strm3 (residue_case, "lower", "Lower", "LOWER"))A->residue_case=LOWER_CASE;
4498                       else A->residue_case=1;
4499
4500                       
4501                      
4502                       
4503
4504                       
4505                       if ( iterate)
4506                         {
4507                           A=iterate_aln (A, iterate, CL);
4508                           A=ungap_aln(A);
4509                         }
4510                       
4511                       if ( clean_aln)
4512                         {
4513                           EA=main_coffee_evaluate_output(A, CL,clean_evaluate_mode);    
4514                           A=clean_maln(A, EA,clean_threshold,clean_iteration);
4515                           free_aln (EA);
4516                           A=ungap_aln(A);
4517                         }
4518                       
4519                       //overaln
4520                       if (clean_overaln)
4521                         {
4522                           char *over_aln_tmp;
4523                           over_aln_tmp=vtmpnam(NULL);
4524                           output_format_aln ("overaln", A, NULL, over_aln_tmp);
4525                           A=main_read_aln (over_aln_tmp,A);
4526                         }
4527                       
4528                       EA=main_coffee_evaluate_output(A, CL, evaluate_mode);
4529                       
4530                       //correct ascii file
4531                       if (clean_overaln)
4532                         {
4533                           EA=overlay_alignment_evaluation (A,EA);
4534                         }
4535                       
4536                       
4537                       if (A->A)A=A->A;
4538                       if (!strm2(out_aln, "stdout", "stderr") && le==stderr && !do_convert)output_format_aln ("aln",A,NULL,"stdout");
4539                       
4540                       
4541                       A->CL=CL;
4542                       for ( a=0; a< n_out_aln_format; a++)
4543                         if ( !strstr ( out_aln_format[a], "expand"))output_format_aln (out_aln_format[a],A,EA, tot_out_aln[a]);
4544                       for ( a=0; a< n_out_aln_format; a++)
4545                         if ( strstr (out_aln_format[a], "expand"))output_format_aln (out_aln_format[a],A,EA, tot_out_aln[a]);
4546                       
4547
4548                       
4549                       fprintf (le, "\n\nOUTPUT RESULTS");
4550                       le=display_output_filename (le, "GUIDE_TREE","newick", tree_file, CHECK);
4551                       
4552                       for ( a=0; a< n_out_aln_format; a++)
4553                         le=display_output_filename( le,"MSA",out_aln_format[a], tot_out_aln[a], CHECK);
4554                       
4555                       if (!strm (ph_tree_file, "NO") && A->nseq>2)
4556                         {
4557                           NT_node T;
4558                           FILE *tfp;
4559                           char **tmode;
4560                           tmode=declare_char (2, 100);
4561                           sprintf (tmode[0], "nj");
4562                           T=tree_compute (A, 1, tmode);
4563                           tfp=vfopen (ph_tree_file, "w");
4564                           tfp=print_tree (T, "newick", tfp);
4565                           vfclose (tfp);
4566                           le=display_output_filename (le, "PHYLOGENIC_TREE","newick", ph_tree_file, CHECK);
4567                         }
4568                           
4569                   }
4570
4571               if (split)
4572                 { 
4573
4574                   if (trim && n_seq_to_keep) 
4575                     {
4576                       if (n_seq_to_keep==1 && check_file_exists (seq_to_keep[0]))
4577                         {
4578                           
4579                           SEQ_TO_KEEP=read_sequences (seq_to_keep[0]);
4580                         }
4581                       else
4582                         {
4583                           
4584                           SEQ_TO_KEEP=declare_sequence ( 1, 1,n_seq_to_keep);
4585                           for ( a=0; a< n_seq_to_keep; a++)sprintf ( SEQ_TO_KEEP->name[a], "%s", seq_to_keep[a]);
4586                         }
4587                     }
4588                   
4589                   sprintf ( CL->dp_mode, "precomputed_pair_wise");
4590                   sprintf ( CL->distance_matrix_mode, "aln");
4591                   
4592
4593                  
4594                   CL->tree_aln=A=reorder_aln ( A, (CL->S)->name,(CL->S)->nseq);
4595                   CL->S=aln2seq ( A);
4596                   
4597                   if (!T)
4598                     {
4599
4600                       pc=tree_file;
4601                       if ( strm (tree_file, "default") || !check_file_exists (tree_file))
4602                         T=make_tree ( A,CL,gop, gep,(CL->S),pc, maximise);            
4603                       else if ( strm (tree_file, "no"))
4604                         T=make_tree ( A,CL,gop, gep,(CL->S),NULL, maximise);
4605                       else
4606                         {
4607                           T=read_tree (pc,&tot_node,(CL->S)->nseq,  (CL->S)->name);
4608                         }
4609                     }
4610                   
4611                   SNL=tree_aln ((T[3][0])->left,(T[3][0])->right,A,(CL->S)->nseq, CL);
4612                   
4613                  
4614                   for ( a=0, b=0; a<A->nseq; a++)b+=(SNL[a])?1:0;
4615                   fprintf ( le, "\n\nSPLIT DATASET: %d Groups\n", b);
4616                   /*Display Group Names*/
4617                   
4618                   if ( trim && SEQ_TO_KEEP)
4619                     {
4620                       for ( a=0; a< SEQ_TO_KEEP->nseq; a++)
4621                         {
4622                           
4623                           trim_subS=extract_one_seq(SEQ_TO_KEEP->name[a],0,0,A,KEEP_NAME);
4624                           trim_S=add_sequence (trim_subS,trim_S,0);
4625                         }
4626                     }
4627                   for ( a=0, b=0; a<A->nseq; a++)
4628                     {
4629                       
4630                       if ( SNL[a])
4631                         {
4632                           b++;
4633                           fprintf ( le, "\n\tSPLIT_GROUP %d ; Nseq %d ; Score %d ; List ",b, (SNL[a])->nseq, (int)(SNL[a])->score);
4634                           for ( c=0; c< (SNL[a])->nseq; c++)
4635                             {
4636                               fprintf ( le, "%s ",(CL->S)->name[(SNL[a])->lseq[c]]);
4637                             }
4638
4639                           SPLIT_ALN=extract_sub_aln (A, (SNL[a])->nseq,(SNL[a])->lseq);
4640                           SPLIT_ALN->S=A->S;
4641                           ungap_aln (SPLIT_ALN);
4642                           
4643                           if (!trim)
4644                             {
4645                               sprintf ( split_format, "%s", "clustalw");
4646                               sprintf ( split_name, "%s.split.%d.%s", F->name, b,split_format);
4647                               fprintf ( le, " ; File %s",  split_name);
4648                               output_format_aln (split_format,SPLIT_ALN,NULL,split_name);
4649                               le=display_output_filename( le,"SPLIT_SEQ",split_format,split_name, CHECK); 
4650                             }
4651                           else if (trim)
4652                             {
4653                               t=aln2most_similar_sequence(SPLIT_ALN, "idmat");
4654                               trim_subS=extract_one_seq(SPLIT_ALN->name[t],0,0,SPLIT_ALN,KEEP_NAME);
4655                               trim_S=add_sequence (trim_subS,trim_S,0);
4656                               fprintf ( le, "\n\tTRIM_SEQ: Kept sequence %s",SPLIT_ALN->name[t]); 
4657                             }
4658                           free_aln (SPLIT_ALN);
4659                           fprintf (le, "\n");
4660                         }
4661                     }
4662
4663                   if (trim)
4664                       {
4665                         
4666                         
4667                        SPLIT_ALN=seq2aln (trim_S,NULL, KEEP_GAP);
4668                        ungap_aln (SPLIT_ALN);
4669                        sprintf ( trim_format, "%s", "fasta_aln");
4670                        if ( strm (trimfile, "default"))sprintf ( trimfile, "%s.trim.%s", F->name,trim_format);
4671                        
4672                        output_format_aln (trim_format,SPLIT_ALN,NULL,trimfile);
4673                        le=display_output_filename( le,"TRIM_SEQ",trim_format,trimfile, CHECK); 
4674                       } 
4675                 }                     
4676               
4677               if (remove_template_file){S=vremove_seq_template_files(S);}
4678               else 
4679                 {
4680                   S=display_seq_template_files (S); 
4681                 }
4682
4683               //fLUSH OUT THE NAME OF ALL THE FILES THAT HAVE BEEN PRODUCED
4684               le=display_output_filename (le, NULL, NULL, NULL, FLUSH);
4685               
4686                       
4687               fprintf (le, "\n\n"); 
4688               
4689               free_char (list_file, -1);        
4690               free_Alignment (A);               
4691               free_Alignment (EA);              
4692              
4693
4694               S=free_constraint_list (CL);
4695               free_sequence (S, S->nseq);
4696              
4697               
4698               
4699               vremove ( "core");
4700               
4701               vfree_all();
4702               
4703               le=t_coffee_tip (le, tip);
4704               le=print_command_line ( le);
4705               le=print_mem_usage (le, PROGRAM);
4706               le=print_cpu_usage(le, PROGRAM);
4707               le=print_program_information (le, NULL);
4708               
4709                       
4710               if (full_log && full_log[0])log_function(full_log);
4711            
4712               return EXIT_SUCCESS;
4713         }
4714
4715 /*Specialized set of Parameters*/
4716 char *get_defaults (char *buf, char *type)
4717 {
4718   return NULL;
4719 }
4720 char *get_precomputed_defaults(char *buf, char *type)
4721    {
4722      
4723      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4724      
4725      buf=strcat (buf," -msa_mode=precomputed ");
4726      buf=strcat (buf," -seq_weight=no ");
4727      buf=strcat (buf," -evaluate_mode no ");
4728      buf=strcat (buf," -in Xpam250mt ");
4729      return buf;
4730    }
4731 char *get_evaluate_defaults(char *buf, char *type)
4732    {
4733      
4734      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4735
4736      buf=strcat (buf," -quiet=stdout ");
4737      /*buf=strcat (buf," -seq_weight=no ");*/
4738      buf=strcat (buf," -output score_ascii html ");
4739      buf=strcat (buf," -iterate 0 ");
4740      
4741      buf=strcat (buf," -evaluate ");
4742      
4743     
4744      
4745      return buf;
4746    }
4747 char *get_genome_defaults(char *buf, char *type)
4748    {
4749      
4750      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4751     
4752      buf=strcat (buf," -seq_weight=no ");
4753      buf=strcat (buf," -dp_mode sim_pair_wise_lalign ");
4754      buf=strcat (buf," -output glalign ");
4755      buf=strcat (buf," -iterate 0 ");
4756      buf=strcat (buf," -distance_matrix_mode ktup ");
4757      buf=strcat (buf," -evaluate_mode t_coffee_slow "); 
4758      buf=strcat (buf," -gapopen 100 -gapext 20 -nomatch 30 ");
4759      buf=strcat (buf," -clean_aln 0 ");
4760      buf=strcat (buf,"-output clustalw,score_ascii ");
4761     
4762      
4763      return buf;
4764    }
4765 char *get_dali_defaults(char *buf, char *type)
4766    {
4767      
4768      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4769
4770      buf=strcat (buf,"-cosmetic_penalty=-50 ");
4771      buf=strcat (buf,"-distance_matrix_mode=slow ");
4772      buf=strcat (buf,"-output clustalw,score_ascii ");
4773      buf=strcat (buf,"-evaluate_mode=non_extended_t_coffee ");
4774      buf=strcat (buf,"-clean_aln 0 ");
4775      
4776      return buf;
4777    }
4778
4779 char *get_very_fast_defaults(char *buf, char *type)
4780    {
4781      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4782      
4783      buf=strcat (buf,"-in Xblosum62mt ");
4784      buf=strcat (buf,"-distance_matrix_mode ktup ");
4785      buf=strcat (buf,"-maxnseq 10000 ");
4786      buf=strcat (buf,"-dpa_maxnseq 0 ");
4787      buf=strcat (buf,"-dp_mode fasta_pair_wise ");
4788      buf=strcat (buf,"-extend_mode matrix ");
4789      buf=strcat (buf,"-gapopen -10 ");
4790      buf=strcat (buf,"-gapext -1 ");
4791      buf=strcat (buf,"-iterate 0 ");
4792      /*buf=strcat (buf,"-in ");*/
4793
4794      return buf;
4795    }
4796
4797 char *get_low_memory_defaults(char *buf, char *type)
4798    {
4799      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4800      
4801      if (NO_METHODS_IN_CL)buf=strcat (buf,"-distance_matrix_mode=idscore -method lalign_id_pair slow_pair -dp_mode=linked_pair_wise ");
4802      else buf=strcat (buf,"-distance_matrix_mode=idscore -dp_mode=linked_pair_wise ");
4803      return buf;
4804    }
4805 char *get_dna_defaults(char *buf, char *type)
4806 {
4807   
4808   return buf;
4809 }
4810 char *get_cdna_defaults(char *buf, char *type)
4811 {
4812   buf=strcat (buf,"-distance_matrix_mode=idscore -dp_mode=fasta_cdna_pair_wise ");
4813   return buf;
4814 }
4815 char *get_3dcoffee_defaults(char *buf, char *type)
4816    {
4817      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4818      
4819      buf=strcat (buf,"-in Msap_pair  -template_file SELF_P_ ");
4820      /*buf=strcat (buf,"-in ");*/
4821
4822      return buf;
4823    }
4824 char *get_expresso_defaults(char *buf, char *type)
4825    {
4826     
4827      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4828    
4829      buf=strcat (buf,"-in Msap_pair -template_file EXPRESSO");
4830      
4831      /*buf=strcat (buf,"-in ");*/
4832
4833      return buf;
4834    }
4835 char *get_psicoffee_defaults(char *buf, char *type)
4836    {
4837     
4838      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4839      
4840      buf=strcat (buf,"-in Mproba_pair -template_file BLAST   ");
4841      /*buf=strcat (buf,"-in ");*/
4842
4843      return buf;
4844    }
4845 char *get_accurate_defaults ( char *buf, char *type)
4846 {
4847  
4848   if ( strm (type, "PROTEIN")) return get_accurate4PROTEIN_defaults(buf, type);
4849   else if ( strm (type, "DNA")) return get_accurate4DNA_defaults(buf, type);
4850   else if ( strm (type, "RNA")) return get_accurate4RNA_defaults(buf, type);
4851   else return get_defaults(buf, type);
4852 }
4853 char *get_accurate4PROTEIN_defaults(char *buf, char *type)
4854    {
4855      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4856      if (NO_METHODS_IN_CL)buf=strcat (buf,"-in Mbest_pair4prot -template_file BLAST -template_file EXPRESSO  "); 
4857      else buf=strcat (buf,"-template_file BLAST -template_file EXPRESSO  ");
4858      buf=strcat (buf,"-output aln, expanded_fasta_aln ");
4859      
4860      return buf;
4861    }
4862
4863
4864
4865
4866 char *get_accurate4DNA_defaults(char *buf, char *type)
4867 {
4868   return get_low_memory_defaults (buf,type);
4869 }
4870 char *get_accurate4RNA_defaults(char *buf, char *type)
4871 {
4872   return get_rcoffee_defaults (buf,type);
4873 }
4874 char *get_t_coffee_defaults(char *buf, char *type)
4875 {
4876   return buf;
4877 }
4878 char *get_fmcoffee_defaults(char *buf, char *type)
4879    {
4880      //Fast Mcoffee
4881      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4882      
4883      if (NO_METHODS_IN_CL) buf=strcat (buf,"-in Mclustalw2_msa  Mmuscle_msa Mmafft_msa -multi_core methods_relax_msa");
4884      
4885      /*buf=strcat (buf,"-in ");*/
4886
4887      return buf;
4888    }
4889
4890 char *get_mcoffee_defaults(char *buf, char *type)
4891    {
4892     
4893      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4894      
4895
4896      if (NO_METHODS_IN_CL)   buf=strcat (buf,"-in Mclustalw2_msa Mt_coffee_msa Mpoa_msa Mmuscle_msa Mmafft_msa Mdialignt_msa Mpcma_msa Mprobcons_msa -multi_core methods_relax_msa  ");
4897      /*buf=strcat (buf,"-in ");*/
4898      return buf;
4899    }
4900 char *get_dmcoffee_defaults(char *buf, char *type)
4901    {
4902     
4903      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4904      
4905      if (NO_METHODS_IN_CL)buf=strcat (buf,"-in Mkalign_msa Mt_coffee_msa Mpoa_msa Mmuscle_msa Mmafft_msa Mdialignt_msa Mprobcons_msa Mamap_msa -multi_core methods_relax_msa");
4906      /*buf=strcat (buf,"-in ");*/
4907
4908      return buf;
4909    }
4910 char *get_rcoffee_consan_defaults(char *buf, char *type)
4911    {
4912     
4913      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4914      
4915      check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4916      if (NO_METHODS_IN_CL)buf=strcat (buf,"-in Mconsan_pair -dp_mode myers_miller_pair_wise -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -type DNA -relax_lib 0");
4917      else buf=strcat (buf,"-dp_mode myers_miller_pair_wise -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -type DNA -relax_lib 0");
4918      /*buf=strcat (buf,"-in ");*/
4919
4920      return buf;
4921    }
4922 char *get_rmcoffee_defaults(char *buf, char *type)
4923    {
4924     
4925      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4926      
4927      check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4928      if (NO_METHODS_IN_CL)buf=strcat (buf,"-in Mprobcons_msa Mmafft_msa Mmuscle_msa -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -check_type -type DNA -relax_lib 0");
4929      else buf=strcat (buf,"-extend_mode rna2 -template_file RCOFFEE -transform dna2rna -check_type -type DNA -relax_lib 0");
4930      /*buf=strcat (buf,"-in ");*/
4931
4932      return buf;
4933    }
4934 char *get_rmcoffee_defaults_old(char *buf, char *type)
4935    {
4936     
4937      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4938      
4939      check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4940      buf=strcat (buf,"-in Mprobcons_msa Mmafft_msa Mmuscle_msa -dp_mode myers_miller_pair_wise -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -check_type -type DNA -relax_lib 0");
4941      /*buf=strcat (buf,"-in ");*/
4942
4943      return buf;
4944    }
4945
4946 //    if (NO_METHODS_IN_CL)buf=strcat (buf,"-in Mbest_pair4prot -template_file BLAST -template_file EXPRESSO  "); 
4947    char *get_best4RNA_defaults(char *buf, char *type)
4948    {
4949     
4950            if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4951      
4952            check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4953            buf=strcat (buf," -extend_mode rna2 -template_file PDB,RNA -in Mbest_pair4rna");
4954            /*buf=strcat (buf,"-in ");*/
4955
4956            return buf;
4957    }
4958    
4959 char *get_rcoffee_defaults(char *buf, char *type)
4960    {
4961     
4962      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4963      
4964      check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4965      buf=strcat (buf," -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -check_type -type DNA -relax_lib 0");
4966      /*buf=strcat (buf,"-in ");*/
4967
4968      return buf;
4969    }
4970 char *get_rcoffee_defaults_old(char *buf, char *type)
4971    {
4972     
4973      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4974      
4975      check_program_is_installed (RNAPLFOLD_4_TCOFFEE,NULL, NULL,RNAPLFOLD_ADDRESS, INSTALL_OR_DIE);
4976      buf=strcat (buf,"-dp_mode myers_miller_pair_wise -extend_mode rna2 -template_file RCOFFEE -transform dna2rna -check_type -type DNA -relax_lib 0");
4977      /*buf=strcat (buf,"-in ");*/
4978
4979      return buf;
4980    }
4981
4982 char *get_repeat_defaults(char *buf, char *type)
4983    {
4984     
4985      if (buf==NULL)buf=vcalloc (1000, sizeof (char));
4986      
4987      buf=strcat (buf,"-in slow_pair -matrix idmat -out_lib -profile_comparison profile -profile_mode channel_profile_profile -dp_mode myers_miller_pair_wise ");
4988      /*buf=strcat (buf,"-in ");*/
4989      return buf;
4990    }
4991
4992
4993 int check_configuration4program()
4994    {
4995      return 1;
4996      
4997    }
4998
4999 /*Chose the right Mode for comparing residues*/
5000
5001 void test ()
5002 {
5003   char command[1000];
5004   char *c2;
5005   
5006   c2=vcalloc ( 100, sizeof (char));
5007
5008   sprintf (command, "cat hmgt_mouseVsnrl3d.blast_result |blast_aln2fasta_aln.pl | fasta_aln2fasta_aln_unique_name.pl > my_test");
5009   
5010   fprintf ( stderr, "C1: %d, C2:%d", is_dynamic_memory (c2), is_dynamic_memory (c2));
5011   
5012   
5013   myexit (0);
5014 }
5015
5016 int run_other_pg ( int argc, char *argv[])
5017 {
5018   //make minimum initialization
5019   get_t_coffee_environement (NULL);
5020   if ( strm (argv[0], "seq_reformat") || strm (argv[0], "saltt"))
5021     {
5022       return seq_reformat (argc, argv);
5023     }
5024   else if ( strm (argv[0], "aln_compare"))
5025     {
5026       return aln_compare (argc, argv);
5027     }
5028   else if ( strm (argv[0], "analyse_pdb") || strm (argv[0], "apdb") || strm (argv[0], "irmsd") || strm (argv[0], "trmsd"))
5029     {
5030       return apdb ( argc, argv);
5031     }
5032   else if ( strm (argv[0], "quantile"))
5033     {
5034       return quantile ( argc, argv);
5035     }
5036   else if ( strstr ( argv[0], "unpack_"))
5037     {
5038       unpack_all_perl_script (argv[0]+strlen ("unpack_"));
5039     }
5040         else if ( strstr ( argv[0], "fastal"))
5041         {
5042                 return fastal(argc, argv);
5043         }
5044   else
5045     {
5046       return my_system_cl (argc, argv);
5047     }
5048   return EXIT_FAILURE;
5049 }
5050
5051 FILE * t_coffee_tip (FILE *fp,char *mode)
5052 {
5053   static char **tip;
5054   static int n;
5055   int a;
5056   if ( !tip)
5057     {
5058       tip=declare_char ( 100, 300);
5059       sprintf ( tip[n++],"Get the most accurate protein alignments with: t_coffee <yourseq> -special_mode accurate [Slow]\n");
5060       sprintf ( tip[n++],"Change the Width of your MSA with the environement variable ALN_LINE_LENGTH (all formats)");
5061       sprintf ( tip[n++],"Align 2 or more profiles with -profiles= aln1, aln2");
5062       sprintf ( tip[n++],"-special_mode=expresso to fetch your structures automatically");
5063       sprintf ( tip[n++],"-special_mode=psicoffee to expand your sequences");
5064       sprintf ( tip[n++],"-special_mode=accurate The best we can do [slow]");
5065       
5066       sprintf ( tip[n++],"-special_mode=3dcoffee to combine sequences and structures");
5067       sprintf ( tip[n++],"-special_mode=mcoffee to combine alternative msa methods");
5068       sprintf ( tip[n++],"-special_mode=dmcoffee to combine alternative msa methods on debian");
5069
5070       sprintf ( tip[n++],"-usetree=<file> to use your own guide tree");
5071       sprintf ( tip[n++],"-infile=<aln> -special_mode=evaluate to evaluate your own alignment");
5072       sprintf ( tip[n++],"-other_pg seq_reformat to access seq_reformat");
5073       sprintf ( tip[n++],"-other_pg extract_from_pdb to use our pdb retriever");
5074       sprintf ( tip[n++],"All the latest versions on www.tcoffee.org");
5075       sprintf ( tip[n++],"-version to check for updates");
5076       sprintf ( tip[n++],"-output=html will produce a colored output");
5077       sprintf ( tip[n++],"-outorder=aligned will order the sequences according to the guide tree in newick");
5078       sprintf ( tip[n++],"-special_mode=quickaln will produce fast/low accuracy alignments");
5079       sprintf ( tip[n++],"-other_pg seq_reformat -in <aln> -action +trim %%50 Will reduce the redundancy of your MSA");
5080       sprintf ( tip[n++],"-tip=all to see all the tips, tip=no will prevent them all");
5081       sprintf ( tip[n++],"-other_pg unpack_all will unpack all the perl scripts within t_coffee");
5082     }
5083   
5084   if ( strm (mode, "none"))return fp;
5085
5086   fprintf ( fp, "\n# TIP :See The Full Documentation on www.tcoffee.org\n");
5087   
5088   if (strm ( mode, "all"))
5089     {
5090       for ( a=0; a< n; a++)
5091         {
5092           fprintf (fp, "# TIP %d: %s\n", a+1,tip[a]);
5093         }
5094     }
5095   else if ( strm ( mode, "one"))
5096     {
5097       int b;
5098       vsrand(0);
5099       b=(rand()%(n-1))+1;
5100       fprintf (fp, "# TIP %2s:  %s","1", tip[0]);
5101       fprintf (fp, "# TIP %2d:  %s\n", b+1, tip[b]);
5102       
5103     }
5104
5105   fprintf ( fp, "\n");
5106   return fp;
5107 }
5108         
5109 char* prepare_one2all (char *seq,Sequence *S, char *lib_file)
5110  {
5111    int a, n, i;
5112    FILE *fp;
5113    char **name, *use_tree;
5114    
5115
5116    if ( S->nseq==2) return NULL;
5117
5118    
5119    if ((i=name_is_in_list (seq,S->name,S->nseq, 100))!=-1);
5120    else if ( is_number (seq))
5121      i=atoi(seq)-1;
5122    else
5123      return NULL;
5124   
5125    
5126    declare_name (use_tree);
5127    
5128
5129    name=declare_char (S->nseq+1, 100);
5130    for (a=0; a<S->nseq; a++)
5131      sprintf (name[a], "%s", S->name[a]);
5132    n=S->nseq;
5133    
5134    if (i!=0)
5135      {
5136        sprintf (name[n], "%s", name[i]);
5137        sprintf (name[i], "%s", name[0]);
5138        sprintf (name[0], "%s", name[n]);
5139      }
5140    sprintf (lib_file, "%s", vtmpnam (NULL));
5141    fp=vfopen (lib_file, "w");
5142    for ( a=1; a<n; a++)
5143      {
5144        fprintf ( fp, "2 %s %s\n", name[0],name[a]);
5145      }
5146    vfclose (fp);
5147    
5148   
5149    sprintf ( use_tree, "%s", vtmpnam (NULL));
5150    fp=vfopen (use_tree, "w");
5151    vfclose (create_linear_tree (name, n, fp));
5152    free_char (name, -1);
5153   
5154    return use_tree;
5155  }
5156 char* prepare_subset2all (char *mode, Sequence *S, char *lib_file, Constraint_list *CL)
5157  {
5158    int a,b,s1, n, i;
5159    FILE *fp;
5160    char **name;
5161    int **score;
5162    int **done;
5163    int nseq=0;
5164    
5165    if ( S->nseq==2) return NULL;
5166    name=declare_char (S->nseq+1, 100);
5167    done=declare_int (S->nseq, S->nseq);
5168    for (a=0; a<S->nseq; a++)done[a][a]=1;
5169    
5170    if ( check_file_exists (mode))
5171      {
5172        Sequence *L;
5173        L=main_read_seq (mode);
5174        for (a=0; a< L->nseq; a++)
5175          if ( (b=name_is_in_list (L->name[a], S->name,S->nseq, 100))!=-1)
5176            {
5177              sprintf ( name[nseq++], "%s", L->name[a]);
5178            }
5179      }
5180    else if ( strm (mode, "_P_"))
5181      {
5182        for (a=0; a<S->nseq; a++)
5183          {
5184            if (seq_has_template (S, a, "_P_"))
5185              {
5186                sprintf (name[nseq++], "%s", name [a]);
5187              }
5188          }
5189      }
5190    else if ( is_number (mode))
5191      {
5192        Sequence *LS;
5193        
5194        nseq=atoi (mode);
5195        if ( nseq<0)
5196          nseq=((float)S->nseq*((float)nseq/(float)100.0)*(float)-1);
5197        
5198        nseq=MIN(nseq,S->nseq);
5199        if ( nseq>=S->nseq)LS=S;
5200        else
5201          {
5202            Alignment *A, *SA;
5203            char tmode[1000];
5204            A=very_fast_aln (seq2aln (S, NULL, RM_GAP), 0, NULL);
5205            sprintf (tmode, "_aln_n%d", nseq);
5206            SA=simple_trimseq (A, NULL, tmode, NULL);
5207            LS=aln2seq(SA);
5208            free_aln (A);
5209            free_aln (SA);
5210          }
5211        for (a=0; a<LS->nseq; a++)
5212          {
5213            sprintf (name[a], "%s", LS->name[a]);
5214            fprintf ( stderr, "\n\tMaster Sequence: %s", name[a]);
5215          }
5216        if (LS!=S)free_sequence (LS, LS->nseq);
5217      }
5218    else
5219      {
5220        printf_exit (EXIT_FAILURE, stderr, "ERROR: %s is neither a file nor a method nor a number for subset2all [FATAL:%s]\n",mode,PROGRAM);
5221      }
5222    
5223    sprintf (lib_file, "%s", vtmpnam (NULL));
5224    fp=vfopen (lib_file, "w");
5225    for (a=0; a<nseq; a++)
5226      {
5227        for ( b=0; b<S->nseq; b++)
5228          {
5229            if(!done[a][b] && !strm (name[a],S->name[b]))fprintf ( fp, "2 %s %s\n", name[a],S->name[b]);
5230            done[a][b]=done[b][a]=1;
5231          }
5232      }
5233    vfclose (fp);
5234    
5235    return NULL;
5236  }
5237 int set_methods_limits (char ** method,int nl,char **list, int n, int *maxnseq, int *maxlen)
5238 {
5239   int a,ns, ml, nm=0;
5240   char string[1000];
5241   
5242   nl/=3;
5243   for (a=0; a<nl; a+=3)
5244     {
5245       
5246       sprintf ( string, "M%s", method[a]);
5247       if ( name_is_in_list (string,list, n, 100)!=-1)
5248         {
5249           
5250           ns=atoi(method[a+1]);
5251           ml=atoi(method[a+2]);
5252           
5253           if (ns!=-1 && (maxnseq[0]==-1 || maxnseq[0]>ns))maxnseq[0]=ns;
5254           if (ml!=-1 && (maxlen[0]==-1 || maxlen[0]>ml))maxlen[0]=ml;
5255           nm++;
5256         }
5257     }
5258   return nm;
5259 }
5260
5261
5262
5263 char * get_seq_type_from_cl (int argc, char **argv)
5264 {
5265   char *buf, *r;
5266   char file[100];
5267   int a;
5268   int seq=0;
5269   
5270   sprintf (file, "%d.tmp", rand()%10000);
5271   buf=vcalloc ( 1000, sizeof (char));
5272   sprintf ( buf, "%s ", get_string_variable ("t_coffee"));
5273   for (a=1, seq=0; a<argc; a++)
5274     {
5275       if ( check_file_exists (argv[a]))seq=1;
5276     }
5277   if (!seq) return "";
5278   
5279   for (a=1; a< argc; a++)
5280     {
5281       buf=strcat (buf, argv[a]);
5282       buf=strcat (buf, " ");
5283     }
5284   
5285   buf=strcat (buf, " -type_only >");
5286   buf=strcat (buf, file);
5287   my_system ( buf);
5288   
5289   r=file2string (file);
5290   vremove (file);
5291   return r;
5292 }
5293 /*********************************COPYRIGHT NOTICE**********************************/
5294 /*© Centro de Regulacio Genomica */
5295 /*and */
5296 /*Cedric Notredame */
5297 /*Tue Oct 27 10:12:26 WEST 2009. */
5298 /*All rights reserved.*/
5299 /*This file is part of T-COFFEE.*/
5300 /**/
5301 /*    T-COFFEE is free software; you can redistribute it and/or modify*/
5302 /*    it under the terms of the GNU General Public License as published by*/
5303 /*    the Free Software Foundation; either version 2 of the License, or*/
5304 /*    (at your option) any later version.*/
5305 /**/
5306 /*    T-COFFEE is distributed in the hope that it will be useful,*/
5307 /*    but WITHOUT ANY WARRANTY; without even the implied warranty of*/
5308 /*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
5309 /*    GNU General Public License for more details.*/
5310 /**/
5311 /*    You should have received a copy of the GNU General Public License*/
5312 /*    along with Foobar; if not, write to the Free Software*/
5313 /*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/
5314 /*...............................................                                                                                      |*/
5315 /*  If you need some more information*/
5316 /*  cedric.notredame@europe.com*/
5317 /*...............................................                                                                                                                                     |*/
5318 /**/
5319 /**/
5320 /*      */
5321 /*********************************COPYRIGHT NOTICE**********************************/