Next version of JABA
[jabaws.git] / binaries / src / mafft / core / mafft.tmpl
1 #! /bin/sh
2
3
4 er=0;
5 myself=`dirname $0`/`basename $0`; export myself
6 version="v6.713b (2009/09/24)"; export version
7 LANG=C; export LANG
8 os=`uname`
9 progname=`basename $0`
10 if [ `echo $os | grep -i cygwin` ]; then
11         os="cygwin"
12 elif [ `echo $os | grep -i darwin` ]; then
13         os="darwin"
14 elif [ `echo $os | grep -i sunos` ]; then
15         os="sunos"
16 else
17         os="unix"
18 fi
19 export os
20
21 if [ "$MAFFT_BINARIES" ]; then
22         prefix="$MAFFT_BINARIES"
23 else
24         prefix=_LIBDIR
25 fi
26 export prefix
27
28 if [ $# -gt 0 ]; then
29         if [ "$1" = "--man" ]; then 
30                 man "$prefix/mafft.1"
31                 exit 0;
32         fi
33 fi
34
35 if [ ! -x "$prefix/tbfast" ]; then
36         echo "" 1>&2
37         echo "correctly installed?" 1>&2
38         echo "mafft binaries have to be installed in \$MAFFT_BINARIES" 1>&2
39         echo "or the $prefix directory". 1>&2
40         echo "" 1>&2
41         exit 1
42         er=1
43 fi
44
45 defaultiterate=0
46 defaultcycle=2
47 defaultgop="1.53"
48 #defaultaof="0.123"
49 defaultaof="0.000"
50 defaultlaof="0.100"
51 defaultlgop="-2.00"
52 defaultfft=1
53 defaultrough=0
54 defaultdistance="sixtuples"
55 #defaultdistance="local"
56 defaultweighti="2.7"
57 defaultweightr="0.0"
58 defaultweightm="1.0"
59 defaultmccaskill=0
60 defaultcontrafold=0
61 defaultalgopt="  "
62 defaultalgoptit="  "
63 defaultsbstmodel=" -b 62 "
64 defaultfmodel=" "
65 defaultkappa=" "
66 if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then
67         defaultfft=1
68         defaultcycle=1
69         defaultiterate=1000
70         defaultdistance="scarna"
71         defaultweighti="3.2"
72         defaultweightr="8.0"
73         defaultweightm="2.0"
74         defaultmccaskill=1
75         defaultcontrafold=0
76         defaultalgopt=" -A "
77         defaultalgoptit=" -AB " ## chui
78         defaultaof="0.0"
79         defaultsbstmodel=" -b 62 "
80         defaultkappa=" "
81         defaultfmodel=" -a "
82 elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then
83         defaultfft=1
84         defaultcycle=1
85         defaultiterate=1000
86         defaultdistance="global"
87         defaultweighti="3.2"
88         defaultweightr="8.0"
89         defaultweightm="2.0"
90         defaultmccaskill=1
91         defaultcontrafold=0
92         defaultalgopt=" -A "
93         defaultalgoptit=" -AB " ## chui
94         defaultaof="0.0"
95         defaultsbstmodel=" -b 62 "
96         defaultkappa=" "
97         defaultfmodel=" -a "
98 elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then
99         defaultfft=0
100         defaultcycle=1
101         defaultiterate=1000
102         defaultdistance="local"
103 elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then
104         defaultfft=1
105         defaultcycle=1
106         defaultiterate=1000
107         defaultdistance="global"
108 elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then
109         defaultfft=0
110         defaultcycle=1
111         defaultiterate=1000
112         defaultdistance="localgenaf"
113 elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then
114         defaultfft=1
115         defaultcycle=2
116         defaultdistance="sixtuples"
117 elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then
118         defaultfft=1
119         defaultcycle=2
120         defaultiterate=2
121         defaultdistance="sixtuples"
122 elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then
123         defaultfft=0
124         defaultcycle=2
125         defaultdistance="sixtuples"
126 elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
127         defaultfft=0
128         defaultcycle=2
129         defaultiterate=2
130         defaultdistance="sixtuples"
131 fi
132 kappa=$defaultkappa
133 sbstmodel=$defaultsbstmodel
134 fmodel=$defaultfmodel
135 gop=$defaultgop
136 aof=$defaultaof
137 cycle=$defaultcycle
138 iterate=$defaultiterate
139 fft=$defaultfft
140 rough=$defaultrough
141 distance=$defaultdistance
142 forcefft=0
143 memopt=" "
144 weightopt=" "
145 GGOP="-6.00"
146 LGOP="-6.00"
147 LEXP="-0.000"
148 GEXP="-0.000"
149 lgop=$defaultlgop
150 lexp="-0.100"
151 laof=$defaultlaof
152 pggop="-2.00"
153 pgexp="-0.10"
154 pgaof="0.10"
155 rgop="-1.530"
156 rgep="-0.000"
157 seqtype="  "
158 weighti=$defaultweighti
159 weightr=$defaultweightr
160 weightm=$defaultweightm
161 rnaalifold=0
162 mccaskill=$defaultmccaskill
163 contrafold=$defaultcontrafold
164 quiet=0
165 debug=0
166 sw=0
167 algopt=$defaultalgopt
168 algoptit=$defaultalgoptit
169 scorecalcopt=" "
170 coreout=0
171 corethr="0.5"
172 corewin="100"
173 coreext=" "
174 outputformat="pir"
175 outorder="input"
176 seed="x"
177 seedtable="x"
178 auto=0
179 groupsize=-1
180 partsize=50
181 partdist="sixtuples"
182 partorderopt=" -x "
183 treeout=0
184 distout=0
185 treein=0
186 topin=0
187 treeinopt="  "
188 seedfiles="/dev/null"
189 seedtablefile="/dev/null"
190 aamatrix="/dev/null"
191 treeinfile="/dev/null"
192 rnascoremtx=" "
193 laraparams="/dev/null"
194 foldalignopt=" "
195 treealg=" -X "
196 if [ $# -gt 0 ]; then
197         while [ $# -gt 1 ];
198         do
199                 if [ "$1" = "--auto" ]; then 
200                         auto=1
201                 elif [ "$1" = "--clustalout" ]; then 
202                         outputformat="clustal"
203                 elif [ "$1" = "--reorder" ]; then 
204                         outorder="aligned"
205                         partorderopt=" "
206                 elif [ "$1" = "--inputorder" ]; then 
207                         outorder="input"
208                         partorderopt=" -x "
209                 elif [ "$1" = "--unweight" ]; then 
210                         weightopt=" -u "
211                 elif [ "$1" = "--algq" ]; then 
212                         algopt=" -Q "
213                         algoptit=" -QB "
214                 elif [ "$1" = "--groupsize" ]; then 
215                         shift   
216                         groupsize=`expr "$1" - 0`
217                 elif [ "$1" = "--partsize" ]; then 
218                         shift   
219                         partsize=`expr "$1" - 0`
220                 elif [ "$1" = "--parttree" ]; then 
221                         distance="parttree"
222                         partdist="sixtuples"
223                 elif [ "$1" = "--dpparttree" ]; then 
224                         distance="parttree"
225                         partdist="localalign"
226                 elif [ "$1" = "--fastaparttree" ]; then 
227                         distance="parttree"
228                         partdist="fasta"
229                 elif [ "$1" = "--treeout" ]; then 
230                         treeout=1
231                 elif [ "$1" = "--distout" ]; then 
232                         distout=1
233                 elif [ "$1" = "--fastswpair" ]; then
234                         distance="fasta"
235                         sw=1
236                 elif [ "$1" = "--fastapair" ]; then
237                         distance="fasta"
238                         sw=0
239                 elif [ "$1" = "--averagelinkage" ]; then
240                         treealg=" -E "
241                 elif [ "$1" = "--minimumlinkage" ]; then
242                         treealg=" -q "
243                 elif [ "$1" = "--noscore" ]; then
244                         scorecalcopt=" -Z "
245                 elif [ "$1" = "--6merpair" ]; then
246                         distance="sixtuples"
247                 elif [ "$1" = "--blastpair" ]; then
248                         distance="blast"
249                 elif [ "$1" = "--globalpair" ]; then
250                         distance="global"
251                 elif [ "$1" = "--localpair" ]; then
252                         distance="local"
253                 elif [ "$1" = "--scarnapair" ]; then
254                         distance="scarna"
255                 elif [ "$1" = "--larapair" ]; then
256                         distance="lara"
257                 elif [ "$1" = "--slarapair" ]; then
258                         distance="slara"
259                 elif [ "$1" = "--foldalignpair" ]; then
260                         distance="foldalignlocal"
261                 elif [ "$1" = "--foldalignlocalpair" ]; then
262                         distance="foldalignlocal"
263                 elif [ "$1" = "--foldalignglobalpair" ]; then
264                         distance="foldalignglobal"
265                 elif [ "$1" = "--globalgenafpair" ]; then
266                         distance="globalgenaf"
267                 elif [ "$1" = "--localgenafpair" ]; then
268                         distance="localgenaf"
269                 elif [ "$1" = "--genafpair" ]; then
270                         distance="localgenaf"
271                 elif [ "$1" = "--memsave" ]; then
272                         memopt=" -M -B "         # -B (bunkatsunashi no riyu ga omoidasenai)
273                 elif [ "$1" = "--nomemsave" ]; then
274                         memopt=" -N "
275                 elif [ "$1" = "--nuc" ]; then 
276                         seqtype=" -D "
277                 elif [ "$1" = "--amino" ]; then 
278                         seqtype=" -P "
279                 elif [ "$1" = "--fft" ]; then 
280                         fft=1
281                         forcefft=1
282                 elif [ "$1" = "--nofft" ]; then 
283                         fft=0
284                 elif [ "$1" = "--quiet" ]; then 
285                         quiet=1
286                 elif [ "$1" = "--debug" ]; then 
287                         debug=1
288                 elif [ "$1" = "--coreext" ]; then 
289                         coreext=" -c "
290                 elif [ "$1" = "--core" ]; then 
291                         coreout=1
292                 elif [ "$1" = "--maxiterate" ]; then 
293                         shift   
294                         iterate=`expr "$1" - 0` 
295                 elif [ "$1" = "--retree" ]; then 
296                         shift   
297                         cycle=`expr "$1" - 0`
298                 elif [ "$1" = "--aamatrix" ]; then 
299                         shift   
300                         sbstmodel=" -b -1 "
301                         aamatrix="$1"
302                 elif [ "$1" = "--treein" ]; then 
303                         shift   
304                         treeinopt=" -U "
305                         treein=1
306                         treeinfile="$1"
307                 elif [ "$1" = "--topin" ]; then 
308                         shift   
309                         treeinopt=" -V "
310                         treein=1
311                         treeinfile="$1"
312                         echo "The --topin option has been disabled." 1>&2
313                         echo "There was a bug in version < 6.530."   1>&2
314                         echo "This bug has not yet been fixed."      1>&2
315                         exit 1
316                 elif [ "$1" = "--kappa" ]; then 
317                         shift   
318                         kappa=" -k $1 "
319                 elif [ "$1" = "--fmodel" ]; then 
320                         fmodel=" -a "
321                 elif [ "$1" = "--jtt" ]; then 
322                         shift   
323                         sbstmodel=" -j $1"
324                 elif [ "$1" = "--kimura" ]; then 
325                         shift   
326                         sbstmodel=" -j $1"
327                 elif [ "$1" = "--tm" ]; then 
328                         shift   
329                         sbstmodel=" -m $1"
330                 elif [ "$1" = "--bl" ]; then 
331                         shift   
332                         sbstmodel=" -b $1"
333                 elif [ "$1" = "--weighti" ]; then
334                         shift   
335                         weighti="$1"
336                 elif [ "$1" = "--weightr" ]; then
337                         shift   
338                         weightr="$1"
339                 elif [ "$1" = "--weightm" ]; then
340                         shift   
341                         weightm="$1"
342                 elif [ "$1" = "--rnaalifold" ]; then
343                         rnaalifold=1
344                 elif [ "$1" = "--mccaskill" ]; then
345                         mccaskill=1
346                         contrafold=0
347                 elif [ "$1" = "--contrafold" ]; then
348                         mccaskill=0
349                         contrafold=1
350                 elif [ "$1" = "--ribosum" ]; then
351                         rnascoremtx=" -s "
352                 elif [ "$1" = "--op" ]; then 
353                         shift   
354                         gop="$1"
355                 elif [ "$1" = "--ep" ]; then 
356                         shift   
357                         aof="$1"
358                 elif [ "$1" = "--rop" ]; then 
359                         shift   
360                         rgop="$1"
361                 elif [ "$1" = "--rep" ]; then 
362                         shift   
363                         rgep="$1"
364                 elif [ "$1" = "--lop" ]; then 
365                         shift   
366                         lgop="$1"
367                 elif [ "$1" = "--LOP" ]; then 
368                         shift   
369                         LGOP="$1"
370                 elif [ "$1" = "--lep" ]; then 
371                         shift   
372                         laof="$1"
373                 elif [ "$1" = "--lexp" ]; then 
374                         shift   
375                         lexp="$1"
376                 elif [ "$1" = "--LEXP" ]; then 
377                         shift   
378                         LEXP="$1"
379                 elif [ "$1" = "--GEXP" ]; then 
380                         shift   
381                         GEXP="$1"
382                 elif [ "$1" = "--GOP" ]; then 
383                         shift   
384                         GGOP="$1"
385                 elif [ "$1" = "--gop" ]; then 
386                         shift   
387                         pggop="$1"
388                 elif [ "$1" = "--gep" ]; then 
389                         shift   
390                         pgaof="$1"
391                 elif [ "$1" = "--gexp" ]; then 
392                         shift   
393                         pgexp="$1"
394                 elif [ "$1" = "--laraparams" ]; then 
395                         shift   
396                         laraparams="$1"
397                 elif [ "$1" = "--corethr" ]; then 
398                         shift   
399                         corethr="$1"
400                 elif [ "$1" = "--corewin" ]; then 
401                         shift   
402                         corewin="$1"
403                 elif [ "$1" = "--seedtable" ]; then
404                         shift
405                         seedtable="y"
406                         seedtablefile="$1"
407                 elif [ "$1" = "--seed" ]; then
408                         shift
409                         seed="m"
410                         seedfiles="$seedfiles $1"
411                 elif [ $progname = "fftns" -o  $progname = "nwns" ]; then
412                         if [ "$1" -gt 0 ]; then
413                                 cycle=`expr "$1" - 0`
414                         fi
415                 else
416                         echo "Unknown option:  $1" 1>&2
417                         er=1;
418                 fi
419                 shift   
420         done;
421
422
423
424 #       TMPFILE=/tmp/$progname.$$
425         TMPFILE=`mktemp -dt $progname.XXXXXXXXXX`
426         if [ $? -ne 0 ]; then
427                 echo "mktemp seems to be obsolete. Re-trying without -t" 1>&2
428                 TMPFILE=`mktemp -d /tmp/$progname.XXXXXXXXXX`
429         fi      
430         umask 077
431 #       mkdir  $TMPFILE  || er=1
432         if [ $debug -eq 1 ]; then
433                 trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0
434         else
435                 trap "rm -rf $TMPFILE " 0
436         fi
437         if [ $# -eq 1 ]; then
438                 if [ -r "$1" -o "$1" = - ]; then
439                         cat "$1" | tr "\r" "\n" > $TMPFILE/infile 
440                         cat "$aamatrix"       | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_aamtx
441                         cat "$treeinfile"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_guidetree
442                         cat "$seedtablefile"  | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_seedtablefile
443                         cat "$laraparams"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_lara.params
444 #                       echo $seedfiles
445                         infilename="$1"
446                         seedfilesintmp="/dev/null"
447                         seednseq="0"
448                         set $seedfiles > /dev/null
449                         while [ $# -gt 1 ];
450                         do
451                                 shift
452                                 cat "$1" | tr "\r" "\n" >  $TMPFILE/seed$#
453                                 seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#`
454                                 seedfilesintmp=$seedfilesintmp" "seed$#
455                         done
456 #                       ls $TMPFILE
457 #                       echo $seedfilesintmp
458 #                       echo $seednseq
459                 else
460                         echo "$0": Cannot open "$1". 1>&2
461                         er=1
462 #                       exit 1;
463                 fi
464         else
465                 echo '$#'"=$#" 1>&2
466                 er=1
467         fi
468
469
470         if [ $auto -eq 1 ]; then
471                 "$prefix/countlen" < $TMPFILE/infile > $TMPFILE/size
472                 nseq=`awk '{print $1}' $TMPFILE/size`
473                 nlen=`awk '{print $3}' $TMPFILE/size`
474                 if [ $nlen -lt 2000 -a $nseq -lt 100 ]; then
475                         distance="local"
476                         iterate=1000
477                 elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
478                         distance="sixtuples"
479                         iterate=2
480                 else
481                         distance="sixtuples"
482                         iterate=0
483                 fi
484                 if [ $quiet -eq 0 ]; then
485                         echo "nseq = " $nseq              1>&2
486                         echo "nlen = " $nlen              1>&2
487                         echo "distance = " $distance      1>&2
488                         echo "iterate = " $iterate        1>&2
489                 fi
490         fi
491
492         if [ $iterate -gt 16 ]; then    #??
493                 iterate=16
494         fi
495
496         if [ $rnaalifold -eq 1 ]; then
497                 rnaopt=" -e $rgep -o $rgop -c $weightm -r $weightr -R $rnascoremtx "
498 #               rnaoptit=" -o $rgop -BT -c $weightm -r $weightr -R "
499                 rnaoptit=" -o $rgop -F -c $weightm -r $weightr -R "
500         elif [ $mccaskill -eq 1 -o $contrafold -eq 1 ]; then
501                 rnaopt=" -o $rgop -c $weightm -r $weightr "
502 #               rnaoptit=" -e $rgep -o $rgop -BT -c $weightm -r $weightr $rnascoremtx "
503                 rnaoptit=" -e $rgep -o $rgop -F -c $weightm -r $weightr $rnascoremtx "
504         else
505                 rnaopt="  "
506                 rnaoptit=" -F "
507         fi
508
509         model="$sbstmodel $kappa $fmodel"
510
511         if [ $er -eq 1 ]; then
512                 echo "------------------------------------------------------------------------------" 1>&2
513                 echo "  MAFFT" $version 1>&2
514 #               echo "" 1>&2
515 #               echo "  Input format: fasta" 1>&2
516 #               echo ""  1>&2
517 #               echo "  Usage: `basename $0` [options] inputfile > outputfile" 1>&2
518             echo "  http://align.bmr.kyushu-u.ac.jp/mafft/software/" 1>&2
519                 echo "  NAR 30:3059-3066 (2002), Briefings in Bioinformatics 9:286-298 (2008)"        1>&2
520 #               echo "------------------------------------------------------------------------------" 1>&2
521 #               echo "  % mafft in > out" 1>&2
522                 echo "------------------------------------------------------------------------------" 1>&2
523 #               echo ""  1>&2
524                 echo "High speed:" 1>&2
525                 echo "  % mafft in > out" 1>&2
526                 echo "  % mafft --retree 1 in > out (fastest)" 1>&2
527                 echo "" 1>&2
528                 echo "High accuracy (for <~200 sequences x <~2,000 aa/nt):" 1>&2
529                 echo "  % mafft --maxiterate 1000 --localpair  in > out (% linsi in > out is also ok)" 1>&2
530                 echo "  % mafft --maxiterate 1000 --genafpair  in > out (% einsi in > out)" 1>&2
531                 echo "  % mafft --maxiterate 1000 --globalpair in > out (% ginsi in > out)" 1>&2
532                 echo "" 1>&2
533                 echo "If unsure which option to use:" 1>&2
534                 echo "  % mafft --auto in > out" 1>&2
535                 echo "" 1>&2
536 #               echo "Other options:" 1>&2
537                 echo "--op # :         Gap opening penalty, default: 1.53" 1>&2
538                 echo "--ep # :         Offset (works like gap extension penalty), default: 0.0" 1>&2
539                 echo "--maxiterate # : Maximum number of iterative refinement, default: 0" 1>&2
540                 echo "--clustalout :   Output: clustal format, default: fasta" 1>&2
541                 echo "--reorder :      Outorder: aligned, default: input order" 1>&2
542                 echo "--quiet :        Do not report progress" 1>&2
543 #               echo "" 1>&2
544 #               echo " % mafft --maxiterate 1000 --localpair in > out (L-INS-i)" 1>&2
545 #               echo " most accurate in many cases, assumes only one alignable domain" 1>&2 
546 #               echo "" 1>&2
547 #               echo " % mafft --maxiterate 1000 --genafpair in > out (E-INS-i)" 1>&2
548 #               echo " works well if many unalignable residues exist between alignable domains" 1>&2
549 #               echo "" 1>&2
550 #               echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2
551 #               echo " suitable for globally alignable sequences            " 1>&2
552 #               echo "" 1>&2
553 #               echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2
554 #               echo " accurate and slow, iterative refinement method      " 1>&2
555 #               echo "" 1>&2
556 #               echo "If the input sequences are long (~1,000,000nt)," 1>&2
557 #               echo " % mafft --retree 1 --memsave --fft in > out (FFT-NS-1-memsave, new in v5.8)" 1>&2
558 #               echo "" 1>&2
559 #               echo "If many (~5,000) sequences are to be aligned," 1>&2
560 #               echo "" 1>&2
561 #               echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 1>&2
562 #               echo "" 1>&2
563 #               echo " --localpair :      All pairwise local alignment information is included"  1>&2
564 #               echo "                    to the objective function, default: off"  1>&2
565 #               echo " --globalpair :     All pairwise global alignment information is included"  1>&2
566 #               echo "                    to the objective function, default: off"  1>&2
567 #               echo " --op # :           Gap opening penalty, default: $defaultgop " 1>&2
568 #               echo " --ep # :           Offset (works like gap extension penalty), default: $defaultaof " 1>&2
569 #               echo " --bl #, --jtt # :  Scoring matrix, default: BLOSUM62" 1>&2
570 #               echo "                    Alternatives are BLOSUM (--bl) 30, 45, 62, 80, " 1>&2
571 #               echo "                    or JTT (--jtt) # PAM. " 1>&2
572 #               echo " --nuc or --amino : Sequence type, default: auto" 1>&2
573 #               echo " --retree # :       The number of tree building in progressive method " 1>&2
574 #               echo "                    (see the paper for detail), default: $defaultcycle " 1>&2
575 #               echo " --maxiterate # :   Maximum number of iterative refinement, default: $defaultiterate " 1>&2
576 #               if [ $defaultfft -eq 1 ]; then
577 #                       echo " --fft or --nofft:  FFT is enabled or disabled, default: enabled" 1>&2
578 #               else
579 #                       echo " --fft or --nofft:  FFT is enabled or disabled, default: disabled" 1>&2
580 #               fi
581 #               echo " --memsave:         Memory saving mode" 1>&2
582 #               echo "                    (for long genomic sequences), default: off" 1>&2
583 #               echo " --clustalout :     Output: clustal format, default: fasta" 1>&2
584 #               echo " --reorder :        Outorder: aligned, default: input order" 1>&2
585 #               echo " --quiet :          Do not report progress" 1>&2
586 #               echo "-----------------------------------------------------------------------------" 1>&2
587                 exit 1; 
588         fi
589         if [ $sw -eq 1 ]; then
590                 swopt=" -A "
591         else
592                 swopt=" "
593         fi
594
595         if [ $distance = "fasta" -o $partdist = "fasta" ]; then
596                 if [ ! "$FASTA_4_MAFFT" ]; then
597                         FASTA_4_MAFFT=`which fasta34`
598                 fi
599
600                 if [ ! -x "$FASTA_4_MAFFT" ]; then
601                         echo ""       1>&2
602                         echo "== Install FASTA ========================================================" 1>&2
603                         echo "This option requires the fasta34 program (FASTA version x.xx or higher)"   1>&2
604                         echo "installed in your PATH.  If you have the fasta34 program but have renamed" 1>&2
605                         echo "(like /usr/local/bin/myfasta), set the FASTA_4_MAFFT environment variable" 1>&2
606                         echo "to point your fasta34 (like setenv FASTA_4_MAFFT /usr/local/bin/myfasta)." 1>&2
607                         echo "=========================================================================" 1>&2
608                         echo "" 1>&2
609                         exit 1
610                 fi
611         fi
612         if [ $distance = "lara" -o $distance = "slara" ]; then
613                 if [ ! -x "$prefix/mafft_lara" ]; then
614                         echo ""       1>&2
615                         echo "== Install LaRA =========================================================" 1>&2
616                         echo "This option requires LaRA (Bauer et al. http://www.planet-lisa.net/)."     1>&2
617                         echo "The executable have to be renamed to 'mafft_lara' and installed into "     1>&2
618                         echo "the $prefix directory. "                                                   1>&2
619                         echo "A configuration file of LaRA also have to be given"                        1>&2
620                         echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
621                         echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
622                         echo "=========================================================================" 1>&2
623                         echo "" 1>&2
624                         exit 1
625                 fi
626                 if [ ! -s "$laraparams" ]; then
627                         echo ""       1>&2
628                         echo "== Configure LaRA =======================================================" 1>&2
629                         echo "A configuration file of LaRA have to be given"                             1>&2
630                         echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
631                         echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
632                         echo "=========================================================================" 1>&2
633                         echo "" 1>&2
634                         exit 1
635                 fi
636         fi
637         if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
638         if [ ! -x "$prefix/foldalign210" ]; then
639                         echo ""       1>&2
640                         echo "== Install FOLDALIGN ====================================================" 1>&2
641                         echo "This option requires FOLDALIGN (Havgaard et al. http://foldalign.ku.dk/)." 1>&2
642                         echo "The executable have to be renamed to 'foldalign210' and installed into "   1>&2
643                         echo "the $prefix directory. "                                                   1>&2
644                         echo "=========================================================================" 1>&2
645                         echo "" 1>&2
646                         exit 1
647                 fi
648         fi
649         if [ $distance = "scarna" ]; then
650                 if [ ! -x "$prefix/mxscarnamod" ]; then
651                         echo ""       1>&2
652                         echo "== Install MXSCARNA ======================================================" 1>&2
653                         echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
654                         echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
655                         echo "which contains the modified version of MXSCARNA."                           1>&2
656                         echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
657                         echo "==========================================================================" 1>&2
658                         echo "" 1>&2
659                         exit 1
660                 fi
661         fi
662         if [ $mccaskill -eq 1 ]; then
663                 if [ ! -x "$prefix/mxscarnamod" ]; then
664                         echo ""       1>&2
665                         echo "== Install MXSCARNA ======================================================" 1>&2
666                         echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
667                         echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
668                         echo "which contains the modified version of MXSCARNA."                           1>&2
669                         echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
670                         echo "==========================================================================" 1>&2
671                         echo "" 1>&2
672                         exit 1
673                 fi
674         fi
675         if [ $contrafold -eq 1 ]; then
676                 if [ ! -x "$prefix/contrafold" ]; then
677                         echo ""       1>&2
678                         echo "== Install CONTRAfold ===================================================" 1>&2
679                         echo "This option requires CONTRAfold"                                           1>&2
680                         echo "(Do et al. http://contra.stanford.edu/contrafold/)."                       1>&2
681                         echo "The executable 'contrafold' have to be installed into "                    1>&2
682                         echo "the $prefix directory. "                                                   1>&2
683                         echo "=========================================================================" 1>&2
684                         echo "" 1>&2
685                         exit 1
686                 fi
687         fi
688
689 #old
690 #       if [ $treeout -eq 1 ]; then
691 #               parttreeoutopt="-t"
692 #               if [ $cycle -eq 0 ]; then
693 #                       treeoutopt="-t -T"
694 #                       groupsize=1
695 #                       iterate=0 
696 #                       if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
697 #                               distance="distonly"
698 #                       fi
699 #               else
700 #                       treeoutopt="-t"
701 #               fi
702 #       else
703 #               parttreeoutopt=" "
704 #               if [ $cycle -eq 0 ]; then
705 #                       treeoutopt="-t -T"
706 #                       iterate=0 
707 #                       if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
708 #                               distance="distonly"
709 #                       fi
710 #               else
711 #                       treeoutopt=" "
712 #               fi
713 #       fi
714
715 #new
716         if [ $cycle -eq 0 ]; then
717                 treeoutopt="-t -T"
718                 iterate=0 
719                 if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
720                         distance="distonly"
721                 fi
722                 if [ $treeout -eq 1 ]; then
723                         parttreeoutopt="-t"
724                         groupsize=1
725                 else
726                         parttreeoutopt=" "
727                 fi
728                 if [ $distout -eq 1 ]; then
729                         distoutopt="-y -T"
730                 fi
731         else
732                 if [ $treeout -eq 1 ]; then
733                         parttreeoutopt="-t"
734                         treeoutopt="-t"
735                 else
736                         parttreeoutopt=" "
737                         treeoutopt=" "
738                 fi
739                 if [ $distout -eq 1 ]; then
740                         distoutopt="-y"
741                 fi
742         fi
743 #
744
745         formatcheck=`grep -c '^[[:blank:]]\+>' $TMPFILE/infile | head -1 `
746         if [ $formatcheck -gt 0 ]; then
747                 echo "The first character of a description line must be " 1>&2
748                 echo "the greater-than (>) symbol, not a blank."           1>&2
749                 echo "Please check the format around the following line(s):"  1>&2
750                 grep -n '^[[:blank:]]\+>' $TMPFILE/infile  1>&2
751                 exit 1
752         fi
753
754         nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 ` 
755         if [ $nseq -eq 2 ]; then
756                 cycle=1
757         fi
758         if [ $cycle -gt 3 ]; then
759                 cycle=3
760         fi
761
762         if [ $nseq -gt 1000 -a $iterate -gt 1 ]; then
763                 echo "Too many sequences to perform iterative refinement!" 1>&2
764                 echo "Please use a progressive method." 1>&2
765                 exit 1
766         fi
767
768
769         if [ $distance = "sixtuples" -a \( $seed = "x" -a $seedtable = "x" \) ]; then
770                 localparam=" "
771         elif [ $distance = "sixtuples" -a \( $seed != "x" -o $seedtable != "x" \) ]; then
772                 if [ $cycle -lt 2 ]; then
773                         cycle=2                # nazeda
774                 fi
775                 localparam="-l "$weighti
776         elif [ $distance = "parttree" ]; then
777                 localparam=" "
778                 if [ $groupsize -gt -1 ]; then
779                         cycle=1
780                 fi
781         else
782                 localparam=" -l "$weighti
783                 if [ $cycle -gt 1 ]; then  # 09/01/08
784                         cycle=1
785                 fi
786         fi
787
788         if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
789                 aof="0.000"
790         fi
791
792         if [ "$memopt" == " -M -B " -a "$distance" != "sixtuples" ]; then
793                 echo "Impossible" 1>&2
794                 exit 1
795         fi
796 #exit
797
798         if [ $distance = "parttree" ]; then
799                 if [ $seed != "x" -o $seedtable != "x" ]; then
800                         echo "Impossible" 1>&2
801                         exit 1
802                 fi
803                 if [ $iterate -gt 1 ]; then
804                         echo "Impossible" 1>&2
805                         exit 1
806                 fi
807                 if [ $outorder = "aligned" ]; then
808                         outorder="input"
809                 fi
810                 outorder="input"   # partorder ga kiku
811                 if [ $partdist = "localalign" ]; then
812                         splitopt=" -L "    # -L -l -> fast 
813                 elif [ $partdist = "fasta" ]; then
814                         splitopt=" -S "
815                 else
816                         splitopt="  "
817                 fi
818         fi
819
820
821 #       if [ $nseq -gt 5000 ]; then
822 #               fft=0
823 #       fi
824         if [ $forcefft -eq 1 ]; then
825                 param_fft=" -G "
826                 fft=1
827         elif [ $fft -eq 1 ]; then
828                 param_fft=" -F "
829         else
830                 param_fft=" "
831         fi
832
833         if [ $seed != "x" -a $seedtable != "x" ]; then
834                         echo 'Use either one of seedtable and seed.  Not both.' 1>&2
835                         exit 1
836         fi
837
838         if [ $treein -eq 1 ]; then
839 #               if [ $iterate -gt 0 ]; then
840 #                       echo 'Not supported yet.' 1>&2
841 #                       exit 1
842 #               fi
843                 cycle=1
844         fi
845
846         if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
847                 if [ $distance = "sixtuples" ]; then
848                         echo 'Not supported.' 1>&2
849                         echo 'Please add --globalpair, --localpair, --scarnapair,' 1>&2
850                         echo '--larapair, --slarapair, --foldalignlocalpair or --foldalignglobalpair' 1>&2
851                         exit 1
852                 fi
853         fi
854
855         if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
856                 if [ $distance = "scarna" -o $distance = "lara" -o $distance = "slara" -o $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
857                         strategy="X-I"
858                 elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then
859                         strategy="Q-I"
860                 fi
861         elif [ $distance = "fasta" -a $sw -eq 0 ]; then
862                 strategy="F-I"
863         elif [ $distance = "fasta" -a $sw -eq 1 ]; then
864                 strategy="H-I"
865         elif [ $distance = "blast" ]; then
866                 strategy="B-I"
867         elif [ $distance = "global" -o $distance = "distonly" ]; then
868                 strategy="G-I"
869         elif [ $distance = "local" ]; then
870                 strategy="L-I"
871         elif [ $distance = "localgenaf" ]; then
872                 strategy="E-I"
873         elif [ $distance = "globalgenaf" ]; then
874                 strategy="K-I"
875         elif [ $fft -eq 1 ]; then
876                 strategy="FFT-"
877         else
878                 strategy="NW-"
879         fi
880         strategy=$strategy"NS-"
881         if [ $iterate -gt 0 ]; then
882                 strategy=$strategy"i"
883         elif [ $distance = "parttree" ]; then
884                 if [ $partdist = "fasta" ]; then
885                         strategy=$strategy"FastaPartTree-"$cycle
886                 elif [ $partdist = "localalign" ]; then
887                         strategy=$strategy"DPPartTree-"$cycle
888                 else
889                         strategy=$strategy"PartTree-"$cycle
890                 fi
891         else
892                 strategy=$strategy$cycle
893         fi
894
895         explanation='?'
896         performance='Not tested.'
897         if [ $strategy = "F-INS-i" ]; then
898                 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
899                 performance='Most accurate, but very slow'
900         elif [ $strategy = "L-INS-i" ]; then
901                 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
902                 performance='Probably most accurate, very slow'
903         elif [ $strategy = "E-INS-i" ]; then
904                 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment with generalized affine gap costs (Altschul 1998)'
905                 performance='Suitable for sequences with long unalignable regions, very slow'
906         elif [ $strategy = "G-INS-i" ]; then
907                 explanation='Iterative refinement method (<'$iterate') with GLOBAL pairwise alignment information'
908                 performance='Suitable for sequences of similar lengths, very slow'
909         elif [ $strategy = "X-INS-i" ]; then
910                 explanation='RNA secondary structure information is taken into account.'
911                 performance='For short RNA sequences only, extremely slow'
912         elif [ $strategy = "F-INS-1" ]; then
913                 explanation='Progressive method incorporating LOCAL pairwise alignment information'
914         elif [ $strategy = "L-INS-1" ]; then
915                 explanation='Progressive method incorporating LOCAL pairwise alignment information'
916         elif [ $strategy = "G-INS-1" ]; then
917                 explanation='Progressive method incorporating GLOBAL pairwise alignment information'
918         elif [ $strategy = "FFT-NS-i" -o $strategy = "NW-NS-i" ]; then
919                 explanation='Iterative refinement method (max. '$iterate' iterations)'
920                 if [ $iterate -gt 2 ]; then
921                         performance='Accurate but slow'
922                 else
923                         performance='Standard'
924                 fi
925         elif [ $strategy = "FFT-NS-2" -o $strategy = "NW-NS-2" ]; then
926                 explanation='Progressive method (guide trees were built '$cycle' times.)'
927                 performance='Fast but rough'
928         elif [ $strategy = "FFT-NS-1" -o $strategy = "NW-NS-1" ]; then
929                 explanation='Progressive method (rough guide tree was used.)'
930                 performance='Very fast but very rough'
931         fi
932
933         if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
934                 outputopt=" -c $strategy -r order  "
935         elif [ $outputformat = "clustal" -a $outorder = "input" ]; then
936                 outputopt=" -c $strategy  "
937         elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then
938                 outputopt=" -f -r order "
939         else
940                 outputopt="null"
941         fi
942         
943         (
944                 cd $TMPFILE;
945                 if [ $quiet -gt 0 ]; then
946                         if [ $seed != "x" ]; then
947                                 mv infile infile2
948                                 cat /dev/null > infile
949                                 cat /dev/null > hat3.seed
950                                 seedoffset=0
951 #                               echo "seednseq="$seednseq
952 #                               echo "seedoffset="$seedoffset
953                                 set $seednseq > /dev/null
954 #                               echo $#
955                                 while [ $# -gt 1 ]
956                                 do
957                                         shift
958 #                                       echo "num="$#
959                                         "$prefix/multi2hat3s" -t $nseq  -o $seedoffset -i seed$# >> infile 2>/dev/null || exit 1
960                                         cat hat3 >> hat3.seed
961 #                                       echo "$1"
962                                         seedoffset=`expr $seedoffset + $1`
963 #                                       echo "$1"
964 #                                       echo "seedoffset="$seedoffset
965                                 done;
966 #                               echo "seedoffset="$seedoffset
967                                 cat infile2 >> infile
968                         elif [ $seedtable != "x" ]; then
969                                 cat _seedtablefile > hat3.seed
970                         else
971                                 cat /dev/null > hat3.seed
972                         fi
973 #                       cat hat3.seed
974                         if [ $mccaskill -eq 1 ]; then
975                                 "$prefix/mccaskillwrap" -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
976                         elif [ $contrafold -eq 1 ]; then
977                                 "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
978                         fi
979                         if [ $distance = "fasta" ]; then
980                                 "$prefix/dndfast7" $swopt < infile > /dev/null  2>&1      || exit 1
981                                 cat hat3.seed hat3 > hatx
982                                 mv hatx hat3
983                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
984                         elif [ $distance = "blast" ]; then
985                                 "$prefix/dndblast" < infile > /dev/null  2>&1      || exit 1
986                                 cat hat3.seed hat3 > hatx
987                                 mv hatx hat3
988                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
989                         elif [ $distance = "foldalignlocal" ]; then
990                                 "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null  2>&1      || exit 1
991                                 cat hat3.seed hat3 > hatx
992                                 mv hatx hat3
993                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
994                         elif [ $distance = "foldalignglobal" ]; then
995                                 "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $pgexp -f $pggop -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null  2>&1      || exit 1
996                                 cat hat3.seed hat3 > hatx
997                                 mv hatx hat3
998                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
999                         elif [ $distance = "slara" ]; then
1000                                 "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null  2>&1      || exit 1
1001                                 cat hat3.seed hat3 > hatx
1002                                 mv hatx hat3
1003                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1004                         elif [ $distance = "lara" ]; then
1005                                 "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null  2>&1      || exit 1
1006                                 cat hat3.seed hat3 > hatx
1007                                 mv hatx hat3
1008                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1009                         elif [ $distance = "scarna" ]; then
1010                                 "$prefix/pairlocalalign"   $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null  2>&1      || exit 1
1011                                 cat hat3.seed hat3 > hatx
1012                                 mv hatx hat3
1013                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1014                         elif [ $distance = "global" ]; then
1015                                 "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -F < infile > /dev/null  2>&1      || exit 1
1016                                 cat hat3.seed hat3 > hatx
1017                                 mv hatx hat3
1018                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1019                         elif [ $distance = "local" ]; then
1020                                 "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -L < infile > /dev/null  2>&1      || exit 1
1021                                 cat hat3.seed hat3 > hatx
1022                                 mv hatx hat3
1023                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1024                         elif [ $distance = "globalgenaf" ]; then
1025                                 "$prefix/pairlocalalign"   $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null 2>&1    || exit 1
1026                                 cat hat3.seed hat3 > hatx
1027                                 mv hatx hat3
1028                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1029                         elif [ $distance = "localgenaf" ]; then
1030                                 "$prefix/pairlocalalign"   $seqtype $model -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N < infile > /dev/null  2>&1      || exit 1
1031                                 cat hat3.seed hat3 > hatx
1032                                 mv hatx hat3
1033                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1034                         elif [ $distance = "distonly" ]; then
1035                                 "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null  2>&1      || exit 1
1036                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1037                         elif [ $distance = "parttree" ]; then
1038                                 "$prefix/splittbfast" -Q $splitopt $partorderopt $parttreeoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft -p $partsize -s $groupsize $treealg -i infile   > pre 2>/dev/null || exit 1
1039                                 mv hat3.seed hat3
1040                         else
1041                                 "$prefix/disttbfast" $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $algopt $treealg < infile   > pre 2>/dev/null || exit 1
1042                                 mv hat3.seed hat3
1043                         fi
1044                         while [ $cycle -gt 1 ]
1045                         do
1046                                 if [ $distance = "parttree" ]; then
1047                                         mv pre infile
1048                                         "$prefix/splittbfast" -Z -Q $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft -p $partsize -s $groupsize $treealg -i infile   > pre 2>/dev/null || exit 1
1049                                 else
1050                                         "$prefix/tbfast" $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft  $localparam $algopt -J $treealg < pre > /dev/null 2>&1 || exit 1
1051                                 fi
1052                                 cycle=`expr $cycle - 1`
1053                         done
1054                         if [ $iterate -gt 0 ]; then
1055                                 if [ $distance = "sixtuples" ]; then
1056                                     "$prefix/dndpre"       < pre     > /dev/null 2>&1 || exit 1
1057                                 fi
1058                                 "$prefix/dvtditr" $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof  -I $iterate $weightopt $treeinopt $algoptit $treealg < pre     > /dev/null 2>&1 || exit 1
1059                         fi
1060                 else
1061                         if [ $seed != "x" ]; then
1062                                 mv infile infile2
1063                                 cat /dev/null > infile
1064                                 cat /dev/null > hat3.seed
1065                                 seedoffset=0
1066 #                               echo "seednseq="$seednseq
1067 #                               echo "seedoffset="$seedoffset
1068                                 set $seednseq > /dev/null
1069 #                               echo $#
1070                                 while [ $# -gt 1 ]
1071                                 do
1072                                         shift
1073 #                                       echo "num="$#
1074                                         "$prefix/multi2hat3s" -t $nseq  -o $seedoffset -i seed$# >> infile  || exit 1
1075                                         cat hat3 >> hat3.seed
1076 #                                       echo "$1"
1077                                         seedoffset=`expr $seedoffset + $1`
1078 #                                       echo "$1"
1079 #                                       echo "seedoffset="$seedoffset
1080                                 done;
1081 #                               echo "seedoffset="$seedoffset
1082                                 cat infile2 >> infile
1083                         elif [ $seedtable != "x" ]; then
1084                                 cat _seedtablefile > hat3.seed
1085                         else
1086                                 cat /dev/null > hat3.seed
1087                         fi
1088 #                       cat hat3.seed
1089                         if [ $mccaskill -eq 1 ]; then
1090                                 "$prefix/mccaskillwrap" -d "$prefix" -i infile > hat4  || exit 1
1091                         elif [ $contrafold -eq 1 ]; then
1092                                 "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4  || exit 1
1093                         fi
1094                         if [ $distance = "fasta" ]; then
1095                                 "$prefix/dndfast7" $swopt < infile > /dev/null     || exit 1
1096                                 cat hat3.seed hat3 > hatx
1097                                 mv hatx hat3
1098                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1099                         elif [ $distance = "blast" ]; then
1100                                 "$prefix/dndblast" < infile > /dev/null     || exit 1
1101                                 cat hat3.seed hat3 > hatx
1102                                 mv hatx hat3
1103                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1104                         elif [ $distance = "foldalignlocal" ]; then
1105                                 "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null || exit 1
1106                                 cat hat3.seed hat3 > hatx
1107                                 mv hatx hat3
1108                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1109                         elif [ $distance = "foldalignglobal" ]; then
1110                                 "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $pgexp -f $pggop  -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null || exit 1
1111                                 cat hat3.seed hat3 > hatx
1112                                 mv hatx hat3
1113                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1114                         elif [ $distance = "slara" ]; then
1115                                 "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null || exit 1
1116                                 cat hat3.seed hat3 > hatx
1117                                 mv hatx hat3
1118                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1119                         elif [ $distance = "lara" ]; then
1120                                 "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null || exit 1
1121                                 cat hat3.seed hat3 > hatx
1122                                 mv hatx hat3
1123                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1124                         elif [ $distance = "scarna" ]; then
1125                                 "$prefix/pairlocalalign"   $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null   || exit 1
1126                                 cat hat3.seed hat3 > hatx
1127                                 mv hatx hat3
1128                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
1129                         elif [ $distance = "global" ]; then
1130                                 "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof   -F  < infile > /dev/null     || exit 1
1131                                 cat hat3.seed hat3 > hatx
1132                                 mv hatx hat3
1133                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1134                         elif [ $distance = "local" ]; then
1135                                 "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -L  < infile > /dev/null     || exit 1
1136                                 cat hat3.seed hat3 > hatx
1137                                 mv hatx hat3
1138                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1139                         elif [ $distance = "globalgenaf" ]; then
1140                                 "$prefix/pairlocalalign"   $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null     || exit 1
1141                                 cat hat3.seed hat3 > hatx
1142                                 mv hatx hat3
1143                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1144                         elif [ $distance = "localgenaf" ]; then
1145                                 "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N  < infile > /dev/null     || exit 1
1146                                 cat hat3.seed hat3 > hatx
1147                                 mv hatx hat3
1148                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1149                         elif [ $distance = "distonly" ]; then
1150                                 "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null            || exit 1
1151                                 "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
1152                         elif [ $distance = "parttree" ]; then
1153                                 "$prefix/splittbfast" -Q $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft -p $partsize -s $groupsize $treealg -i infile   > pre || exit 1
1154                                 mv hat3.seed hat3
1155                         else
1156                                 "$prefix/disttbfast" $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft  $algopt $treealg < infile   > pre || exit 1
1157                                 mv hat3.seed hat3
1158                         fi
1159
1160                         while [ $cycle -gt 1 ]
1161                         do
1162                                 if [ $distance = "parttree" ]; then
1163                                         mv pre infile
1164                                         "$prefix/splittbfast" -Z -Q $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft -p $partsize -s $groupsize $treealg -i infile  > pre || exit 1
1165                                 else
1166                                         "$prefix/tbfast" $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft $localparam $algopt -J $treealg < pre > /dev/null || exit 1
1167                                 fi
1168                                 cycle=`expr $cycle - 1`
1169                         done
1170                         if [ $iterate -gt 0 ]; then
1171                                 if [ $distance = "sixtuples" ]; then
1172                                 "$prefix/dndpre"       < pre     > /dev/null 2>&1 || exit 1
1173                                 fi
1174                                 "$prefix/dvtditr" $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof -I $iterate $weightopt $treeinopt $algoptit $treealg < pre     > /dev/null || exit 1
1175                         fi
1176                 fi
1177
1178
1179
1180                 if [ $coreout -eq 1 ]; then
1181                         "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2
1182                         mv pre2 pre
1183                 fi
1184                 if [ "$outputopt" = "null" ]; then
1185                         cat < pre || exit 1
1186                 else
1187                         "$prefix/f2cl" $outputopt < pre || exit 1
1188                 fi
1189         )
1190
1191         if [ $treeout -eq 1 ]; then
1192                 cp $TMPFILE/infile.tree "$infilename.tree"
1193         fi
1194
1195         if [ $distout -eq 1 ]; then
1196                 cp $TMPFILE/hat2 "$infilename.hat2"
1197         fi
1198
1199         if [ $quiet -eq 0 ]; then
1200                 echo '' 1>&2
1201                 if [ $mccaskill -eq 1 ]; then
1202                         echo "RNA base pairing probaility was calculated by the McCaskill algorithm (1)" 1>&2
1203                         echo "implemented in Vienna RNA package (2) and MXSCARNA (3), and then" 1>&2
1204                         echo "incorporated in the iterative alignment process (4)." 1>&2
1205                         echo "(1) McCaskill, 1990, Biopolymers 29:1105-1119" 1>&2
1206                         echo "(2) Hofacker et al., 2002, J. Mol. Biol. 319:3724-3732" 1>&2
1207                         echo "(3) Tabei et al., 2008, BMC Bioinformatics 9:33" 1>&2
1208                         echo "(4) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
1209                         echo "" 1>&2
1210                 elif [ $contrafold -eq 1 ]; then
1211                         echo "RNA base pairing probaility was calculated by the CONTRAfold algorithm (1)" 1>&2
1212                         echo "and then incorporated in the iterative alignment process (4)." 1>&2
1213                         echo "(1) Do et al., 2006, Bioinformatics 22:e90-98" 1>&2
1214                         echo "(2) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
1215                         echo "" 1>&2
1216                 fi
1217                 if [ $distance = "fasta" -o $partdist = "fasta" ]; then
1218                         echo "Pairwise alignments were computed by FASTA" 1>&2
1219                         echo "(Pearson & Lipman, 1988, PNAS 85:2444-2448)" 1>&2
1220                 fi
1221                 if [ $distance = "blast" ]; then
1222                         echo "Pairwise alignments were computed by BLAST" 1>&2
1223                         echo "(Altschul et al., 1997, NAR 25:3389-3402)" 1>&2
1224                 fi
1225                 if [ $distance = "scarna" ]; then
1226                         echo "Pairwise alignments were computed by MXSCARNA" 1>&2
1227                         echo "(Tabei et al., 2008, BMC Bioinformatics 9:33)." 1>&2
1228                 fi
1229                 if [ $distance = "lara" -o $distance = "slara" ]; then
1230                         echo "Pairwise alignments were computed by LaRA" 1>&2
1231                         echo "(Bauer et al., 2007, BMC Bioinformatics 8:271)." 1>&2
1232                 fi
1233                 if [ $distance = "foldalignlocal" ]; then
1234                         echo "Pairwise alignments were computed by FOLDALIGN (local)" 1>&2
1235                         echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
1236                 fi
1237                 if [ $distance = "foldalignglobal" ]; then
1238                         echo "Pairwise alignments were computed by FOLDALIGN (global)" 1>&2
1239                         echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
1240                 fi
1241                 printf "\n" 1>&2
1242                 echo 'Strategy:' 1>&2
1243                 printf ' '$strategy 1>&2
1244                 echo ' ('$performance')' 1>&2
1245                 echo ' '$explanation 1>&2
1246                 echo '' 1>&2
1247                 echo "If unsure which option to use, try 'mafft --auto input > output'." 1>&2
1248 #               echo "If long gaps are expected, try 'mafft --ep 0.0 --auto input > output'." 1>&2
1249                 echo "If the possibility of long gaps can be excluded, add '--ep 0.123'." 1>&2
1250                 echo "For more information, see 'mafft --help', 'mafft --man' and the mafft page." 1>&2
1251                 echo '' 1>&2
1252         fi
1253         exit 0;
1254 fi
1255
1256 prog="awk"
1257
1258 tmpawk=`which nawk 2>/dev/null | awk '{print $1}'`
1259 if [ -x "$tmpawk" ]; then
1260         prog="$tmpawk"
1261 fi
1262
1263 tmpawk=`which gawk 2>/dev/null | awk '{print $1}'`
1264 if [ -x "$tmpawk" ]; then
1265         prog="$tmpawk"
1266 fi
1267
1268 echo "prog="$prog 1>&2
1269
1270 umask 077
1271 export defaultaof
1272 export defaultgop
1273 export defaultfft
1274 export defaultcycle
1275 export defaultiterate
1276 (
1277 $prog '
1278 BEGIN {
1279         prefix = ENVIRON["prefix"];
1280         version = ENVIRON["version"];
1281         myself = ENVIRON["myself"];
1282         defaultgop = ENVIRON["defaultgop"]
1283         defaultaof = ENVIRON["defaultaof"]
1284         defaultfft = ENVIRON["defaultfft"]
1285         defaultcycle = ENVIRON["defaultcycle"]
1286         defaultiterate = ENVIRON["defaultiterate"]
1287         while( 1 )
1288         {
1289                 options = ""
1290                 printf( "\n" ) > "/dev/tty";
1291                 printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
1292                 printf( "\n" )                                                                           > "/dev/tty";
1293                 printf( "   MAFFT %s\n", version )                                                       > "/dev/tty";
1294                 printf( "\n" )                                                                           > "/dev/tty";
1295                 printf( "        Copyright (c) 2009 Kazutaka Katoh\n" )                                  > "/dev/tty";
1296                 printf( "        NAR 30:3059-3066, NAR 33:511-518\n" )                                   > "/dev/tty";
1297                 printf( "        http://align.bmr.kyushu-u.ac.jp/mafft/software/\n" )       > "/dev/tty";
1298                 printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
1299                 printf( "\n" ) > "/dev/tty";
1300         
1301                 while( 1 )
1302                 {
1303                         printf( "\n" ) > "/dev/tty";
1304                         printf( "Input file? (fasta format)\n@ " ) > "/dev/tty";
1305                         res = getline < "/dev/tty";
1306                         close( "/dev/tty" )
1307                         if( res == 0 || NF == 0 )
1308                                 continue;
1309                         infile0 = sprintf( "%s", $1 );
1310                         infile = sprintf( "%s", $1 );
1311         
1312                         res = getline < infile;
1313                         close( infile );
1314                         if( res == -1 )
1315                                 printf( "%s: No such file.\n\n", infile ) > "/dev/tty";
1316                         else if( res == 0 )
1317                                 printf( "%s: Empty.\n", infile ) > "/dev/tty";
1318                         else
1319                         {
1320                                 printf( "OK. infile = %s\n\n", infile ) > "/dev/tty";
1321                                 break;
1322                         }
1323                 }
1324                 nseq = 0;
1325         
1326                 while( 1 )
1327                 {
1328                         printf( "\n" ) > "/dev/tty";
1329                         printf( "Output file?\n" ) > "/dev/tty";
1330                         printf( "@ " ) > "/dev/tty";
1331                         res = getline < "/dev/tty";
1332                         close( "/dev/tty" );
1333                         if( res == 0 || NF == 0 )
1334                                 continue;
1335                         else
1336                         {
1337                                 outfile = sprintf( "%s", $1 );
1338                                 printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
1339                                 break;
1340                         }
1341                 }
1342         
1343         
1344                 while( 1 )
1345                 {
1346                         retree = defaultcycle
1347                         printf( "\n" ) > "/dev/tty";
1348                         printf( "Number of tree-rebuilding?\n" ) > "/dev/tty";
1349                         printf( "@ [%d] ", retree ) > "/dev/tty";
1350                         res = getline < "/dev/tty";
1351                         close( "/dev/tty" );
1352                         if( res == 0 )
1353                                 continue;
1354                         else if( NF == 0 )
1355                                 ;
1356                         else
1357                                 retree = 0 + $1;
1358                         if( retree < 1 || 10 < retree )
1359                                 ;
1360                         else
1361                         {
1362                                 printf( "OK. %d\n\n", retree ) > "/dev/tty";
1363                                 break;
1364                         }
1365                 }
1366         
1367                 while( 1 )
1368                 {
1369                         niterate = defaultiterate;
1370                         printf( "\n" ) > "/dev/tty";
1371                         printf( "Maximum number of iterations?\n" ) > "/dev/tty";
1372                         printf( "@ [%d] ", niterate ) > "/dev/tty";
1373                         res = getline < "/dev/tty";
1374                         close( "/dev/tty" );
1375                         if( res == 0 )
1376                                 continue;
1377                         else if( NF == 0 )
1378                                 ;
1379                         else
1380                                 niterate = 0 + $1;
1381                         if( niterate < 0 || 1000 < niterate )
1382                                 ;
1383                         else
1384                         {
1385                                 printf( "OK. %d\n\n", niterate ) > "/dev/tty";
1386                                 break;
1387                         }
1388                 }
1389
1390                 while( 1 )
1391                 {
1392                         fft = defaultfft;
1393                         printf( "\n" ) > "/dev/tty";
1394                         printf( "Use fft?\n" ) > "/dev/tty";
1395                         printf( "@ [%s] ", fft?"Yes":"No" ) > "/dev/tty";
1396                         res = getline < "/dev/tty";
1397                         close( "/dev/tty" );
1398                         if( res == 0 )
1399                                 continue;
1400                         else if( NF == 0 )
1401                         {
1402                                 break;
1403                         }
1404                         else if( NF == 0 || $0 ~ /^[Yy]/ )
1405                         {
1406                                 fft = 1;
1407                                 break;
1408                         }
1409                         else if( NF == 0 || $0 ~ /^[Nn]/ )
1410                         {
1411                                 fft = 0;
1412                                 break;
1413                         }
1414                 }
1415                 if( fft )
1416                 {
1417                                 printf( "OK. FFT is enabled.\n\n" ) > "/dev/tty";
1418                                 fftparam = " ";
1419                 }
1420                 else
1421                 {
1422                                 printf( "OK. FFT is disabled.\n\n" ) > "/dev/tty";
1423                                 fftparam = " --nofft ";
1424                 }
1425
1426                 while( 1 )
1427                 {
1428                         scoringmatrix = 3;
1429                         printf( "\n" ) > "/dev/tty";
1430                         printf( "Scoring matrix? (ignored when DNA sequence is input.)\n" ) > "/dev/tty";
1431                         printf( " 1. BLOSUM 30\n" ) > "/dev/tty";
1432                         printf( " 2. BLOSUM 45\n" ) > "/dev/tty";
1433                         printf( " 3. BLOSUM 62\n" ) > "/dev/tty";
1434                         printf( " 4. BLOSUM 80\n" ) > "/dev/tty";
1435                         printf( " 5. JTT 200\n" ) > "/dev/tty";
1436                         printf( " 6. JTT 100\n" ) > "/dev/tty";
1437                         printf( "@ [%d] ", scoringmatrix ) > "/dev/tty";
1438                         res = getline < "/dev/tty";
1439                         close( "/dev/tty" );
1440                         if( res == 0 )
1441                                 continue;
1442                         else if( NF == 0 )
1443                                 ;
1444                         else
1445                                 scoringmatrix = 0 + $1;
1446                         if( scoringmatrix < 1 || 6 < scoringmatrix )
1447                                 ;
1448                         else
1449                         {
1450                                 break;
1451                         }
1452                 }
1453                 if( scoringmatrix == 1 )
1454                         scoringparam = " --bl 30 ";
1455                 else if( scoringmatrix == 2 )
1456                         scoringparam = " --bl 45 ";
1457                 else if( scoringmatrix == 3 )
1458                         scoringparam = " --bl 62 ";
1459                 else if( scoringmatrix == 4 )
1460                         scoringparam = " --bl 80 ";
1461                 else if( scoringmatrix == 5 )
1462                         scoringparam = " --jtt 200 ";
1463                 else if( scoringmatrix == 6 )
1464                         scoringparam = " --jtt 100 ";
1465                 printf( "OK. %s\n\n",scoringparam ) > "/dev/tty";
1466         
1467                 while( 1 )
1468                 {
1469                         penalty = 0.0 + defaultgop;
1470                         offset = 0.0 + defaultaof;
1471                         printf( "\n" ) > "/dev/tty";
1472                         printf( "Parameters (gap opening penalty, offset)?\n", penalty, offset ) > "/dev/tty";
1473                         printf( "@ [%5.3f, %5.3f] ", penalty, offset ) > "/dev/tty";
1474                         res = getline < "/dev/tty";
1475                         close( "/dev/tty" );
1476                         if( res == 0 )
1477                                 continue;
1478                         else if( NF == 2 )
1479                         {
1480                                 penalty = 0.0 + $1;
1481                                 offset = 0.0 + $2;
1482                         }
1483                         else if( NF == 0 )
1484                                 ;
1485                         else
1486                                 continue;
1487                         if( penalty < 0.0 || 10.0 < penalty )
1488                                 ;
1489                         else if( offset < 0.0 || 10.0 < offset )
1490                                 ;
1491                         else
1492                         {
1493                                 printf( "OK. %5.3f %5.3f\n\n", penalty, offset ) > "/dev/tty";
1494                                 break;
1495                         }
1496                 }
1497         
1498                 command = sprintf( "%s %s --retree %d --maxiterate %d %s --op %f --ep %f %s > %s", myself, fftparam, retree, niterate, scoringparam, penalty, offset, infile, outfile );
1499                 printf( "%s\n\n", command ) > "/dev/tty";
1500         
1501         
1502                 while( 1 )
1503                 {
1504                         go = 0;
1505                         printf( "\n" ) > "/dev/tty";
1506                         printf( "OK?\n" ) > "/dev/tty";
1507                         printf( "@ [Y] " ) > "/dev/tty";
1508                         res = getline < "/dev/tty";
1509                         close( "/dev/tty" );
1510                         if( res == 0 )
1511                                 continue;
1512                         else if( NF == 0 || $0 ~ /^[Yy]/ )
1513                         {
1514                                 go=1;
1515                                 break;
1516                         }
1517                         else
1518                                 break;
1519                 }
1520                 if( go ) break;
1521                 printf( "\n" ) > "/dev/tty";
1522                 printf( "\n" ) > "/dev/tty";
1523         }
1524         system( command );
1525         printf( "Press Enter to exit." ) > "/dev/tty";
1526         res = getline < "/dev/tty";
1527 }
1528 '
1529 )
1530 exit 0;