4 myself=`dirname "$0"`/`basename "$0"`; export myself
5 version="v7.310 (2017/Mar/17)"; export version
8 progname=`basename "$0"`
9 if [ `echo $os | grep -i cygwin` ]; then
11 elif [ `echo $os | grep -i mingw` ]; then
13 elif [ `echo $os | grep -i darwin` ]; then
15 elif [ `echo $os | grep -i sunos` ]; then
17 elif [ `echo $os | grep -i linux` ]; then
24 if [ "$MAFFT_BINARIES" ]; then
25 prefix="$MAFFT_BINARIES"
27 prefix=/usr/local/libexec/mafft
32 if [ "$1" = "--man" ]; then
38 if [ -x "$prefix/version" ]; then
39 versionbin=`"$prefix/version"` # for cygwin 2.7
44 if ! expr "$version" : v"$versionbin" > /dev/null ; then
46 echo "v$versionbin != $version" 1>&2
48 echo "There is a problem in the configuration of your shell." 1>&2
49 echo "Check the MAFFT_BINARIES environmental variable by" 1>&2
50 echo "$ echo \$MAFFT_BINARIES" 1>&2
52 echo "This variable must be *unset*, unless you have installed MAFFT" 1>&2
53 echo "with a special configuration. To unset this variable, type" 1>&2
54 echo "$ unset MAFFT_BINARIES" 1>&2
56 echo "% unsetenv MAFFT_BINARIES" 1>&2
57 echo "Then retry" 1>&2
58 echo "$ mafft input > output" 1>&2
60 echo "To keep this change permanently, edit setting files" 1>&2
61 echo "(.bash_profile, .profile, .cshrc, etc) in your home directory" 1>&2
62 echo "to delete the MAFFT_BINARIES line." 1>&2
63 echo "On MacOSX, also edit or remove the .MacOSX/environment.plist file" 1>&2
64 echo "and then re-login (MacOSX 10.6) or reboot (MacOSX 10.7)." 1>&2
66 echo "Please send a problem report to kazutaka.katoh@aist.go.jp," 1>&2
67 echo "if this problem remains." 1>&2
82 defaultdistance="ktuples"
83 #defaultdistance="local"
92 defaultsbstmodel=" -b 62 "
95 if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then
99 defaultdistance="scarna"
107 defaultalgoptit=" -AB " ## chui
109 defaultsbstmodel=" -b 62 "
111 defaultfmodel=" " # 2013/06/18
112 elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then
116 defaultdistance="global"
124 defaultalgoptit=" -AB " ## chui
126 defaultsbstmodel=" -b 62 "
128 defaultfmodel=" " # 2013/06/18
129 elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then
133 defaultdistance="local"
134 elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then
138 defaultdistance="global"
139 elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then
143 defaultdistance="localgenaf"
144 elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then
147 defaultdistance="ktuples"
148 elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then
152 defaultdistance="ktuples"
153 elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then
156 defaultdistance="ktuples"
157 elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
161 defaultdistance="ktuples"
166 parallelizationstrategy="BAATARI2"
168 sbstmodel=$defaultsbstmodel
169 fmodel=$defaultfmodel
175 iterate=$defaultiterate
178 distance=$defaultdistance
195 weighti=$defaultweighti
196 weightr=$defaultweightr
197 weightm=$defaultweightm
200 mccaskill=$defaultmccaskill
201 contrafold=$defaultcontrafold
202 progressfile="/dev/stderr"
205 algopt=$defaultalgopt
206 algoptit=$defaultalgoptit
229 seedfiles="/dev/null"
230 seedtablefile="/dev/null"
235 treeinfile="/dev/null"
237 laraparams="/dev/null"
251 mapoutfile="/dev/null"
254 mergetable="/dev/null"
265 #termgapopt=" " # gap/gap ga kakenai node
266 similarityoffset="0.0"
270 shiftpenaltyspecified=0
280 minimumweight="0.00001" # 2016/Mar
281 usenaivepairscore=" "
285 initialramusage="20GB"
287 if [ $# -gt 0 ]; then
288 if [ "$1" = "--version" ]; then
291 elif [ "$1" = "--help" -o "$1" = "--info" ]; then
297 if [ "$1" = "--auto" ]; then
299 elif [ "$1" = "--anysymbol" ]; then
301 elif [ "$1" = "--preservecase" ]; then
303 elif [ "$1" = "--clustalout" ]; then
304 outputformat="clustal"
305 elif [ "$1" = "--phylipout" ]; then
306 outputformat="phylip"
307 elif [ "$1" = "--reorder" ]; then
310 elif [ "$1" = "--inputorder" ]; then
313 elif [ "$1" = "--unweight" ]; then
315 elif [ "$1" = "--termgappenalty" ]; then
317 elif [ "$1" = "--alga" ]; then
321 elif [ "$1" = "--algq" ]; then
325 echo "--algq is no longer supported!" 1>&2
329 elif [ "$1" = "--namelength" ]; then
331 namelength=`expr "$1" - 0`
332 if ! expr "$1" : "[0-9]" > /dev/null ; then
333 echo "Specify the length of name in clustal format output!" 1>&2
336 elif [ "$1" = "--groupsize" ]; then
338 groupsize=`expr "$1" - 0`
339 if ! expr "$1" : "[0-9]" > /dev/null ; then
340 echo "Specify groupsize!" 1>&2
343 elif [ "$1" = "--partsize" ]; then
345 partsize=`expr "$1" - 0`
346 if ! expr "$1" : "[0-9]" > /dev/null ; then
347 echo "Specify partsize!" 1>&2
350 elif [ "$1" = "--parttree" ]; then
353 elif [ "$1" = "--dpparttree" ]; then
355 partdist="localalign"
356 elif [ "$1" = "--fastaparttree" ]; then
359 elif [ "$1" = "--treeout" ]; then
361 elif [ "$1" = "--distout" ]; then
363 elif [ "$1" = "--fastswpair" ]; then
367 elif [ "$1" = "--fastapair" ]; then
371 elif [ "$1" = "--averagelinkage" ]; then
374 elif [ "$1" = "--minimumlinkage" ]; then
377 elif [ "$1" = "--mixedlinkage" ]; then
381 elif [ "$1" = "--noscore" ]; then
383 elif [ "$1" = "--6mermultipair" ]; then
384 distance="ktuplesmulti"
387 elif [ "$1" = "--10mermultipair" ]; then
388 distance="ktuplesmulti"
391 elif [ "$1" = "--6merpair" ]; then
395 elif [ "$1" = "--10merpair" ]; then
399 elif [ "$1" = "--blastpair" ]; then
402 elif [ "$1" = "--lastmultipair" ]; then
405 elif [ "$1" = "--globalpair" ]; then
408 elif [ "$1" = "--shortlongpair" ]; then
410 usenaivepairscore="-Z"
411 laof=0.0 # addfull no tokini tsukawareru.
412 lexp=0.0 # addfull no tokini tsukawareru.
413 pgaof=0.0 # local nara iranai
414 pgexp=0.0 # local nara iranai
416 elif [ "$1" = "--longshortpair" ]; then
418 usenaivepairscore="-Z"
419 laof=0.0 # addfull no tokini tsukawareru.
420 lexp=0.0 # addfull no tokini tsukawareru.
421 pgaof=0.0 # local nara iranai
422 pgexp=0.0 # local nara iranai
424 elif [ "$1" = "--localpair" ]; then
427 elif [ "$1" = "--lastpair" ]; then
430 elif [ "$1" = "--multipair" ]; then
433 elif [ "$1" = "--hybridpair" ]; then
436 elif [ "$1" = "--scarnapair" ]; then
439 elif [ "$1" = "--dafspair" ]; then
442 elif [ "$1" = "--larapair" ]; then
445 elif [ "$1" = "--slarapair" ]; then
448 elif [ "$1" = "--foldalignpair" ]; then
449 distance="foldalignlocal"
451 elif [ "$1" = "--foldalignlocalpair" ]; then
452 distance="foldalignlocal"
454 elif [ "$1" = "--foldalignglobalpair" ]; then
455 distance="foldalignglobal"
457 elif [ "$1" = "--globalgenafpair" ]; then
458 distance="globalgenaf"
461 echo "--globalgenaf is no longer supported!" 1>&2
464 elif [ "$1" = "--localgenafpair" ]; then
465 distance="localgenaf"
467 elif [ "$1" = "--genafpair" ]; then
468 distance="localgenaf"
470 elif [ "$1" = "--oldgenafpair" ]; then
471 distance="localgenaf"
474 elif [ "$1" = "--memsave" ]; then
475 memopt=" -M -B " # -B (bunkatsunashi no riyu ga omoidasenai)
476 elif [ "$1" = "--nomemsave" ]; then
478 elif [ "$1" = "--nuc" ]; then
480 elif [ "$1" = "--amino" ]; then
482 elif [ "$1" = "--fft" ]; then
485 elif [ "$1" = "--nofft" ]; then
487 elif [ "$1" = "--quiet" ]; then
488 if [ $os = "mingw" ]; then
491 progressfile="/dev/null"
493 elif [ "$1" = "--debug" ]; then
495 elif [ "$1" = "--coreext" ]; then
497 elif [ "$1" = "--core" ]; then
499 elif [ "$1" = "--adjustdirection" ]; then
501 elif [ "$1" = "--adjustdirectionaccurately" ]; then
503 elif [ "$1" = "--progress" ]; then
506 if ! ( expr "$progressfile" : "\/" > /dev/null || expr "$progressfile" : "[A-Za-z]\:" > /dev/null ) ; then
507 echo "Specify a progress file name with the absolute path!" 1>&2
510 elif [ "$1" = "--out" ]; then
513 elif [ "$1" = "--thread" ]; then
515 if ! expr "$1" : "[0-9\-]" > /dev/null ; then
516 echo "Specify the number of threads. Or, use --thread -1" 1>&2
519 numthreads=`expr "$1" - 0`
520 elif [ "$1" = "--threadtb" ]; then
522 if ! expr "$1" : "[0-9\-]" > /dev/null ; then
523 echo "Specify the number of threads for the iterative step!" 1>&2
526 numthreadstb=`expr "$1" - 0`
527 elif [ "$1" = "--threadit" ]; then
529 if ! expr "$1" : "[0-9\-]" > /dev/null ; then
530 echo "Specify the number of threads for the iterative step!" 1>&2
533 numthreadsit=`expr "$1" - 0`
534 elif [ "$1" = "--last_subopt" ]; then
536 elif [ "$1" = "--last_once" ]; then
538 elif [ "$1" = "--last_m" ]; then
540 last_m=`expr "$1" - 0`
541 elif [ "$1" = "--last_e" ]; then
543 last_e=`expr "$1" - 0`
544 elif [ "$1" = "--randomseed" ]; then
546 randomseed=`expr "$1" - 0`
547 elif [ "$1" = "--bestfirst" ]; then
548 parallelizationstrategy="BESTFIRST"
549 elif [ "$1" = "--adhoc0" ]; then
550 parallelizationstrategy="BAATARI0"
551 elif [ "$1" = "--adhoc1" ]; then
552 parallelizationstrategy="BAATARI1"
553 elif [ "$1" = "--adhoc2" ]; then
554 parallelizationstrategy="BAATARI2"
555 elif [ "$1" = "--simplehillclimbing" ]; then
556 parallelizationstrategy="BAATARI2"
557 elif [ "$1" = "--scoreout" ]; then
559 elif [ "$1" = "--outnum" ]; then
561 elif [ "$1" = "--leavegappyregion" ]; then
563 elif [ "$1" = "--legacygappenalty" ]; then
565 elif [ "$1" = "--merge" ]; then
568 if [ ! -e "$mergetable" ]; then
569 echo "Cannot open $mergetable" 1>&2
573 elif [ "$1" = "--addprofile" ]; then
577 elif [ "$1" = "--add" ]; then
581 elif [ "$1" = "--addfragments" ]; then
586 elif [ "$1" = "--addfull" ]; then
591 elif [ "$1" = "--addlong" ]; then
596 elif [ "$1" = "--smoothing" ]; then
597 add2ndhalfarg=$add2ndhalfarg" -p "
598 elif [ "$1" = "--keeplength" ]; then
599 add2ndhalfarg=$add2ndhalfarg" -Y "
600 elif [ "$1" = "--mapout" ]; then
601 add2ndhalfarg=$add2ndhalfarg" -Z -Y "
602 elif [ "$1" = "--mapoutfile" ]; then
604 add2ndhalfarg=$add2ndhalfarg" -Z -Y "
606 elif [ "$1" = "--maxiterate" ]; then
608 iterate=`expr "$1" - 0`
609 if ! expr "$1" : "[0-9]" > /dev/null ; then
610 echo "Specify the number of iterations!" 1>&2
613 elif [ "$1" = "--retree" ]; then
615 cycle=`expr "$1" - 0`
616 if ! expr "$1" : "[0-9]" > /dev/null ; then
617 echo "Specify the number of tree rebuilding!" 1>&2
620 elif [ "$1" = "--text" ]; then
621 sbstmodel=" -b -2 -a "
625 elif [ "$1" = "--aamatrix" ]; then
629 if [ ! -e "$aamatrix" ]; then
630 echo "Cannot open $aamatrix" 1>&2
634 elif [ "$1" = "--treein" ]; then
639 if [ ! -e "$treeinfile" ]; then
640 echo "Cannot open $treeinfile" 1>&2
644 elif [ "$1" = "--pileup" ]; then
648 elif [ "$1" = "--randomchain" ]; then
652 elif [ "$1" = "--topin" ]; then
657 echo "The --topin option has been disabled." 1>&2
658 echo "There was a bug in version < 6.530." 1>&2
659 echo "This bug has not yet been fixed." 1>&2
661 elif [ "$1" = "--memsavetree" ]; then
665 elif [ "$1" = "--memsavetreex" ]; then
669 elif [ "$1" = "--initialramusage" ]; then
675 elif [ "$1" = "--kappa" ]; then
678 if ! expr "$1" : "[0-9]" > /dev/null ; then
679 echo "Specify kappa value!" 1>&2
682 elif [ "$1" = "--fmodel" ]; then
684 elif [ "$1" = "--nwildcard" ]; then
686 elif [ "$1" = "--nzero" ]; then
688 elif [ "$1" = "--jtt" ]; then
691 # if ! expr "$1" : "[0-9]" > /dev/null ; then
692 # echo "Specify pam value!" 1>&2
695 elif [ "$1" = "--kimura" ]; then
698 # if ! expr "$1" : "[0-9]" > /dev/null ; then
699 # echo "Specify pam value!" 1>&2
702 elif [ "$1" = "--tm" ]; then
705 # if ! expr "$1" : "[0-9]" > /dev/null ; then
706 # echo "Specify pam value!" 1>&2
709 elif [ "$1" = "--bl" ]; then
712 if ! expr "$1" : "[0-9]" > /dev/null ; then
713 echo "blosum $1?" 1>&2
716 elif [ "$1" = "--weighti" ]; then
719 if ! expr "$1" : "[0-9]" > /dev/null ; then
720 echo "Specify weighti value!" 1>&2
723 elif [ "$1" = "--weightr" ]; then
726 if ! expr "$1" : "[0-9]" > /dev/null ; then
727 echo "Specify weightr value!" 1>&2
730 elif [ "$1" = "--weightm" ]; then
733 if ! expr "$1" : "[0-9]" > /dev/null ; then
734 echo "Specify weightm value!" 1>&2
737 elif [ "$1" = "--rnaalifold" ]; then
739 elif [ "$1" = "--mccaskill" ]; then
743 elif [ "$1" = "--contrafold" ]; then
747 elif [ "$1" = "--dafs" ]; then
751 elif [ "$1" = "--ribosum" ]; then
753 elif [ "$1" = "--op" ]; then
756 if ! expr "$1" : "[0-9]" > /dev/null ; then
757 echo "Specify op!" 1>&2
760 elif [ "$1" = "--opdist" ]; then
763 if ! expr "$1" : "[0-9]" > /dev/null ; then
764 echo "Specify opdist!" 1>&2
768 elif [ "$1" = "--allowshift" ]; then
770 elif [ "$1" = "--shiftpenalty" ]; then
773 if ! expr "$1" : "[0-9]" > /dev/null ; then
774 echo "Specify sf!" 1>&2
777 shiftpenaltyspecified=1
778 elif [ "$1" = "--ep" ]; then
782 aof=`awk "BEGIN{ print -1.0 * \"$tmpval\"}"`
783 if ! expr "$aof" : "[0-9\-]" > /dev/null ; then
784 printf "\nSpecify a number for ep, like --ep 0.1\n" 1>&2
785 printf "'$1' cannot be interpreted as a number..\n\n" 1>&2
788 elif [ "$1" = "--rop" ]; then
792 elif [ "$1" = "--rep" ]; then
795 elif [ "$1" = "--lop" ]; then
798 elif [ "$1" = "--LOP" ]; then
801 elif [ "$1" = "--lep" ]; then
804 elif [ "$1" = "--lexp" ]; then
807 elif [ "$1" = "--LEXP" ]; then
810 elif [ "$1" = "--GEXP" ]; then
813 elif [ "$1" = "--GOP" ]; then
816 elif [ "$1" = "--gop" ]; then
819 elif [ "$1" = "--gep" ]; then
822 elif [ "$1" = "--gexp" ]; then
825 elif [ "$1" = "--laraparams" ]; then
828 elif [ "$1" = "--corethr" ]; then
831 elif [ "$1" = "--corewin" ]; then
834 elif [ "$1" = "--strdir" ]; then
837 elif [ "$1" = "--pdbidlist" ]; then
840 if [ ! -e "$pdblist" ]; then
841 echo "Cannot open $pdblist" 1>&2
845 elif [ "$1" = "--pdbfilelist" ]; then
848 if [ ! -e "$ownlist" ]; then
849 echo "Cannot open $ownlist" 1>&2
853 elif [ "$1" = "--enrich" ]; then
858 elif [ "$1" = "--enrichseq" ]; then
863 elif [ "$1" = "--enrichstr" ]; then
868 elif [ "$1" = "--seedtable" ]; then
872 elif [ "$1" = "--seed" ]; then
875 seedfiles="$seedfiles $1"
876 elif [ "$1" = "--minimumweight" ]; then
879 elif [ "$1" = "--similaritylevel" ]; then
881 similarityoffset="$1"
882 elif [ "$1" = "--unalignlevel" ]; then
886 elif [ "$1" = "--skipiterate" ]; then
889 elif [ "$1" = "--bunkatsunashi" ]; then
891 elif [ "$1" = "--sp" ]; then
893 elif [ "$1" = "--focus" ]; then
895 elif [ "$1" = "--sparsepickup" ]; then
898 elif [ $progname = "fftns" -o $progname = "nwns" ]; then
899 if [ "$1" -gt 0 ]; then
900 cycle=`expr "$1" - 0`
903 echo "Unknown option: $1" 1>&2
911 echo "" 1>"$progressfile"
913 # TMPFILE=/tmp/$progname.$$
914 TMPFILE=`mktemp -dt $progname.XXXXXXXXXX`
915 if [ $? -ne 0 ]; then
916 echo "mktemp seems to be obsolete. Re-trying without -t" 1>&2
917 TMPFILE=`mktemp -d /tmp/$progname.XXXXXXXXXX`
920 # if [ $os = "cygwin" ]; then
921 # TMPFILE=`cygpath -w $TMPFILE` unnecessary for cygwin2.7
925 # mkdir $TMPFILE || er=1
926 if [ $debug -eq 1 ]; then
927 # trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0 # does not work in msys
928 trap "tar cfv - $TMPFILE | gzip -c > debuginfo.tgz; rm -rf $TMPFILE " 0
930 trap "rm -rf $TMPFILE" 0
932 if [ $# -eq 1 ]; then
933 if [ -r "$1" -o "$1" = - ]; then
935 if [ -r "$addfile" ]; then
938 echo "$0": Cannot open "$addfile". 1>&2
943 cat "$1" | tr "\r" "\n" > $TMPFILE/infile
944 echo "" >> $TMPFILE/infile
945 cat "$addfile" | tr "\r" "\n" | grep -v "^$" >> $TMPFILE/infile
946 cat "$addfile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_addfile
947 cat "$aamatrix" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_aamtx
948 cat "$mergetable" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_subalignmentstable
949 cat "$treeinfile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_guidetree
950 cat "$seedtablefile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_seedtablefile
951 cat "$laraparams" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_lara.params
952 cat "$pdblist" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/pdblist
953 cat "$ownlist" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/ownlist
957 seedfilesintmp="/dev/null"
959 set $seedfiles > /dev/null
964 cat "$1" | tr "\r" "\n" > $TMPFILE/seed$#
966 echo "$0": Cannot open "$1". 1>&2
970 seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#`
971 seedfilesintmp=$seedfilesintmp" "seed$#
974 # echo $seedfilesintmp
979 echo "$0": Cannot open "$1". 1>&2
985 # echo '$#'"=$#" 1>&2
991 if [ $numthreads -lt 0 ]; then
992 if [ $os = "linux" ]; then
993 nlogicalcore=`cat /proc/cpuinfo | grep "^processor" | uniq | wc -l`
994 ncoresinacpu=`cat /proc/cpuinfo | grep 'cpu cores' | uniq | awk '{print $4}'`
995 nphysicalcpu=`cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l`
996 if [ $nlogicalcore -eq 0 ]; then
997 echo "Cannot get the number of processors from /proc/cpuinfo" 1>>"$progressfile"
1000 if [ ${#ncoresinacpu} -gt 0 -a $nphysicalcpu -gt 0 ]; then
1001 numthreads=`expr $ncoresinacpu '*' $nphysicalcpu`
1002 # if [ $nlogicalcore -gt $numthreads ]; then # Hyperthreading
1003 # numthreads=`expr $numthreads '+' 1`
1006 numthreads=$nlogicalcore
1008 elif [ $os = "darwin" ]; then
1009 numthreads=`sysctl -n hw.physicalcpu`
1010 if [ -z $numthreads ]; then
1011 echo "Cannot get the number of physical cores from sysctl" 1>>"$progressfile"
1014 # nlogicalcore=`sysctl -n hw.logicalcpu`
1015 # if [ $nlogicalcore -gt $numthreads ]; then # Hyperthreading
1016 # numthreads=`expr $numthreads '+' 1`
1018 elif [ $os = "mingw" -o $os = "cygwin" ]; then
1019 numthreads=`wmic cpu get NumberOfCores | head -2 | tail -1 | awk '{print $1}'`
1021 echo "Cannot count the number of physical cores." 1>>"$progressfile"
1024 echo "OS = "$os 1>>"$progressfile"
1025 echo "The number of physical cores = " $numthreads 1>>"$progressfile"
1028 if [ $numthreadstb -lt 0 ]; then
1029 numthreadstb=$numthreads
1032 if [ $numthreadsit -lt 0 ]; then
1033 if [ $numthreads -lt 11 ]; then
1034 numthreadsit=$numthreads
1040 if [ $numthreadsit -eq 0 -a $parallelizationstrategy = "BESTFIRST" ]; then
1041 echo 'Impossible' 1>&2;
1045 if [ "$addarg0" != " " ]; then
1046 iterate=0 # 2013/03/23
1047 "$prefix/countlen" < $TMPFILE/_addfile > $TMPFILE/addsize 2>>"$progressfile"
1048 nadd=`awk '{print $1}' $TMPFILE/addsize`
1049 if [ $nadd -eq "0" ]; then
1050 echo Check $addfile 1>&2
1053 if [ $seed != "x" -o $seedtable != "x" ]; then
1054 echo 'Impossible' 1>&2;
1055 echo 'Use either ONE of --seed, --seedtable, --addprofile and --add.' 1>&2
1062 if [ $auto -eq 1 ]; then
1063 "$prefix/countlen" < $TMPFILE/infile > $TMPFILE/size 2>>"$progressfile"
1064 nseq=`awk '{print $1}' $TMPFILE/size`
1065 nlen=`awk '{print $3}' $TMPFILE/size`
1067 if [ $nlen -lt 3000 -a $nseq -lt 100 ]; then
1071 elif [ $nlen -lt 1000 -a $nseq -lt 200 ]; then
1075 elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
1079 elif [ $nseq -lt 50000 ]; then # changed from 10000 2014/Oct/4
1083 elif [ $nseq -lt 90000 ]; then # changed from 30000 2014/Oct/4
1087 elif [ $nlen -lt 3000 ]; then
1089 partdist="localalign"
1104 # if [ $nlen -lt 3000 -a $nseq -lt 100 ]; then
1108 # elif [ $nlen -lt 1000 -a $nseq -lt 200 ]; then
1112 # elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
1113 # distance="ktuples"
1116 # elif [ $nseq -lt 200000 ]; then
1117 # distance="ktuples"
1121 # pileuporshuffle="a"
1122 # elif [ $nlen -lt 3000 ]; then
1123 # distance="parttree"
1124 # partdist="localalign"
1130 # distance="parttree"
1131 # partdist="ktuples"
1139 if [ $fragment -ne 0 ]; then
1140 norg=`expr $nseq '-' $nadd`
1141 npair=`expr $norg '*' $nadd`
1142 echo "nadd = " $nadd 1>>"$progressfile"
1143 echo "npair = " $npair 1>>"$progressfile"
1144 echo "nseq = " $nseq 1>>"$progressfile"
1145 echo "nlen = " $nlen 1>>"$progressfile"
1148 if [ $npair -gt 10000000 -o $nlen -gt 500000 ]; then # 2015/Jun
1150 echo "use ktuples, size=$tuplesize!" 1>>"$progressfile"
1151 elif [ $npair -gt 3000000 -o $nlen -gt 100000 ]; then # 2015/Jun
1154 echo "use multipair, weighti=0.0!" 1>>"$progressfile"
1157 echo "use multipair, weighti=$weighti!" 1>>"$progressfile"
1163 if [ `awk "BEGIN {print( 0.0+\"$sueff\" < 0.0 || 0.0+\"$sueff\" > 1.0 )}"` -gt 0 ]; then
1164 printf "\n%s\n\n" "The argument of --mixedlinkage must be between 0.0 and 1.0" 1>>"$progressfile"
1168 if [ $allowshift -eq 1 ]; then
1169 if [ $unalignspecified -ne 1 ]; then
1172 if [ $shiftpenaltyspecified -ne 1 ]; then
1177 if [ $opdistspecified -ne 1 ]; then
1181 if [ $unalignlevel != "0.0" -o `awk "BEGIN {print( 0.0+\"$spfactor\" < 100.0 )}"` -gt 0 ]; then
1184 if [ $distance = "localgenaf" ]; then
1185 printf "\n%s\n" "The combination of --allowshift and --genafpair (E-INS-i/-1) is not supported." 1>>"$progressfile"
1186 printf "%s\n" "Instead, please try --allowshift --globalpair (G-INS-i/-1 in the web version)," 1>>"$progressfile"
1187 printf "%s\n\n" "which covers the situation for --genafpair (E-INS-i/-1), too." 1>>"$progressfile"
1190 if [ $distance != "global" -o `awk "BEGIN {print( 0.0+\"$weighti\" < 1.0 )}"` -gt 0 ]; then
1191 printf "\n%s\n\n" "At present, --unalignlevel # or --allowshift is supported only with the --globalpair option." 1>>"$progressfile"
1194 if [ $fragment -ne 0 ]; then
1195 printf "\n%s\n\n" "At present, --unalignlevel # or --allowshift is not supported with the --addfragments option." 1>>"$progressfile"
1200 if [ `awk "BEGIN {print( 0.0+\"$spfactor\" < 1.0 )}"` -gt 0 ]; then
1201 printf "\n%s\n" "shiftpenalty must be >1." 1>>"$progressfile"
1205 if [ `awk "BEGIN {print( 0.0+\"$fixthreshold\" < 0.0 )}"` -gt 0 ]; then
1206 printf "\n%s\n\n" "The 'fix' parameter must be >= 0.0" 1>>"$progressfile"
1210 if [ `awk "BEGIN {print( 0.0+\"$unalignlevel\" < 0.0 || 0.0+\"$unalignlevel\" > 1.0 )}"` -gt 0 ]; then
1211 printf "\n%s\n\n" "The 'unalignlevel' parameter must be between 0.0 and 1.0" 1>>"$progressfile"
1214 if [ `awk "BEGIN {print( 0.0+\"$unalignlevel\" > 0.0 )}"` -gt 0 ]; then
1222 # if [ $auto -eq 1 -o $fragment -ne 0 -o $iterate -gt 0 ]; then
1223 if [ $fragment -ne 0 ]; then
1224 printf "\n%s\n\n" "At present, the 'unalignlevel > 0' mode is not supported with the --addfragments option." 1>>"$progressfile"
1227 if [ $distance = "parttree" ]; then
1228 printf "\n%s\n\n" "At present, the 'unalignlevel > 0' mode is not supported in the (dp)parttree option." 1>>"$progressfile"
1231 if [ $distance = "localgenaf" ]; then
1232 printf "\n%s\n" "The --genafpair is not supported in the 'unalignlevel > 0' mode." 1>>"$progressfile"
1233 printf "%s\n" "Instead, please try --unalignlevel xx --globalpair," 1>>"$progressfile"
1234 printf "%s\n\n" "which covers the situation for --genafpair (E-INS-i), too." 1>>"$progressfile"
1237 # if [ $distance != "ktuples" -a `awk "BEGIN {print( 0.0+\"$weighti\" > 0.0 )}"` -gt 0 -a $iterate -gt 0 ]; then
1238 # printf "\n%s\n\n" "Please add --weighti 0.0, for now." 1>>"$progressfile"
1243 if [ `awk "BEGIN {print( 0.0+\"$similarityoffset\" != 0.0 && 0.0+\"$unalignlevel\" != 0.0 )}"` -gt 0 ]; then
1244 printf "\n%s\n\n" "Do not simultaneously specify --similaritylevel and --unalignlevel" 1>>"$progressfile"
1248 if [ `awk "BEGIN {print( 0.0+\"$similarityoffset\" < -1.0 || 0.0+\"$similarityoffset\" > 1.0 )}"` -gt 0 ]; then
1249 printf "\n%s\n\n" "Similarity must be between -1.0 and +1.0" 1>>"$progressfile"
1252 aof=`awk "BEGIN{print 0.0 + \"$similarityoffset\" + $aof}"`
1253 laof=`awk "BEGIN{print 0.0 + \"$similarityoffset\" + $laof}"`
1254 pgaof=`awk "BEGIN{print 0.0 + \"$similarityoffset\" + $pgaof}"`
1257 if [ $parallelizationstrategy = "BESTFIRST" -o $parallelizationstrategy = "BAATARI0" ]; then
1262 if [ $iterate -gt $iteratelimit ]; then #??
1263 iterate=$iteratelimit
1266 if [ $rnaalifold -eq 1 ]; then
1267 rnaopt=" -e $rgep -o $rgop -c $weightm -r $weightr -R $rnascoremtx "
1268 # rnaoptit=" -o $rgop -BT -c $weightm -r $weightr -R "
1269 rnaoptit=" -o $rgop -F -c $weightm -r $weightr -R "
1270 elif [ $mccaskill -eq 1 -o $dafs -eq 1 -o $contrafold -eq 1 ]; then
1271 rnaopt=" -o $rgop -c $weightm -r $weightr "
1272 # rnaoptit=" -e $rgep -o $rgop -BT -c $weightm -r $weightr $rnascoremtx "
1273 rnaoptit=" -e $rgep -o $rgop -F -c $weightm -r $weightr $rnascoremtx "
1279 # if [ $algspecified -eq 0 ]; then
1280 # if [ $distance = "parttree" ]; then
1289 if [ $sprigorous -eq 1 ]; then
1291 if [ $iterate -gt 0 ]; then
1292 if [ $numthreadsit -eq 0 ]; then
1293 algoptit=" -@ -B -Z -z 1000 "
1295 echo "" 1>>"$progressfile"
1296 echo "At present, the combination of --sp and iterative refinement is supported only in a single thread." 1>>"$progressfile"
1297 echo "Please try \"--thread -1 --threadit 0\", which runs the iterative refinment calculation on a single thread." 1>>"$progressfile"
1298 echo "" 1>>"$progressfile"
1300 # algoptit=" -@ -B -z 1000 "
1308 model="$sbstmodel $kappa $fmodel $nmodel"
1310 if [ $er -eq 1 ]; then
1311 echo "------------------------------------------------------------------------------" 1>&2
1312 echo " MAFFT" $version 1>&2
1314 # echo " Input format: fasta" 1>&2
1316 # echo " Usage: `basename $0` [options] inputfile > outputfile" 1>&2
1317 echo " http://mafft.cbrc.jp/alignment/software/" 1>&2
1318 echo " MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)" 1>&2
1319 # echo "------------------------------------------------------------------------------" 1>&2
1320 # echo " % mafft in > out" 1>&2
1321 echo "------------------------------------------------------------------------------" 1>&2
1323 echo "High speed:" 1>&2
1324 echo " % mafft in > out" 1>&2
1325 echo " % mafft --retree 1 in > out (fast)" 1>&2
1327 echo "High accuracy (for <~200 sequences x <~2,000 aa/nt):" 1>&2
1328 echo " % mafft --maxiterate 1000 --localpair in > out (% linsi in > out is also ok)" 1>&2
1329 echo " % mafft --maxiterate 1000 --genafpair in > out (% einsi in > out)" 1>&2
1330 echo " % mafft --maxiterate 1000 --globalpair in > out (% ginsi in > out)" 1>&2
1332 echo "If unsure which option to use:" 1>&2
1333 echo " % mafft --auto in > out" 1>&2
1335 # echo "Other options:" 1>&2
1336 echo "--op # : Gap opening penalty, default: 1.53" 1>&2
1337 echo "--ep # : Offset (works like gap extension penalty), default: 0.0" 1>&2
1338 echo "--maxiterate # : Maximum number of iterative refinement, default: 0" 1>&2
1339 echo "--clustalout : Output: clustal format, default: fasta" 1>&2
1340 echo "--reorder : Outorder: aligned, default: input order" 1>&2
1341 echo "--quiet : Do not report progress" 1>&2
1342 echo "--thread # : Number of threads (if unsure, --thread -1)" 1>&2
1344 # echo " % mafft --maxiterate 1000 --localpair in > out (L-INS-i)" 1>&2
1345 # echo " most accurate in many cases, assumes only one alignable domain" 1>&2
1347 # echo " % mafft --maxiterate 1000 --genafpair in > out (E-INS-i)" 1>&2
1348 # echo " works well if many unalignable residues exist between alignable domains" 1>&2
1350 # echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2
1351 # echo " suitable for globally alignable sequences " 1>&2
1353 # echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2
1354 # echo " accurate and slow, iterative refinement method " 1>&2
1356 # echo "If the input sequences are long (~1,000,000nt)," 1>&2
1357 # echo " % mafft --retree 1 --memsave --fft in > out (FFT-NS-1-memsave, new in v5.8)" 1>&2
1359 # echo "If many (~5,000) sequences are to be aligned," 1>&2
1361 # echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 1>&2
1363 # echo " --localpair : All pairwise local alignment information is included" 1>&2
1364 # echo " to the objective function, default: off" 1>&2
1365 # echo " --globalpair : All pairwise global alignment information is included" 1>&2
1366 # echo " to the objective function, default: off" 1>&2
1367 # echo " --op # : Gap opening penalty, default: $defaultgop " 1>&2
1368 # echo " --ep # : Offset (works like gap extension penalty), default: $defaultaof " 1>&2
1369 # echo " --bl #, --jtt # : Scoring matrix, default: BLOSUM62" 1>&2
1370 # echo " Alternatives are BLOSUM (--bl) 30, 45, 62, 80, " 1>&2
1371 # echo " or JTT (--jtt) # PAM. " 1>&2
1372 # echo " --nuc or --amino : Sequence type, default: auto" 1>&2
1373 # echo " --retree # : The number of tree building in progressive method " 1>&2
1374 # echo " (see the paper for detail), default: $defaultcycle " 1>&2
1375 # echo " --maxiterate # : Maximum number of iterative refinement, default: $defaultiterate " 1>&2
1376 # if [ $defaultfft -eq 1 ]; then
1377 # echo " --fft or --nofft: FFT is enabled or disabled, default: enabled" 1>&2
1379 # echo " --fft or --nofft: FFT is enabled or disabled, default: disabled" 1>&2
1381 # echo " --memsave: Memory saving mode" 1>&2
1382 # echo " (for long genomic sequences), default: off" 1>&2
1383 # echo " --clustalout : Output: clustal format, default: fasta" 1>&2
1384 # echo " --reorder : Outorder: aligned, default: input order" 1>&2
1385 # echo " --quiet : Do not report progress" 1>&2
1386 # echo "-----------------------------------------------------------------------------" 1>&2
1389 if [ $sw -eq 1 ]; then
1395 if [ $distance = "fasta" -o $partdist = "fasta" ]; then
1396 if [ ! "$FASTA_4_MAFFT" ]; then
1397 FASTA_4_MAFFT=`which fasta34`
1400 if [ ! -x "$FASTA_4_MAFFT" ]; then
1402 echo "== Install FASTA ========================================================" 1>&2
1403 echo "This option requires the fasta34 program (FASTA version x.xx or higher)" 1>&2
1404 echo "installed in your PATH. If you have the fasta34 program but have renamed" 1>&2
1405 echo "(like /usr/local/bin/myfasta), set the FASTA_4_MAFFT environment variable" 1>&2
1406 echo "to point your fasta34 (like setenv FASTA_4_MAFFT /usr/local/bin/myfasta)." 1>&2
1407 echo "=========================================================================" 1>&2
1412 if [ $distance = "last" -o $distance = "lastmulti" ]; then
1413 if [ ! -x "$prefix/lastal" -o ! -x "$prefix/lastdb" ]; then
1415 echo "== Install LAST ============================================================" 1>&2
1416 echo "LAST (Kielbasa, Wan, Sato, Horton, Frith 2011 Genome Res. 21:487) is required." 1>&2
1417 echo "http://last.cbrc.jp/" 1>&2
1418 echo "http://mafft.cbrc.jp/alignment/software/xxxxxxx.html " 1>&2
1419 echo "============================================================================" 1>&2
1424 if [ $distance = "lara" -o $distance = "slara" ]; then
1425 if [ ! -x "$prefix/mafft_lara" ]; then
1427 echo "== Install LaRA =========================================================" 1>&2
1428 echo "This option requires LaRA (Bauer et al. http://www.planet-lisa.net/)." 1>&2
1429 echo "The executable have to be renamed to 'mafft_lara' and installed into " 1>&2
1430 echo "the $prefix directory. " 1>&2
1431 echo "A configuration file of LaRA also have to be given" 1>&2
1432 echo "mafft-xinsi --larapair --laraparams parameter_file" 1>&2
1433 echo "mafft-xinsi --slarapair --laraparams parameter_file" 1>&2
1434 echo "=========================================================================" 1>&2
1438 if [ ! -s "$laraparams" ]; then
1440 echo "== Configure LaRA =======================================================" 1>&2
1441 echo "A configuration file of LaRA have to be given" 1>&2
1442 echo "mafft-xinsi --larapair --laraparams parameter_file" 1>&2
1443 echo "mafft-xinsi --slarapair --laraparams parameter_file" 1>&2
1444 echo "=========================================================================" 1>&2
1449 if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
1450 if [ ! -x "$prefix/foldalign210" ]; then
1452 echo "== Install FOLDALIGN ====================================================" 1>&2
1453 echo "This option requires FOLDALIGN (Havgaard et al. http://foldalign.ku.dk/)." 1>&2
1454 echo "The executable have to be renamed to 'foldalign210' and installed into " 1>&2
1455 echo "the $prefix directory. " 1>&2
1456 echo "=========================================================================" 1>&2
1461 if [ $distance = "scarna" -o $mccaskill -eq 1 ]; then
1462 if [ ! -x "$prefix/mxscarnamod" ]; then
1464 echo "== Install MXSCARNA ======================================================" 1>&2
1465 echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required." 1>&2
1466 echo "Please 'make' at the 'extensions' directory of the MAFFT source package," 1>&2
1467 echo "which contains the modified version of MXSCARNA." 1>&2
1468 echo "http://mafft.cbrc.jp/alignment/software/source.html " 1>&2
1469 echo "==========================================================================" 1>&2
1474 if [ $distance = "dafs" -o $dafs -eq 1 ]; then
1475 if [ ! -x "$prefix/dafs" ]; then
1477 echo "== Install DAFS===========================================================" 1>&2
1478 echo "DAFS (Sato et al. Journal 2012 issue:page) is required." 1>&2
1479 echo "http://www.ncrna.org/ " 1>&2
1480 echo "==========================================================================" 1>&2
1485 if [ $contrafold -eq 1 ]; then
1486 if [ ! -x "$prefix/contrafold" ]; then
1488 echo "== Install CONTRAfold ===================================================" 1>&2
1489 echo "This option requires CONTRAfold" 1>&2
1490 echo "(Do et al. http://contra.stanford.edu/contrafold/)." 1>&2
1491 echo "The executable 'contrafold' have to be installed into " 1>&2
1492 echo "the $prefix directory. " 1>&2
1493 echo "=========================================================================" 1>&2
1500 # if [ $treeout -eq 1 ]; then
1501 # parttreeoutopt="-t"
1502 # if [ $cycle -eq 0 ]; then
1503 # treeoutopt="-t -T"
1506 # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
1507 # distance="distonly"
1513 # parttreeoutopt=" "
1514 # if [ $cycle -eq 0 ]; then
1515 # treeoutopt="-t -T"
1517 # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
1518 # distance="distonly"
1526 if [ $cycle -eq 0 ]; then
1529 weighti="0.0" # 2016Jul31, tbfast.c kara idou
1530 # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then # 2012/04, localpair --> local alignment distance
1531 # if [ $distance = "global" ]; then
1532 # distance="distonly"
1534 if [ $treeout -eq 1 ]; then
1540 if [ $distout -eq 1 ]; then
1542 if [ $treeout -eq 0 ]; then
1547 if [ $treeout -eq 1 ]; then
1554 if [ $distout -eq 1 ]; then
1560 formatcheck=`grep -c '^[[:blank:]]\+>' $TMPFILE/infile | head -1 `
1561 if [ $formatcheck -gt 0 ]; then
1562 echo "The first character of a description line must be " 1>&2
1563 echo "the greater-than (>) symbol, not a blank." 1>&2
1564 echo "Please check the format around the following line(s):" 1>&2
1565 grep -n '^[[:blank:]]\+>' $TMPFILE/infile 1>&2
1569 nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 `
1570 if [ $nseq -eq 2 ]; then
1573 if [ $cycle -gt 3 ]; then
1577 if [ $nseq -gt 60000 -a $iterate -gt 1 ]; then # 2014/Oct/22, test
1578 echo "Too many sequences to perform iterative refinement!" 1>&2
1579 echo "Please use a progressive method." 1>&2
1582 if [ $distance = "lastmulti" -o $distance = "multi" ]; then
1583 if [ $fragment -eq 0 ]; then
1584 echo 'Specify --addfragments too' 1>&2
1589 if [ $fragment -ne 0 ]; then
1590 if [ $pairspecified -eq 0 ]; then
1593 if [ $distance != "multi" -a $distance != "hybrid" -a $distance != "lastmulti" -a $distance != "local" -a $distance != "last" -a $distance != "ktuples" -a $distance != "ktuplesmulti" ]; then
1594 echo 'Specify --multipair, --lastmultipair, --lastpair, --localpair, --6merpair, --6mermultipair or --hybridpair' 1>&2
1599 if [ "$memopt" = " -M -B " -a "$distance" != "ktuples" ]; then
1600 echo "Impossible" 1>&2
1604 if [ $distance = "parttree" ]; then
1605 if [ $mergetable != "/dev/null" ]; then
1606 echo "The combination of (dp)parttree and merge is Impossible. " 1>&2
1609 if [ $addfile != "/dev/null" ]; then
1610 echo "The combination of (dp)parttree and add(fragments) is Impossible. " 1>&2
1613 if [ $seed != "x" -o $seedtable != "x" ]; then
1614 echo "Impossible" 1>&2
1617 if [ $iterate -gt 1 ]; then
1618 echo "Impossible" 1>&2
1621 if [ $outorder = "aligned" ]; then
1624 outorder="input" # partorder ga kiku
1625 if [ $partdist = "localalign" ]; then
1626 splitopt=" -U " # -U -l -> fast
1628 elif [ $partdist = "fasta" ]; then
1637 if [ \( $distance = "ktuples" -o $distance = "ktuplesmulti" \) -a \( $seed = "x" -a $seedtable = "x" -a $ownlist = "/dev/null" -a $pdblist = "/dev/null" -a $enrichstr -eq 0 \) ]; then
1640 elif [ \( $distance = "ktuples" -o $distance = "ktuplesmulti" \) -a \( $seed != "x" -o $seedtable != "x" -o $ownlist != "/dev/null" -o $pdblist != "/dev/null" -o $enrichstr -eq 1 \) ]; then
1641 if [ $cycle -lt 2 ]; then
1642 cycle=2 # disttbfast ha seed hi-taiou # chuui 2014Aug21
1644 if [ $iterate -lt 2 ]; then
1645 echo "############################################################################" 1>&2
1646 echo "# Warning:" 1>&2
1647 echo "# Progressive alignment method is incompatible with the --seed option." 1>&2
1648 echo "# Automatically switched to the iterative refinement method." 1>&2
1650 echo "# Also consider using the '--add' option, which is compatible with" 1>&2
1651 echo "# the progressive method and FASTER than the '--seed' option." 1>&2
1652 echo "# Usage is:" 1>&2
1653 echo "# % mafft --add newSequences existingAlignment > output" 1>&2
1654 echo "############################################################################" 1>&2
1657 localparam="-l "$weighti
1658 elif [ $distance = "parttree" ]; then
1661 if [ $groupsize -gt -1 ]; then
1665 localparam="-B -l "$weighti # weighti=0 demo bunkatsu nashi
1666 if [ $cycle -gt 1 ]; then # 09/01/08
1672 if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
1674 if [ $oldgenafparam -ne 1 ]; then
1677 # LEXP="0.0" # default = 0.0
1678 usenaivepairscore="-Z"
1683 # if [ $nseq -gt 5000 ]; then
1686 if [ $forcefft -eq 1 ]; then
1689 elif [ $fft -eq 1 ]; then
1695 if [ $seed != "x" -a $seedtable != "x" ]; then
1696 echo 'Use either one of seedtable and seed. Not both.' 1>&2
1699 if [ $f2clext = "-E" -a $anysymbol -gt 0 ]; then
1701 echo 'At present, the combination of --text and ( --anysymbol or --preservecase ) is impossible.' 1>&2
1706 if [ $f2clext = "-E" -a $aamatrix != "/dev/null" ]; then
1708 echo 'At present, the combination of --text and (--aamatrix) is impossible.' 1>&2
1713 if [ $treein -eq 1 ]; then
1714 # if [ $iterate -gt 0 ]; then
1715 # echo 'Not supported yet.' 1>&2
1718 if [ ! -s $TMPFILE/_guidetree ]; then
1719 if [ $distance != "ktuples" ]; then
1720 echo "Not supported yet" 1>>"$progressfile"
1723 if [ $pileuporshuffle = "p" ]; then
1724 echo "pileup" > $TMPFILE/_guidetree
1725 # weightopt=" -u " -> disttbfast.c?
1726 # numthreadstb=0 -> disttbfast.c
1727 cycle=1 # disttbfast. shitei
1728 elif [ $pileuporshuffle = "s" ]; then
1729 echo "shuffle $randomseed" > $TMPFILE/_guidetree
1730 # numthreadstb=0 -> disttbfast.c
1731 # weightopt=" -u " -> disttbfast.c?
1732 cycle=1 # disttbfast.c dem shitei
1733 elif [ $pileuporshuffle = "C" ]; then
1734 echo "very compact" > $TMPFILE/_guidetree
1735 elif [ $pileuporshuffle = "c" ]; then
1736 echo "compact " "$initialramusage" > $TMPFILE/_guidetree
1737 elif [ $pileuporshuffle = "a" ]; then
1738 echo "auto $randomseed 200" > $TMPFILE/_guidetree
1743 if [ $nadd -gt "0" ]; then
1744 if [ $fragment -eq "1" ]; then
1745 addarg="$addarg0 $nadd -g -0.01"
1747 cycle=1 # chuui 2014Aug25
1748 elif [ $fragment -eq "-1" ]; then
1749 addarg="$addarg0 $nadd"
1750 addsinglearg="-V" # allowlongadds, 2014/04/02
1751 cycle=1 # chuui 2014Aug25
1752 elif [ $fragment -eq "-2" ]; then
1753 addarg="$addarg0 $nadd"
1754 addsinglearg="-V" # allowlongadds + smoothing
1755 add2ndhalfarg=$add2ndhalfarg" -p "
1756 cycle=1 # chuui 2014Aug25
1757 usenaivepairscore="-Z" # 2015Jun01
1758 laof=0.0 # 2015Jun01
1759 lexp=0.0 # 2015Jun01
1761 addarg="$addarg0 $nadd"
1765 # cycle=1 # chuui 2014Aug19
1767 # treealg=" -q " ## 2012/01/24 ## removed 2012/02/06
1771 if [ -z "$localparam" -a $fragment -eq 0 -a $distance != "parttree" ]; then
1772 # echo "use disttbfast"
1773 # echo cycle = $cycle
1774 cycletbfast=1 # tbfast wo jikkou shinai
1775 cycledisttbfast=$cycle # disttbfast ni -E cycle wo watasu
1776 if [ $cycledisttbfast -eq 0 ]; then # --treeout de tsukau
1781 # echo cycle = $cycle
1782 cycletbfast=$cycle # 1 ijou nara jikkou
1783 cycledisttbfast=1 # disttbfast ha ikkai dake
1790 # echo cycledisttbfast=
1791 # echo $cycledisttbfast
1795 if [ $adjustdirection -gt 0 -a $seed != "x" ]; then
1797 echo 'The combination of --adjustdirection(accurately) and --seed is not supported.' 1>&2
1803 if [ $mccaskill -eq 1 -o $dafs -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
1804 if [ $distance = "ktuples" ]; then
1805 echo 'Not supported.' 1>&2
1806 echo 'Please add --globalpair, --localpair, --scarnapair, --dafspair' 1>&2
1807 echo '--larapair, --slarapair, --foldalignlocalpair or --foldalignglobalpair' 1>&2
1810 if [ $f2clext = "-E" ]; then
1812 echo 'For RNA alignment, the --text mode is impossible.' 1>&2
1818 # cycle ga atode henkou sareru node koko de strategy no namae wo kimeru.
1820 if [ $pileuporshuffle = "p" ]; then
1822 elif [ $pileuporshuffle = "s" ]; then
1823 strategy="Randomchain-"
1824 elif [ $mccaskill -eq 1 -o $dafs -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
1825 if [ $distance = "scarna" -o $distance = "dafs" -o $distance = "lara" -o $distance = "slara" -o $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
1827 elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then
1830 elif [ $distance = "fasta" -a $sw -eq 0 ]; then
1832 elif [ $distance = "fasta" -a $sw -eq 1 ]; then
1834 elif [ $distance = "blast" ]; then
1836 elif [ $distance = "global" -o $distance = "distonly" ]; then
1838 elif [ $distance = "local" ]; then
1840 elif [ $distance = "last" ]; then
1842 elif [ $distance = "hybrid" ]; then
1844 elif [ $distance = "multi" ]; then
1846 elif [ $distance = "lastmulti" ]; then
1847 strategy="LastMulti-"
1848 elif [ $distance = "localgenaf" ]; then
1850 elif [ $distance = "globalgenaf" ]; then
1852 elif [ $fft -eq 1 ]; then
1857 # if [ `echo "$weighti>0.0" | bc` -gt 0 ]; then
1858 if [ `awk "BEGIN {print(0.0+\"$weighti\">0.0)}"` -gt 0 ]; then
1859 strategy=$strategy"I"
1861 strategy=$strategy"NS-"
1862 if [ $iterate -gt 0 ]; then
1863 strategy=$strategy"i"
1864 elif [ $distance = "parttree" ]; then
1865 if [ $partdist = "fasta" ]; then
1866 strategy=$strategy"FastaPartTree-"$cycle
1867 elif [ $partdist = "localalign" ]; then
1868 strategy=$strategy"DPPartTree-"$cycle
1870 strategy=$strategy"PartTree-"$cycle
1872 elif [ $fragment -eq 1 ]; then
1873 strategy=$strategy"fragment"
1874 elif [ $fragment -eq -1 ]; then
1875 strategy=$strategy"full"
1876 elif [ $fragment -eq -2 ]; then
1877 strategy=$strategy"long"
1879 strategy=$strategy$cycle
1883 performance='Not tested.'
1884 if [ $strategy = "F-INS-i" ]; then
1885 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
1886 performance='Most accurate, but very slow'
1887 elif [ $strategy = "L-INS-i" ]; then
1888 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
1889 performance='Probably most accurate, very slow'
1890 elif [ $strategy = "E-INS-i" ]; then
1891 explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment with generalized affine gap costs (Altschul 1998)'
1892 performance='Suitable for sequences with long unalignable regions, very slow'
1893 elif [ $strategy = "G-INS-i" ]; then
1894 explanation='Iterative refinement method (<'$iterate') with GLOBAL pairwise alignment information'
1895 performance='Suitable for sequences of similar lengths, very slow'
1896 elif [ $strategy = "X-INS-i" ]; then
1897 explanation='RNA secondary structure information is taken into account.'
1898 performance='For short RNA sequences only, extremely slow'
1899 elif [ $strategy = "F-INS-1" ]; then
1900 explanation='Progressive method incorporating LOCAL pairwise alignment information'
1901 elif [ $strategy = "L-INS-1" ]; then
1902 explanation='Progressive method incorporating LOCAL pairwise alignment information'
1903 elif [ $strategy = "G-INS-1" ]; then
1904 explanation='Progressive method incorporating GLOBAL pairwise alignment information'
1905 elif [ $strategy = "FFT-NS-i" -o $strategy = "NW-NS-i" ]; then
1906 explanation='Iterative refinement method (max. '$iterate' iterations)'
1907 if [ $iterate -gt 2 ]; then
1908 performance='Accurate but slow'
1910 performance='Standard'
1912 elif [ $strategy = "FFT-NS-2" -o $strategy = "NW-NS-2" ]; then
1913 explanation='Progressive method (guide trees were built '$cycle' times.)'
1914 performance='Fast but rough'
1915 elif [ $strategy = "FFT-NS-1" -o $strategy = "NW-NS-1" ]; then
1916 explanation='Progressive method (rough guide tree was used.)'
1917 performance='Very fast but very rough'
1920 if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
1921 outputopt=" -c $strategy -r $TMPFILE/order $f2clext "
1922 elif [ $outputformat = "clustal" -a $outorder = "input" ]; then
1923 outputopt=" -c $strategy $f2clext "
1924 elif [ $outputformat = "phylip" -a $outorder = "aligned" ]; then
1925 outputopt=" -y -r $TMPFILE/order "
1926 elif [ $outputformat = "phylip" -a $outorder = "input" ]; then
1928 elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then
1929 outputopt=" -f -r $TMPFILE/order "
1938 pushd $TMPFILE > /dev/null;
1942 # echo "nseq = " $nseq 1>>"$progressfile"
1943 # echo "distance = " $distance 1>>"$progressfile"
1944 # echo "iterate = " $iterate 1>>"$progressfile"
1945 # echo "cycle = " $cycle 1>>"$progressfile"
1947 if [ $anysymbol -eq 1 ]; then
1949 "$prefix/replaceu" $seqtype -i orig > infile 2>>"$progressfile" || exit 1
1952 if [ $mergetable != "/dev/null" ]; then
1953 if [ $nadd -gt "0" ]; then
1954 echo "Impossible" 1>&2
1957 # if [ $seed != "x" -o $seedtable != "x" ]; then
1958 # echo "This version does not support the combination of merge and seed." 1>&2
1961 # iterate=0 # 2013/04/16
1962 mergearg="-H $seedoffset"
1965 if [ $adjustdirection -gt 0 ]; then
1966 if [ $fragment -ne 0 ]; then
1969 fragarg="-F" # 2014/02/06, do not consider other additional sequences, even in the case of --add
1971 if [ $adjustdirection -eq 1 ]; then
1972 "$prefix/makedirectionlist" $fragarg -C $numthreads -m -I $nadd -i infile -t 0.00 -r 5000 -o a > _direction 2>>"$progressfile"
1973 elif [ $adjustdirection -eq 2 ]; then
1974 "$prefix/makedirectionlist" $fragarg -C $numthreads -m -I $nadd -i infile -t 0.00 -r 100 -o a -d > _direction 2>>"$progressfile"
1976 "$prefix/setdirection" $mergearg -d _direction -i infile > infiled 2>>"$progressfile" || exit
1978 if [ $anysymbol -eq 1 ]; then
1979 "$prefix/setdirection" $mergearg -d _direction -i orig -r > origd 2>>"$progressfile" || exit
1984 if [ $seed != "x" -o $seedtable != "x" ]; then
1985 if [ $pdblist != "/dev/null" -o $ownlist != "/dev/null" ]; then
1986 echo "The combination of --seed and (--pdbidlist or --pdbfilelist) is impossible." 1>>"$progressfile"
1989 if [ $enrich -eq 1 ]; then
1990 echo "The combination of --seed and (--enrich, --enrichseq or --enrichstr) is impossible at present." 1>>"$progressfile"
1995 if [ $enrich -eq 1 ]; then
1996 if [ $ownlist != "/dev/null" ]; then
1997 echo "Warning: Sequence homologs of the structures given with the --pdbfilelist option cannot be collected.\n" 1>>"$progressfile"
1999 echo "SEEKQUENCER (http://sysimm.ifrec.osaka-u.ac.jp/seekquencer/) is" 1>>"$progressfile"
2000 if [ $pdblist != "/dev/null" ]; then
2001 echo "collecting homoplogs of the input sequences and the structures given with the --pdbidlist option." 1>>"$progressfile"
2002 perl "$prefix/seekquencer_premafft.pl" $seektarget -run thread -trd 2 -seqd uniref90 -blim 1000 -noin -seqf infile -idf pdblist -out seekout -mod mafftash-split 2>>"seekerr"
2005 echo "collecting homologs of the input sequences." 1>>"$progressfile"
2006 perl "$prefix/seekquencer_premafft.pl" $seektarget -run thread -trd 2 -seqd uniref90 -blim 1000 -noin -seqf infile -out seekout -mod mafftash-split 2>>"seekerr"
2009 cat seekerr 1>>"$progressfile"
2011 if [ $seekres -ne "0" ]; then
2012 echo "Error in SEEKQUENCER" 1>>"$progressfile"
2015 echo "Done." 1>>"$progressfile"
2017 if [ $enrichseq -eq 1 ]; then
2018 # cat seekout.seq >> infile
2019 if [ $anysymbol -eq 1 ]; then
2020 "$prefix/replaceu" $seqtype -i seekout.seq -o $nseq >> infile
2021 cat seekout.seq >> orig
2023 "$prefix/replaceu" $seqtype -i seekout.seq | sed 's/_os_[0-9]*_oe_//' >> infile
2027 if [ $enrichstr -eq 1 ]; then
2028 nseekstr=`wc -l < seekout.str`
2029 if [ $nseekstr -gt 1 ]; then
2030 cat seekout.str >> pdblist
2031 pdblist="tsukaimasu"
2036 if [ $seed != "x" ]; then
2038 if [ $anysymbol -eq 1 ]; then
2040 cat /dev/null > orig
2042 cat /dev/null > infile
2043 cat /dev/null > hat3.seed
2045 # echo "seednseq="$seednseq
2046 # echo "seedoffset="$seedoffset
2047 set $seednseq >> "$progressfile"
2054 if [ $anysymbol -eq 1 ]; then
2056 "$prefix/replaceu" $seqtype -i seed$# -o $seedoffset > clean 2>>"$progressfile" || exit 1
2059 "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile 2>>"$progressfile" || exit 1
2060 cat hat3 >> hat3.seed
2062 seedoffset=`expr $seedoffset + $1`
2064 # echo "seedoffset="$seedoffset
2066 # echo "seedoffset="$seedoffset
2067 if [ $anysymbol -eq 1 ]; then
2068 "$prefix/replaceu" $seqtype -i orig2 -o $seedoffset >> infile 2>>"$progressfile" || exit 1 # yarinaoshi
2071 cat infile2 >> infile
2073 elif [ $seedtable != "x" ]; then
2074 cat _seedtablefile > hat3.seed
2075 elif [ $pdblist != "/dev/null" -o $ownlist != "/dev/null" ]; then
2077 if [ $anysymbol -eq 1 ]; then
2079 cat /dev/null > orig
2081 cat /dev/null > infile
2083 echo "strdir = " 1>>"$progressfile"
2084 echo $strdir 1>>"$progressfile"
2086 echo "Calling DASH (http://sysimm.ifrec.osaka-u.ac.jp/dash/)" 1>>"$progressfile"
2087 perl "$prefix/mafftash_premafft.pl" -p pdblist -o ownlist -d "$strdir" 2>>"dasherr"
2089 cat dasherr 1>>"$progressfile"
2091 if [ $dashres -ne "0" ]; then
2092 echo "Error in DASH" 1>>"$progressfile"
2095 echo "Done." 1>>"$progressfile"
2097 seedoffset=`grep -c '^[>|=]' instr | head -1 `
2099 echo "# of structures = " 1>>"$progressfile"
2100 echo $seedoffset 1>>"$progressfile"
2103 if [ $anysymbol -eq 1 ]; then
2105 "$prefix/replaceu" $seqtype -i instr -o 0 > clean 2>>"$progressfile" || exit 1
2108 "$prefix/replaceu" $seqtype -i orig2 -o $seedoffset >> infile 2>>"$progressfile" || exit 1 # yarinaoshi
2112 cat infile2 >> infile
2115 cat /dev/null > hat3.seed
2122 if [ $mccaskill -eq 1 ]; then
2123 "$prefix/mccaskillwrap" -s -C $numthreads -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1
2124 elif [ $dafs -eq 1 ]; then
2125 "$prefix/mccaskillwrap" -G -C $numthreads -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1
2126 elif [ $contrafold -eq 1 ]; then
2127 "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1
2129 if [ $distance = "fasta" ]; then
2130 "$prefix/dndfast7" $swopt < infile > /dev/null 2>>"$progressfile" || exit 1
2131 cat hat3.seed hat3 > hatx
2133 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2134 elif [ $distance = "blast" ]; then
2135 "$prefix/dndblast" < infile > /dev/null 2>>"$progressfile" || exit 1
2136 cat hat3.seed hat3 > hatx
2138 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2139 elif [ $distance = "foldalignlocal" ]; then
2140 "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -Q $spfactor -h $laof -H -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2141 cat hat3.seed hat3 > hatx
2143 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2144 elif [ $distance = "foldalignglobal" ]; then
2145 "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop -Q $spfactor -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2146 cat hat3.seed hat3 > hatx
2148 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2149 elif [ $distance = "slara" ]; then
2150 "$prefix/pairlocalalign" -C $numthreads -p $laraparams $seqtype $model -f $lgop -Q $spfactor -T -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2151 cat hat3.seed hat3 > hatx
2153 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2154 elif [ $distance = "lara" ]; then
2155 "$prefix/pairlocalalign" -C $numthreads -p $laraparams $seqtype $model -f $lgop -Q $spfactor -B -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2156 cat hat3.seed hat3 > hatx
2158 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2159 elif [ $distance = "scarna" ]; then
2160 # "$prefix/pairlocalalign" -C $numthreads $seqtype $model -f $pggop -Q $spfactor -s -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2161 # cat hat3.seed hat3 > hatx
2163 # "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2164 "$prefix/tbfast" _ -C $numthreads $seqtype $model -f $pggop -Q $spfactor -s -d "$prefix" _ -+ $iterate -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2165 elif [ $distance = "dafs" ]; then
2166 "$prefix/pairlocalalign" -C $numthreads $seqtype $model -f $pggop -Q $spfactor -G -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2167 cat hat3.seed hat3 > hatx
2169 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2170 elif [ $distance = "global" ]; then
2171 # "$prefix/pairlocalalign" -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $pgexp -f $pggop -Q $spfactor -h $pgaof -A $usenaivepairscore $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2172 # cat hat3.seed hat3 > hatx
2174 # "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2175 "$prefix/tbfast" _ -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $pgexp -f $pggop -Q $spfactor -h $pgaof -A $usenaivepairscore $focusarg _ -+ $iterate -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2177 elif [ $distance = "local" ]; then
2178 if [ $fragment -ne 0 ]; then
2179 "$prefix/pairlocalalign" $localparam $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -L $usenaivepairscore < infile > /dev/null 2>>"$progressfile" || exit 1
2180 cat hat3.seed hat3 > hatx
2182 "$prefix/addsingle" -Q 100 $legacygapopt -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2184 # "$prefix/pairlocalalign" -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -L $usenaivepairscore $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2185 # addarg wo watasanai
2186 # cat hat3.seed hat3 > hatx
2188 # "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2189 "$prefix/tbfast" _ -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -L $usenaivepairscore $focusarg _ -+ $iterate -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2191 elif [ $distance = "globalgenaf" ]; then
2192 "$prefix/pairlocalalign" -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $pgexp -f $pggop -Q $spfactor -h $pgaof -O $GGOP -E $GEXP -K $usenaivepairscore < infile > /dev/null 2>>"$progressfile" || exit 1
2193 cat hat3.seed hat3 > hatx
2195 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2196 elif [ $distance = "localgenaf" ]; then
2197 # "$prefix/pairlocalalign" -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -O $LGOP -E $LEXP -N $usenaivepairscore $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2198 # cat hat3.seed hat3 > hatx
2200 # "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2201 "$prefix/tbfast" _ -u $unalignlevel $localparam -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -O $LGOP -E $LEXP -N $usenaivepairscore $focusarg _ -+ $iterate -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg $focusarg < infile > /dev/null 2>>"$progressfile" || exit 1
2202 elif [ $distance = "last" ]; then
2203 if [ $fragment -ne 0 ]; then
2204 "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -Q $spfactor -h $laof -R $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2205 cat hat3.seed hat3 > hatx
2207 "$prefix/addsingle" -Q 100 $legacygapopt -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2209 "$prefix/pairlocalalign" -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -Q $spfactor -h $laof -R $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2210 # addarg wo watasanai
2211 cat hat3.seed hat3 > hatx
2213 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2215 elif [ $distance = "lastmulti" ]; then
2216 "$prefix/dndpre" $model -M 2 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof < infile > /dev/null 2>>"$progressfile" || exit 1
2218 "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -Q $spfactor -h $laof -r $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1
2219 cat hat3.seed hat3 > hatx
2222 if [ $fragment -ne 0 ]; then
2223 "$prefix/addsingle" -Q 100 $legacygapopt -d -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2225 echo "Impossible" 1>&2
2228 elif [ $distance = "multi" ]; then
2229 "$prefix/dndpre" $model -M 2 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof $usenaivepairscore < infile > /dev/null 2>>"$progressfile" || exit 1
2231 "$prefix/pairlocalalign" $localparam $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -Y $usenaivepairscore < infile > /dev/null 2>>"$progressfile" || exit 1
2232 cat hat3.seed hat3 > hatx
2235 if [ $fragment -ne 0 ]; then
2236 "$prefix/addsingle" -Q 100 $legacygapopt -d -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2238 echo "Impossible" 1>&2
2241 elif [ $distance = "hybrid" ]; then
2242 "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -Q $spfactor -h $laof -Y < infile > /dev/null 2>>"$progressfile" || exit 1
2243 cat hat3.seed hat3 > hatx
2245 "$prefix/disttbfast" -E 1 -s $unalignlevel $legacygapopt -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $memopt $weightopt $treeinopt $treeoutopt -T -y $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2246 if [ $fragment -ne 0 ]; then
2247 "$prefix/addsingle" -Q 100 $legacygapopt -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2249 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2251 # elif [ $distance = "distonly" ]; then
2252 # "$prefix/pairlocalalign" -C $numthreads $seqtype $model -g $pgexp -f $pggop -Q $spfactor -h $pgaof -t < infile > /dev/null 2>>"$progressfile" || exit 1
2253 # "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2254 elif [ $distance = "parttree" ]; then
2255 "$prefix/splittbfast" $legacygapopt $algopt $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof -p $partsize -s $groupsize $treealg $outnum -i infile > pre 2>>"$progressfile" || exit 1
2257 elif [ $distance = "ktuplesmulti" ]; then
2258 # "$prefix/dndpre" $model -M 1 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof < infile > /dev/null 2>>"$progressfile" || exit 1
2260 # "$prefix/disttbfast" -E 1 -s $unalignlevel $legacygapopt -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $memopt $weightopt $treeinopt $treeoutopt -T -y $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2262 if [ $fragment -ne 0 ]; then
2263 "$prefix/addsingle" -Q 100 $legacygapopt -d -W $tuplesize -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2264 # "$prefix/addsingle" -Q 100 $legacygapopt -d -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2266 echo "Impossible" 1>&2
2270 if [ $fragment -ne 0 ]; then
2271 "$prefix/addsingle" -Q 100 $legacygapopt -W $tuplesize -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h $aof $param_fft $localparam $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1
2273 "$prefix/disttbfast" -q $npickup -E $cycledisttbfast -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreadstb $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $algopt $treealg $scoreoutarg < infile > pre 2>>"$progressfile" || exit 1
2277 while [ $cycletbfast -gt 1 ]
2279 if [ $distance = "parttree" ]; then
2281 "$prefix/splittbfast" $legacygapopt -Z $algopt $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof -p $partsize -s $groupsize $treealg $outnum -i infile > pre 2>>"$progressfile" || exit 1
2283 "$prefix/tbfast" -W $minimumweight -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg $termgapopt $outnum -C $numthreadstb $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model -f "-"$gop -Q $spfactor -h $aof $param_fft $localparam $algopt -J $treealg $scoreoutarg < pre > /dev/null 2>>"$progressfile" || exit 1
2284 # fragment>0 no baai, nanimoshinai
2287 cycletbfast=`expr $cycletbfast - 1`
2289 if [ $iterate -gt 0 ]; then
2290 if [ $distance = "ktuples" ]; then
2291 "$prefix/dndpre" $model -M 2 -C $numthreads < pre > /dev/null 2>>"$progressfile" || exit 1
2293 "$prefix/dvtditr" -W $minimumweight $bunkatsuopt -E $fixthreshold -s $unalignlevel $legacygapopt $mergearg $outnum -C $numthreadsit -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -Q $spfactor -h $aof -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy $scoreoutarg < pre > /dev/null 2>>"$progressfile" || exit 1
2295 if [ $coreout -eq 1 ]; then
2296 "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2
2298 elif [ $anysymbol -eq 1 ]; then
2299 "$prefix/restoreu" $add2ndhalfarg -a pre -i orig > restored || exit 1
2306 echo '' 1>>"$progressfile"
2307 if [ $mccaskill -eq 1 ]; then
2308 echo "RNA base pairing probaility was calculated by the McCaskill algorithm (1)" 1>>"$progressfile"
2309 echo "implemented in Vienna RNA package (2) and MXSCARNA (3), and then" 1>>"$progressfile"
2310 echo "incorporated in the iterative alignment process (4)." 1>>"$progressfile"
2311 echo "(1) McCaskill, 1990, Biopolymers 29:1105-1119" 1>>"$progressfile"
2312 echo "(2) Hofacker et al., 2002, J. Mol. Biol. 319:3724-3732" 1>>"$progressfile"
2313 echo "(3) Tabei et al., 2008, BMC Bioinformatics 9:33" 1>>"$progressfile"
2314 echo "(4) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>>"$progressfile"
2315 echo "" 1>>"$progressfile"
2316 elif [ $contrafold -eq 1 ]; then
2317 echo "RNA base pairing probaility was calculated by the CONTRAfold algorithm (1)" 1>>"$progressfile"
2318 echo "and then incorporated in the iterative alignment process (4)." 1>>"$progressfile"
2319 echo "(1) Do et al., 2006, Bioinformatics 22:e90-98" 1>>"$progressfile"
2320 echo "(2) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>>"$progressfile"
2321 echo "" 1>>"$progressfile"
2323 if [ $pdblist != "/dev/null" -o $ownlist != "/dev/null" ]; then
2324 echo "Input structures are decomposed into structural domains using" 1>>"$progressfile"
2325 echo "Protein Domain Parser (Alexandrov & Shindyalov 2003)." 1>>"$progressfile"
2326 echo "Domain pairs are aligned using the rash function in" 1>>"$progressfile"
2327 echo "the ASH structural alignment package (Standley et al. 2007)." 1>>"$progressfile"
2329 if [ $pdblist != "/dev/null" ]; then
2330 echo "Pre-computed alignments stored in " 1>>"$progressfile"
2331 echo "DASH (http://sysimm.ifrec.osaka-u.ac.jp/dash/) are used. " 1>>"$progressfile"
2333 if [ $distance = "fasta" -o $partdist = "fasta" ]; then
2334 echo "Pairwise alignments were computed by FASTA" 1>>"$progressfile"
2335 echo "(Pearson & Lipman, 1988, PNAS 85:2444-2448)" 1>>"$progressfile"
2337 if [ $distance = "blast" ]; then
2338 echo "Pairwise alignments were computed by BLAST" 1>>"$progressfile"
2339 echo "(Altschul et al., 1997, NAR 25:3389-3402)" 1>>"$progressfile"
2341 if [ $distance = "last" -o $distance = "lastmulti" ]; then
2342 echo "Pairwise alignments were computed by LAST" 1>>"$progressfile"
2343 echo "http://last.cbrc.jp/" 1>>"$progressfile"
2344 echo "Kielbasa, Wan, Sato, Horton, Frith 2011 Genome Res. 21:487" 1>>"$progressfile"
2346 if [ $distance = "scarna" ]; then
2347 echo "Pairwise alignments were computed by MXSCARNA" 1>>"$progressfile"
2348 echo "(Tabei et al., 2008, BMC Bioinformatics 9:33)." 1>>"$progressfile"
2350 if [ $distance = "dafs" ]; then
2351 echo "Pairwise alignments were computed by DAFS" 1>>"$progressfile"
2352 echo "(Sato et al., 2012,,,,)." 1>>"$progressfile"
2354 if [ $distance = "lara" -o $distance = "slara" ]; then
2355 echo "Pairwise alignments were computed by LaRA" 1>>"$progressfile"
2356 echo "(Bauer et al., 2007, BMC Bioinformatics 8:271)." 1>>"$progressfile"
2358 if [ $distance = "foldalignlocal" ]; then
2359 echo "Pairwise alignments were computed by FOLDALIGN (local)" 1>>"$progressfile"
2360 echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>>"$progressfile"
2362 if [ $distance = "foldalignglobal" ]; then
2363 echo "Pairwise alignments were computed by FOLDALIGN (global)" 1>>"$progressfile"
2364 echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>>"$progressfile"
2366 # printf "\n" 1>>"$progressfile"
2367 echo 'Strategy:' 1>>"$progressfile"
2368 printf ' '$strategy 1>>"$progressfile"
2369 echo ' ('$performance')' 1>>"$progressfile"
2370 echo ' '$explanation 1>>"$progressfile"
2371 echo '' 1>>"$progressfile"
2372 echo "If unsure which option to use, try 'mafft --auto input > output'." 1>>"$progressfile"
2373 echo "For more information, see 'mafft --help', 'mafft --man' and the mafft page." 1>>"$progressfile"
2374 echo "" 1>>"$progressfile"
2375 echo "The default gap scoring scheme has been changed in version 7.110 (2013 Oct)." 1>>"$progressfile"
2376 echo "It tends to insert more gaps into gap-rich regions than previous versions." 1>>"$progressfile"
2377 echo "To disable this change, add the --leavegappyregion option." 1>>"$progressfile"
2378 # echo "If long gaps are expected, try 'mafft --ep 0.0 --auto input > output'." 1>>"$progressfile"
2379 # echo "If the possibility of long gaps can be excluded, add '--ep 0.123'." 1>>"$progressfile"
2380 if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
2381 echo "" 1>>"$progressfile"
2382 if [ $oldgenafparam -eq 1 ]; then
2383 echo "Obsolete parameters used for this calculation." 1>>"$progressfile"
2384 echo "Also try the new parameters for E-INS-i, by not specifying --oldgenafpair." 1>>"$progressfile"
2386 echo "Parameters for the E-INS-i option have been changed in version 7.243 (2015 Jun)." 1>>"$progressfile"
2387 echo "To switch to the old parameters, use --oldgenafpair, instead of --genafpair." 1>>"$progressfile"
2390 echo '' 1>>"$progressfile"
2393 if [ $pdblist != "/dev/null" -o $ownlist != "/dev/null" ]; then
2394 cat dasherr >>"$progressfile"
2401 if [ "$outputfile" = "" ]; then
2402 if [ "$outputopt" = "null" ]; then
2403 cat < $TMPFILE/pre || exit 1
2405 "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre 2>>/dev/null || exit 1
2408 if [ "$outputopt" = "null" ]; then
2409 cat < $TMPFILE/pre > "$outputfile" || exit 1
2411 "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre > "$outputfile" 2>>/dev/null || exit 1
2415 if [ $treeout -eq 1 ]; then
2416 cp $TMPFILE/infile.tree "$infilename.tree"
2419 if [ -s $TMPFILE/GuideTree ]; then # --merge no toki dake
2420 cp $TMPFILE/GuideTree .
2423 if [ $distout -eq 1 ]; then
2424 cp $TMPFILE/hat2 "$infilename.hat2"
2427 if [ $npickup -ne 0 ]; then
2428 cp $TMPFILE/notused "$infilename.notused"
2431 if [ -s $TMPFILE/_deletemap ]; then
2432 if [ "$mapoutfile" = "/dev/null" ]; then
2433 cp $TMPFILE/_deletemap "$addfile.map"
2435 cp $TMPFILE/_deletemap "$mapoutfile"
2444 tmpawk=`which nawk 2>/dev/null | awk '{print $1}'`
2445 if [ -x "$tmpawk" ]; then
2449 tmpawk=`which gawk 2>/dev/null | awk '{print $1}'`
2450 if [ -x "$tmpawk" ]; then
2454 #echo "prog="$prog 1>&2
2460 prefix = ENVIRON["prefix"];
2461 version = ENVIRON["version"];
2462 myself = ENVIRON["myself"];
2466 printf( "\n" ) > "/dev/tty";
2467 printf( "---------------------------------------------------------------------\n" ) > "/dev/tty";
2468 printf( "\n" ) > "/dev/tty";
2469 printf( " MAFFT %s\n", version ) > "/dev/tty";
2470 printf( "\n" ) > "/dev/tty";
2471 printf( " Copyright (c) 2016 Kazutaka Katoh\n" ) > "/dev/tty";
2472 printf( " MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)\n" ) > "/dev/tty";
2473 printf( " http://mafft.cbrc.jp/alignment/software/\n" ) > "/dev/tty";
2474 printf( "---------------------------------------------------------------------\n" ) > "/dev/tty";
2475 printf( "\n" ) > "/dev/tty";
2479 printf( "\n" ) > "/dev/tty";
2480 printf( "Input file? (fasta format)\n@ " ) > "/dev/tty";
2481 res = getline < "/dev/tty";
2483 if( res == 0 || NF == 0 )
2485 infile = sprintf( "%s", $0 );
2487 res = getline < infile;
2491 printf( "%s: No such file.\n\n", infile ) > "/dev/tty";
2492 printf( "Filename extension (eg., .txt) must be typed, if any.\n\n" ) > "/dev/tty";
2495 printf( "%s: Empty.\n", infile ) > "/dev/tty";
2498 printf( "OK. infile = %s\n\n", infile ) > "/dev/tty";
2506 printf( "\n" ) > "/dev/tty";
2507 printf( "Output file?\n" ) > "/dev/tty";
2508 printf( "@ " ) > "/dev/tty";
2509 res = getline < "/dev/tty";
2510 close( "/dev/tty" );
2511 if( res == 0 || NF == 0 )
2515 outfile = sprintf( "%s", $0 );
2516 printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
2524 printf( "\n" ) > "/dev/tty";
2525 printf( "Output format?\n" ) > "/dev/tty";
2526 printf( " 1. Clustal format / Sorted\n" ) > "/dev/tty";
2527 printf( " 2. Clustal format / Input order\n" ) > "/dev/tty";
2528 printf( " 3. Fasta format / Sorted\n" ) > "/dev/tty";
2529 printf( " 4. Fasta format / Input order\n" ) > "/dev/tty";
2530 printf( " 5. Phylip format / Sorted\n" ) > "/dev/tty";
2531 printf( " 6. Phylip format / Input order\n" ) > "/dev/tty";
2532 printf( "@ " ) > "/dev/tty";
2533 res = getline < "/dev/tty";
2534 close( "/dev/tty" );
2535 # printf( "res=%d, NF=%d\n", res, NF );
2538 # printf( "resnum=%d\n", resnum );
2540 if( resnum < 1 || 6 < resnum )
2545 outargs = "--clustalout --reorder";
2546 else if( resnum == 2 )
2547 outargs = "--clustalout --inputorder";
2548 else if( resnum == 3 )
2549 outargs = "--reorder";
2550 else if( resnum == 4 )
2551 outargs = "--inputorder";
2552 else if( resnum == 5 )
2553 outargs = "--phylipout --reorder";
2554 else if( resnum == 6 )
2555 outargs = "--phylipout --inputorder";
2558 printf( "OK. arguments = %s\n\n", outargs ) > "/dev/tty";
2566 printf( "\n" ) > "/dev/tty";
2567 printf( "Strategy?\n" ) > "/dev/tty";
2568 printf( " 1. --auto\n" ) > "/dev/tty";
2569 printf( " 2. FFT-NS-1 (fast)\n" ) > "/dev/tty";
2570 printf( " 3. FFT-NS-2 (default)\n" ) > "/dev/tty";
2571 printf( " 4. G-INS-i (accurate)\n" ) > "/dev/tty";
2572 printf( " 5. L-INS-i (accurate)\n" ) > "/dev/tty";
2573 printf( " 6. E-INS-i (accurate)\n" ) > "/dev/tty";
2574 printf( "@ " ) > "/dev/tty";
2575 res = getline < "/dev/tty";
2576 close( "/dev/tty" );
2577 # printf( "res=%d, NF=%d\n", res, NF );
2580 # printf( "resnum=%d\n", resnum );
2582 if( resnum < 1 || 6 < resnum )
2587 arguments = "--auto";
2588 else if( resnum == 2 )
2589 arguments = "--retree 1";
2590 else if( resnum == 3 )
2591 arguments = "--retree 2";
2592 else if( resnum == 4 )
2593 arguments = "--globalpair --maxiterate 16";
2594 else if( resnum == 5 )
2595 arguments = "--localpair --maxiterate 16";
2596 else if( resnum == 6 )
2597 arguments = "--genafpair --maxiterate 16";
2599 arguments = sprintf( "%s", $0 );
2600 printf( "OK. arguments = %s %s\n\n", arguments, outargs ) > "/dev/tty";
2608 printf( "\n" ) > "/dev/tty";
2609 printf( "Additional arguments? (--ep # --op # --kappa # etc)\n" ) > "/dev/tty";
2610 printf( "@ " ) > "/dev/tty";
2611 res = getline < "/dev/tty";
2612 close( "/dev/tty" );
2613 if( res == 0 || NF == 0 )
2619 addargs = sprintf( "%s", $0 );
2620 printf( "OK. arguments = %s %s %s\n\n", addargs, arguments, outargs ) > "/dev/tty";
2625 arguments = sprintf( "%s %s %s", addargs, arguments, outargs );
2628 command = sprintf( "\"%s\" %s \"%s\" > \"%s\"", myself, arguments, infile, outfile );
2629 gsub( /\\/, "/", command );
2632 printf( "command=\n%s\n", command ) > "/dev/tty";
2638 printf( "OK?\n" ) > "/dev/tty";
2639 printf( "@ [Y] " ) > "/dev/tty";
2640 res = getline < "/dev/tty";
2641 close( "/dev/tty" );
2644 else if( NF == 0 || $0 ~ /^[Yy]/ )
2653 printf( "\n" ) > "/dev/tty";
2654 printf( "\n" ) > "/dev/tty";
2657 command = sprintf( "more \"%s\"", outfile );
2659 printf( "Press Enter to exit." ) > "/dev/tty";
2660 res = getline < "/dev/tty";