5 myself=`dirname $0`/`basename $0`; export myself
6 version="v6.713b (2009/09/24)"; export version
10 if [ `echo $os | grep -i cygwin` ]; then
12 elif [ `echo $os | grep -i darwin` ]; then
14 elif [ `echo $os | grep -i sunos` ]; then
21 if [ "$MAFFT_BINARIES" ]; then
22 prefix="$MAFFT_BINARIES"
29 if [ "$1" = "--man" ]; then
35 if [ ! -x "$prefix/tbfast" ]; then
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
54 defaultdistance="sixtuples"
55 #defaultdistance="local"
63 defaultsbstmodel=" -b 62 "
66 if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then
70 defaultdistance="scarna"
77 defaultalgoptit=" -AB " ## chui
79 defaultsbstmodel=" -b 62 "
82 elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then
86 defaultdistance="global"
93 defaultalgoptit=" -AB " ## chui
95 defaultsbstmodel=" -b 62 "
98 elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then
102 defaultdistance="local"
103 elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then
107 defaultdistance="global"
108 elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then
112 defaultdistance="localgenaf"
113 elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then
116 defaultdistance="sixtuples"
117 elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then
121 defaultdistance="sixtuples"
122 elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then
125 defaultdistance="sixtuples"
126 elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
130 defaultdistance="sixtuples"
133 sbstmodel=$defaultsbstmodel
134 fmodel=$defaultfmodel
138 iterate=$defaultiterate
141 distance=$defaultdistance
158 weighti=$defaultweighti
159 weightr=$defaultweightr
160 weightm=$defaultweightm
162 mccaskill=$defaultmccaskill
163 contrafold=$defaultcontrafold
167 algopt=$defaultalgopt
168 algoptit=$defaultalgoptit
188 seedfiles="/dev/null"
189 seedtablefile="/dev/null"
191 treeinfile="/dev/null"
193 laraparams="/dev/null"
196 if [ $# -gt 0 ]; then
199 if [ "$1" = "--auto" ]; then
201 elif [ "$1" = "--clustalout" ]; then
202 outputformat="clustal"
203 elif [ "$1" = "--reorder" ]; then
206 elif [ "$1" = "--inputorder" ]; then
209 elif [ "$1" = "--unweight" ]; then
211 elif [ "$1" = "--algq" ]; then
214 elif [ "$1" = "--groupsize" ]; then
216 groupsize=`expr "$1" - 0`
217 elif [ "$1" = "--partsize" ]; then
219 partsize=`expr "$1" - 0`
220 elif [ "$1" = "--parttree" ]; then
223 elif [ "$1" = "--dpparttree" ]; then
225 partdist="localalign"
226 elif [ "$1" = "--fastaparttree" ]; then
229 elif [ "$1" = "--treeout" ]; then
231 elif [ "$1" = "--distout" ]; then
233 elif [ "$1" = "--fastswpair" ]; then
236 elif [ "$1" = "--fastapair" ]; then
239 elif [ "$1" = "--averagelinkage" ]; then
241 elif [ "$1" = "--minimumlinkage" ]; then
243 elif [ "$1" = "--noscore" ]; then
245 elif [ "$1" = "--6merpair" ]; then
247 elif [ "$1" = "--blastpair" ]; then
249 elif [ "$1" = "--globalpair" ]; then
251 elif [ "$1" = "--localpair" ]; then
253 elif [ "$1" = "--scarnapair" ]; then
255 elif [ "$1" = "--larapair" ]; then
257 elif [ "$1" = "--slarapair" ]; then
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
275 elif [ "$1" = "--nuc" ]; then
277 elif [ "$1" = "--amino" ]; then
279 elif [ "$1" = "--fft" ]; then
282 elif [ "$1" = "--nofft" ]; then
284 elif [ "$1" = "--quiet" ]; then
286 elif [ "$1" = "--debug" ]; then
288 elif [ "$1" = "--coreext" ]; then
290 elif [ "$1" = "--core" ]; then
292 elif [ "$1" = "--maxiterate" ]; then
294 iterate=`expr "$1" - 0`
295 elif [ "$1" = "--retree" ]; then
297 cycle=`expr "$1" - 0`
298 elif [ "$1" = "--aamatrix" ]; then
302 elif [ "$1" = "--treein" ]; then
307 elif [ "$1" = "--topin" ]; then
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
316 elif [ "$1" = "--kappa" ]; then
319 elif [ "$1" = "--fmodel" ]; then
321 elif [ "$1" = "--jtt" ]; then
324 elif [ "$1" = "--kimura" ]; then
327 elif [ "$1" = "--tm" ]; then
330 elif [ "$1" = "--bl" ]; then
333 elif [ "$1" = "--weighti" ]; then
336 elif [ "$1" = "--weightr" ]; then
339 elif [ "$1" = "--weightm" ]; then
342 elif [ "$1" = "--rnaalifold" ]; then
344 elif [ "$1" = "--mccaskill" ]; then
347 elif [ "$1" = "--contrafold" ]; then
350 elif [ "$1" = "--ribosum" ]; then
352 elif [ "$1" = "--op" ]; then
355 elif [ "$1" = "--ep" ]; then
358 elif [ "$1" = "--rop" ]; then
361 elif [ "$1" = "--rep" ]; then
364 elif [ "$1" = "--lop" ]; then
367 elif [ "$1" = "--LOP" ]; then
370 elif [ "$1" = "--lep" ]; then
373 elif [ "$1" = "--lexp" ]; then
376 elif [ "$1" = "--LEXP" ]; then
379 elif [ "$1" = "--GEXP" ]; then
382 elif [ "$1" = "--GOP" ]; then
385 elif [ "$1" = "--gop" ]; then
388 elif [ "$1" = "--gep" ]; then
391 elif [ "$1" = "--gexp" ]; then
394 elif [ "$1" = "--laraparams" ]; then
397 elif [ "$1" = "--corethr" ]; then
400 elif [ "$1" = "--corewin" ]; then
403 elif [ "$1" = "--seedtable" ]; then
407 elif [ "$1" = "--seed" ]; then
410 seedfiles="$seedfiles $1"
411 elif [ $progname = "fftns" -o $progname = "nwns" ]; then
412 if [ "$1" -gt 0 ]; then
413 cycle=`expr "$1" - 0`
416 echo "Unknown option: $1" 1>&2
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`
431 # mkdir $TMPFILE || er=1
432 if [ $debug -eq 1 ]; then
433 trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0
435 trap "rm -rf $TMPFILE " 0
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
446 seedfilesintmp="/dev/null"
448 set $seedfiles > /dev/null
452 cat "$1" | tr "\r" "\n" > $TMPFILE/seed$#
453 seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#`
454 seedfilesintmp=$seedfilesintmp" "seed$#
457 # echo $seedfilesintmp
460 echo "$0": Cannot open "$1". 1>&2
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
477 elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
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
492 if [ $iterate -gt 16 ]; then #??
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 "
509 model="$sbstmodel $kappa $fmodel"
511 if [ $er -eq 1 ]; then
512 echo "------------------------------------------------------------------------------" 1>&2
513 echo " MAFFT" $version 1>&2
515 # echo " Input format: fasta" 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
524 echo "High speed:" 1>&2
525 echo " % mafft in > out" 1>&2
526 echo " % mafft --retree 1 in > out (fastest)" 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
533 echo "If unsure which option to use:" 1>&2
534 echo " % mafft --auto in > out" 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
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
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
550 # echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2
551 # echo " suitable for globally alignable sequences " 1>&2
553 # echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2
554 # echo " accurate and slow, iterative refinement method " 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
559 # echo "If many (~5,000) sequences are to be aligned," 1>&2
561 # echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 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
579 # echo " --fft or --nofft: FFT is enabled or disabled, default: disabled" 1>&2
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
589 if [ $sw -eq 1 ]; then
595 if [ $distance = "fasta" -o $partdist = "fasta" ]; then
596 if [ ! "$FASTA_4_MAFFT" ]; then
597 FASTA_4_MAFFT=`which fasta34`
600 if [ ! -x "$FASTA_4_MAFFT" ]; then
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
612 if [ $distance = "lara" -o $distance = "slara" ]; then
613 if [ ! -x "$prefix/mafft_lara" ]; then
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
626 if [ ! -s "$laraparams" ]; then
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
637 if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
638 if [ ! -x "$prefix/foldalign210" ]; then
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
649 if [ $distance = "scarna" ]; then
650 if [ ! -x "$prefix/mxscarnamod" ]; then
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
662 if [ $mccaskill -eq 1 ]; then
663 if [ ! -x "$prefix/mxscarnamod" ]; then
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
675 if [ $contrafold -eq 1 ]; then
676 if [ ! -x "$prefix/contrafold" ]; then
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
690 # if [ $treeout -eq 1 ]; then
691 # parttreeoutopt="-t"
692 # if [ $cycle -eq 0 ]; then
696 # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
697 # distance="distonly"
704 # if [ $cycle -eq 0 ]; then
707 # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
708 # distance="distonly"
716 if [ $cycle -eq 0 ]; then
719 if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
722 if [ $treeout -eq 1 ]; then
728 if [ $distout -eq 1 ]; then
732 if [ $treeout -eq 1 ]; then
739 if [ $distout -eq 1 ]; then
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
754 nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 `
755 if [ $nseq -eq 2 ]; then
758 if [ $cycle -gt 3 ]; then
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
769 if [ $distance = "sixtuples" -a \( $seed = "x" -a $seedtable = "x" \) ]; then
771 elif [ $distance = "sixtuples" -a \( $seed != "x" -o $seedtable != "x" \) ]; then
772 if [ $cycle -lt 2 ]; then
775 localparam="-l "$weighti
776 elif [ $distance = "parttree" ]; then
778 if [ $groupsize -gt -1 ]; then
782 localparam=" -l "$weighti
783 if [ $cycle -gt 1 ]; then # 09/01/08
788 if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
792 if [ "$memopt" == " -M -B " -a "$distance" != "sixtuples" ]; then
793 echo "Impossible" 1>&2
798 if [ $distance = "parttree" ]; then
799 if [ $seed != "x" -o $seedtable != "x" ]; then
800 echo "Impossible" 1>&2
803 if [ $iterate -gt 1 ]; then
804 echo "Impossible" 1>&2
807 if [ $outorder = "aligned" ]; then
810 outorder="input" # partorder ga kiku
811 if [ $partdist = "localalign" ]; then
812 splitopt=" -L " # -L -l -> fast
813 elif [ $partdist = "fasta" ]; then
821 # if [ $nseq -gt 5000 ]; then
824 if [ $forcefft -eq 1 ]; then
827 elif [ $fft -eq 1 ]; then
833 if [ $seed != "x" -a $seedtable != "x" ]; then
834 echo 'Use either one of seedtable and seed. Not both.' 1>&2
838 if [ $treein -eq 1 ]; then
839 # if [ $iterate -gt 0 ]; then
840 # echo 'Not supported yet.' 1>&2
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
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
858 elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then
861 elif [ $distance = "fasta" -a $sw -eq 0 ]; then
863 elif [ $distance = "fasta" -a $sw -eq 1 ]; then
865 elif [ $distance = "blast" ]; then
867 elif [ $distance = "global" -o $distance = "distonly" ]; then
869 elif [ $distance = "local" ]; then
871 elif [ $distance = "localgenaf" ]; then
873 elif [ $distance = "globalgenaf" ]; then
875 elif [ $fft -eq 1 ]; then
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
889 strategy=$strategy"PartTree-"$cycle
892 strategy=$strategy$cycle
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'
923 performance='Standard'
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'
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 "
945 if [ $quiet -gt 0 ]; then
946 if [ $seed != "x" ]; then
948 cat /dev/null > infile
949 cat /dev/null > hat3.seed
951 # echo "seednseq="$seednseq
952 # echo "seedoffset="$seedoffset
953 set $seednseq > /dev/null
959 "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile 2>/dev/null || exit 1
960 cat hat3 >> hat3.seed
962 seedoffset=`expr $seedoffset + $1`
964 # echo "seedoffset="$seedoffset
966 # echo "seedoffset="$seedoffset
967 cat infile2 >> infile
968 elif [ $seedtable != "x" ]; then
969 cat _seedtablefile > hat3.seed
971 cat /dev/null > 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
979 if [ $distance = "fasta" ]; then
980 "$prefix/dndfast7" $swopt < infile > /dev/null 2>&1 || exit 1
981 cat hat3.seed hat3 > hatx
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
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
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
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
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
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
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
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
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
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
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
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
1044 while [ $cycle -gt 1 ]
1046 if [ $distance = "parttree" ]; then
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
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
1052 cycle=`expr $cycle - 1`
1054 if [ $iterate -gt 0 ]; then
1055 if [ $distance = "sixtuples" ]; then
1056 "$prefix/dndpre" < pre > /dev/null 2>&1 || exit 1
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
1061 if [ $seed != "x" ]; then
1063 cat /dev/null > infile
1064 cat /dev/null > hat3.seed
1066 # echo "seednseq="$seednseq
1067 # echo "seedoffset="$seedoffset
1068 set $seednseq > /dev/null
1074 "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile || exit 1
1075 cat hat3 >> hat3.seed
1077 seedoffset=`expr $seedoffset + $1`
1079 # echo "seedoffset="$seedoffset
1081 # echo "seedoffset="$seedoffset
1082 cat infile2 >> infile
1083 elif [ $seedtable != "x" ]; then
1084 cat _seedtablefile > hat3.seed
1086 cat /dev/null > 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
1094 if [ $distance = "fasta" ]; then
1095 "$prefix/dndfast7" $swopt < infile > /dev/null || exit 1
1096 cat hat3.seed hat3 > hatx
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
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
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
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
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
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
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
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
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
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
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
1156 "$prefix/disttbfast" $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h "-"$aof $param_fft $algopt $treealg < infile > pre || exit 1
1160 while [ $cycle -gt 1 ]
1162 if [ $distance = "parttree" ]; then
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
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
1168 cycle=`expr $cycle - 1`
1170 if [ $iterate -gt 0 ]; then
1171 if [ $distance = "sixtuples" ]; then
1172 "$prefix/dndpre" < pre > /dev/null 2>&1 || exit 1
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
1180 if [ $coreout -eq 1 ]; then
1181 "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2
1184 if [ "$outputopt" = "null" ]; then
1187 "$prefix/f2cl" $outputopt < pre || exit 1
1191 if [ $treeout -eq 1 ]; then
1192 cp $TMPFILE/infile.tree "$infilename.tree"
1195 if [ $distout -eq 1 ]; then
1196 cp $TMPFILE/hat2 "$infilename.hat2"
1199 if [ $quiet -eq 0 ]; then
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
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
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
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
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
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
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
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
1242 echo 'Strategy:' 1>&2
1243 printf ' '$strategy 1>&2
1244 echo ' ('$performance')' 1>&2
1245 echo ' '$explanation 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
1258 tmpawk=`which nawk 2>/dev/null | awk '{print $1}'`
1259 if [ -x "$tmpawk" ]; then
1263 tmpawk=`which gawk 2>/dev/null | awk '{print $1}'`
1264 if [ -x "$tmpawk" ]; then
1268 echo "prog="$prog 1>&2
1275 export defaultiterate
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"]
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";
1303 printf( "\n" ) > "/dev/tty";
1304 printf( "Input file? (fasta format)\n@ " ) > "/dev/tty";
1305 res = getline < "/dev/tty";
1307 if( res == 0 || NF == 0 )
1309 infile0 = sprintf( "%s", $1 );
1310 infile = sprintf( "%s", $1 );
1312 res = getline < infile;
1315 printf( "%s: No such file.\n\n", infile ) > "/dev/tty";
1317 printf( "%s: Empty.\n", infile ) > "/dev/tty";
1320 printf( "OK. infile = %s\n\n", infile ) > "/dev/tty";
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 )
1337 outfile = sprintf( "%s", $1 );
1338 printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
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" );
1358 if( retree < 1 || 10 < retree )
1362 printf( "OK. %d\n\n", retree ) > "/dev/tty";
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" );
1381 if( niterate < 0 || 1000 < niterate )
1385 printf( "OK. %d\n\n", niterate ) > "/dev/tty";
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" );
1404 else if( NF == 0 || $0 ~ /^[Yy]/ )
1409 else if( NF == 0 || $0 ~ /^[Nn]/ )
1417 printf( "OK. FFT is enabled.\n\n" ) > "/dev/tty";
1422 printf( "OK. FFT is disabled.\n\n" ) > "/dev/tty";
1423 fftparam = " --nofft ";
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" );
1445 scoringmatrix = 0 + $1;
1446 if( scoringmatrix < 1 || 6 < scoringmatrix )
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";
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" );
1487 if( penalty < 0.0 || 10.0 < penalty )
1489 else if( offset < 0.0 || 10.0 < offset )
1493 printf( "OK. %5.3f %5.3f\n\n", penalty, offset ) > "/dev/tty";
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";
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" );
1512 else if( NF == 0 || $0 ~ /^[Yy]/ )
1521 printf( "\n" ) > "/dev/tty";
1522 printf( "\n" ) > "/dev/tty";
1525 printf( "Press Enter to exit." ) > "/dev/tty";
1526 res = getline < "/dev/tty";