5 #include "fastal_lib_header.h"
9 tree_parse(struct Fastal_arguments *arguments, char* param)
12 arguments->tree_method = strtok(param,delims);
13 if (arguments->tree_method == "parttree")
15 arguments->tree_param1 = 6;
16 arguments->tree_param2 = 150;
18 char *tmp = strtok(NULL,delims);
21 arguments->tree_param1 = atoi(tmp);
22 arguments->tree_param2 = atoi(strtok(NULL,delims));
24 // printf("A: %s %i %i", arguments->tree_method, arguments->tree_param1, arguments->tree_param2);
30 arg_parse (int argc, char **argv, struct Fastal_arguments *arguments)
34 arguments->diag_method = "blast";
35 arguments->output_file = "out->aln";
36 arguments->tree_file = NULL;
39 arguments->method = "fast";
40 arguments->tree_method = "oligotree";
41 arguments->mat="dna_idmat";
42 arguments->tree_only = 0;
43 arguments->evaluate = 0;
45 // arguments->retree = 0;
46 arguments->agreement_score = 0;
47 arguments->num_ref_aln = 0;
48 arguments->is_dna = 1;
49 arguments->aln_ref = NULL;
50 arguments->aln2test = NULL;
51 arguments->tree_out = 0;
52 arguments->gap_iterate = 0;
58 for (i = 0; i < argc; ++i)
61 if ( ( !strcmp(param, "-d" )) || ( !strcmp(param, "--is_dna")))
63 arguments->is_dna = 1;
64 arguments->mat = "dna_idmat";
66 else if ( ( !strcmp(param, "-a" )) || ( !strcmp(param, "--is_aa")))
68 arguments->is_dna = 0;
69 arguments->mat = "blosum62mt";
72 // printf("%s\n", arguments->mat);
74 if (arguments->is_dna)
76 arguments->tree_param1 = 2;
77 arguments->tree_param2 = 5;
81 arguments->tree_param1 = 1;
82 arguments->tree_param2 = 10;
90 if ( ( !strcmp(param, "-i" )) || ( !strcmp(param, "--in")))
92 arguments->sequence_file = argv[++i];
94 else if ( ( !strcmp(param, "-t" )) || ( !strcmp(param, "--tree_file")))
96 arguments->tree_file = argv[++i];
98 else if ( !strcmp(param, "--mat"))
100 arguments->mat = argv[++i];
102 else if ( !strcmp(param, "--tree_method"))
104 tree_parse(arguments, argv[++i]);
105 // arguments->tree_file = argv[++i];
107 else if ( ( !strcmp(param, "-o" )) || ( !strcmp(param, "--outfile")))
109 arguments->output_file = argv[++i];
111 else if ( ( !strcmp(param, "-m" )) || ( !strcmp(param, "--method")))
114 if ( (!strcmp(argv[i], "fast")) || (!strcmp(argv[i], "nw")) || (!strcmp(argv[i], "gotoh")) || (!strcmp(argv[i], "udisc")) )
115 arguments->method = argv[i];
118 printf("Method %s unknown\n", argv[i]);
122 else if ( ( !strcmp(param, "-b" )) || ( !strcmp(param, "--diag_method")))
125 if ( (!strcmp(argv[i], "blast")) || (!strcmp(argv[i], "blastz")) || (!strcmp(argv[i], "blat")) || (!strcmp(argv[i], "ktup")))
126 arguments->diag_method = argv[i];
129 printf("DIAG Method %s unknown\n", argv[i]);
133 else if ( ( !strcmp(param, "-d" )) || ( !strcmp(param, "--is_dna")))
135 arguments->is_dna = 1;
137 else if ( ( !strcmp(param, "-a" )) || ( !strcmp(param, "--is_aa")))
139 arguments->is_dna = 0;
141 else if ( ( !strcmp(param, "-g" )) || ( !strcmp(param, "--gop")))
143 arguments->gop = atof(argv[++i]);
145 // else if ( ( !strcmp(param, "-r" )) || ( !strcmp(param, "--retree")))
147 // arguments->retree = atoi(argv[++i]);
149 else if ( ( !strcmp(param, "-e" )) || ( !strcmp(param, "--gep")))
151 arguments->gep = atof(argv[++i]);
153 else if ( ( !strcmp(param, "-k" )) || ( !strcmp(param, "--p1")))
155 arguments->tree_param1 = atoi(argv[++i]);
157 else if ( ( !strcmp(param, "-c" )) || ( !strcmp(param, "--p2")))
159 arguments->tree_param2 = atoi(argv[++i]);
161 else if ( !strcmp(param, "--eval_aln"))
163 arguments->evaluate = 1;
165 else if ( ( !strcmp(param, "-s" )) || ( !strcmp(param, "--score")))
167 arguments->score = 1;
169 else if ( !strcmp(param, "--tree_out"))
171 arguments->tree_out = 1;
173 else if ( !strcmp(param, "--tree_only"))
175 arguments->tree_only = 1;
177 else if ( !strcmp(param, "--agreement_score"))
179 arguments->agreement_score = 1;
181 else if ( !strcmp(param, "--make_ref_aln"))
183 arguments->num_ref_aln = atoi(argv[++i]);
184 arguments->num_seq_in_ref = atoi(argv[++i]);
186 else if ( !strcmp(param, "--aln_ref"))
188 arguments->aln_ref = argv[++i];
190 else if ( !strcmp(param, "--gap_iterate"))
192 arguments->gap_iterate = atoi(argv[++i]);
194 else if ( !strcmp(param, "--aln2test"))
196 arguments->aln2test = argv[++i];
198 else if ( ( !strcmp(param, "-h" )) || ( !strcmp(param, "--help")) || ( !strcmp(param, "-?" )))
200 printf("Fastal - a fast alignment tool\n");
201 printf("-i --in The sequence_file\n");
202 printf("-t --tree_file The treefile\n");
203 printf(" --tree_method The method to produce the tree:\n");
204 printf(" oligo - very fast method\n");
205 printf(" parttree - method like in mafft\n");
206 printf("-o --outfile The output file\n");
207 printf("-m --method The method to use:\n");
208 printf(" fast - fast approximate algorithm [default]\n");
209 printf(" nw - needleman-wunsch\n");
210 printf(" gotoh - gotoh\n");
211 printf("-d --is_dna Sequence are DNA\n");
212 printf("-a --is_aa Sequences are amino acids\n");
213 printf("-g --gop Gap opening costs\n");
214 printf("-e --gep Gap extension costs\n");
215 printf("-r --retree Number of reconstructions [default=0]\n");
216 printf(" --tree_only only tree is produced\n");
217 printf(" --eval_aln calculates only the sum-of-pairs-score of a given alignment\n");
218 printf("-s --score calculates the sum of paris score after construction of an alignment. Can take a long time. [default: off]\n");
219 // printf(" --make_ref_aln calculates the sum of paris score after construction of an alignment. Can take a long time. [default: off]\n");
224 printf("Argument %s unknown\n", param);
230 /******************************COPYRIGHT NOTICE*******************************/
231 /*© Centro de Regulacio Genomica */
233 /*Cedric Notredame */
234 /*Fri Feb 18 08:27:45 CET 2011 - Revision 596. */
235 /*All rights reserved.*/
236 /*This file is part of T-COFFEE.*/
238 /* T-COFFEE is free software; you can redistribute it and/or modify*/
239 /* it under the terms of the GNU General Public License as published by*/
240 /* the Free Software Foundation; either version 2 of the License, or*/
241 /* (at your option) any later version.*/
243 /* T-COFFEE is distributed in the hope that it will be useful,*/
244 /* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
245 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/
246 /* GNU General Public License for more details.*/
248 /* You should have received a copy of the GNU General Public License*/
249 /* along with Foobar; if not, write to the Free Software*/
250 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
251 /*............................................... |*/
252 /* If you need some more information*/
253 /* cedric.notredame@europe.com*/
254 /*............................................... |*/
258 /******************************COPYRIGHT NOTICE*******************************/