IA32 mafft executables
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 11:10:02 +0000 (11:10 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 11:10:02 +0000 (11:10 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4290 e3abac25-378b-4346-85de-24260fe3988d

34 files changed:
binaries/src/mafft/binaries/contrafoldwrap [new file with mode: 0644]
binaries/src/mafft/binaries/countlen [new file with mode: 0644]
binaries/src/mafft/binaries/disttbfast [new file with mode: 0644]
binaries/src/mafft/binaries/dndblast [new file with mode: 0644]
binaries/src/mafft/binaries/dndfast7 [new file with mode: 0644]
binaries/src/mafft/binaries/dndpre [new file with mode: 0644]
binaries/src/mafft/binaries/dndpre2 [new file with mode: 0644]
binaries/src/mafft/binaries/dvtditr [new file with mode: 0644]
binaries/src/mafft/binaries/f2cl [new file with mode: 0644]
binaries/src/mafft/binaries/getlag [new file with mode: 0644]
binaries/src/mafft/binaries/mafft [new file with mode: 0644]
binaries/src/mafft/binaries/mafft-distance [new file with mode: 0644]
binaries/src/mafft/binaries/mafft-homologs.1 [new file with mode: 0644]
binaries/src/mafft/binaries/mafft-homologs.rb [new file with mode: 0644]
binaries/src/mafft/binaries/mafft-profile [new file with mode: 0644]
binaries/src/mafft/binaries/mafft.1 [new file with mode: 0644]
binaries/src/mafft/binaries/mccaskillwrap [new file with mode: 0644]
binaries/src/mafft/binaries/multi2hat3s [new file with mode: 0644]
binaries/src/mafft/binaries/mxscarnamod [new file with mode: 0644]
binaries/src/mafft/binaries/pair2hat3s [new file with mode: 0644]
binaries/src/mafft/binaries/pairash [new file with mode: 0644]
binaries/src/mafft/binaries/pairlocalalign [new file with mode: 0644]
binaries/src/mafft/binaries/regtable2seq [new file with mode: 0644]
binaries/src/mafft/binaries/replaceu [new file with mode: 0644]
binaries/src/mafft/binaries/restoreu [new file with mode: 0644]
binaries/src/mafft/binaries/rnatest [new file with mode: 0644]
binaries/src/mafft/binaries/score [new file with mode: 0644]
binaries/src/mafft/binaries/seq2regtable [new file with mode: 0644]
binaries/src/mafft/binaries/setcore [new file with mode: 0644]
binaries/src/mafft/binaries/sextet5 [new file with mode: 0644]
binaries/src/mafft/binaries/splittbfast [new file with mode: 0644]
binaries/src/mafft/binaries/tbfast [new file with mode: 0644]
binaries/src/mafft/scripts/mafft [new file with mode: 0644]
binaries/src/mafft/scripts/mafft-homologs.rb [new file with mode: 0644]

diff --git a/binaries/src/mafft/binaries/contrafoldwrap b/binaries/src/mafft/binaries/contrafoldwrap
new file mode 100644 (file)
index 0000000..2a5738d
Binary files /dev/null and b/binaries/src/mafft/binaries/contrafoldwrap differ
diff --git a/binaries/src/mafft/binaries/countlen b/binaries/src/mafft/binaries/countlen
new file mode 100644 (file)
index 0000000..f35eadb
Binary files /dev/null and b/binaries/src/mafft/binaries/countlen differ
diff --git a/binaries/src/mafft/binaries/disttbfast b/binaries/src/mafft/binaries/disttbfast
new file mode 100644 (file)
index 0000000..ebaa021
Binary files /dev/null and b/binaries/src/mafft/binaries/disttbfast differ
diff --git a/binaries/src/mafft/binaries/dndblast b/binaries/src/mafft/binaries/dndblast
new file mode 100644 (file)
index 0000000..48b4dd7
Binary files /dev/null and b/binaries/src/mafft/binaries/dndblast differ
diff --git a/binaries/src/mafft/binaries/dndfast7 b/binaries/src/mafft/binaries/dndfast7
new file mode 100644 (file)
index 0000000..00309d4
Binary files /dev/null and b/binaries/src/mafft/binaries/dndfast7 differ
diff --git a/binaries/src/mafft/binaries/dndpre b/binaries/src/mafft/binaries/dndpre
new file mode 100644 (file)
index 0000000..40b4a77
Binary files /dev/null and b/binaries/src/mafft/binaries/dndpre differ
diff --git a/binaries/src/mafft/binaries/dndpre2 b/binaries/src/mafft/binaries/dndpre2
new file mode 100644 (file)
index 0000000..79ef56a
Binary files /dev/null and b/binaries/src/mafft/binaries/dndpre2 differ
diff --git a/binaries/src/mafft/binaries/dvtditr b/binaries/src/mafft/binaries/dvtditr
new file mode 100644 (file)
index 0000000..c8a073a
Binary files /dev/null and b/binaries/src/mafft/binaries/dvtditr differ
diff --git a/binaries/src/mafft/binaries/f2cl b/binaries/src/mafft/binaries/f2cl
new file mode 100644 (file)
index 0000000..34c6cb1
Binary files /dev/null and b/binaries/src/mafft/binaries/f2cl differ
diff --git a/binaries/src/mafft/binaries/getlag b/binaries/src/mafft/binaries/getlag
new file mode 100644 (file)
index 0000000..2bee56b
Binary files /dev/null and b/binaries/src/mafft/binaries/getlag differ
diff --git a/binaries/src/mafft/binaries/mafft b/binaries/src/mafft/binaries/mafft
new file mode 100644 (file)
index 0000000..16b6660
--- /dev/null
@@ -0,0 +1,1658 @@
+#! /bin/sh
+
+
+er=0;
+myself=`dirname "$0"`/`basename "$0"`; export myself
+version="v6.857b (2011/05/30)"; export version
+LANG=C; export LANG
+os=`uname`
+progname=`basename "$0"`
+if [ `echo $os | grep -i cygwin` ]; then
+       os="cygwin"
+elif [ `echo $os | grep -i darwin` ]; then
+       os="darwin"
+elif [ `echo $os | grep -i sunos` ]; then
+       os="sunos"
+elif [ `echo $os | grep -i linux` ]; then
+       os="linux"
+else
+       os="unix"
+fi
+export os
+
+if [ "$MAFFT_BINARIES" ]; then
+       prefix="$MAFFT_BINARIES"
+else
+       prefix=/usr/libexec/mafft
+fi
+export prefix
+
+if [ $# -gt 0 ]; then
+       if [ "$1" = "--man" ]; then 
+               man "$prefix/mafft.1"
+               exit 0;
+       fi
+fi
+
+if [ ! -x "$prefix/tbfast" ]; then
+       echo "" 1>&2
+       echo "correctly installed?" 1>&2
+       echo "mafft binaries have to be installed in \$MAFFT_BINARIES" 1>&2
+       echo "or the $prefix directory". 1>&2
+       echo "" 1>&2
+       exit 1
+       er=1
+fi
+
+defaultiterate=0
+defaultcycle=2
+defaultgop="1.53"
+#defaultaof="0.123"
+defaultaof="0.000"
+defaultlaof="0.100"
+defaultlgop="-2.00"
+defaultfft=1
+defaultrough=0
+defaultdistance="sixtuples"
+#defaultdistance="local"
+defaultweighti="2.7"
+defaultweightr="0.0"
+defaultweightm="1.0"
+defaultmccaskill=0
+defaultcontrafold=0
+defaultalgopt="  "
+defaultalgoptit="  "
+defaultsbstmodel=" -b 62 "
+defaultfmodel=" "
+defaultkappa=" "
+if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="scarna"
+       defaultweighti="3.2"
+       defaultweightr="8.0"
+       defaultweightm="2.0"
+       defaultmccaskill=1
+       defaultcontrafold=0
+       defaultalgopt=" -A "
+       defaultalgoptit=" -AB " ## chui
+       defaultaof="0.0"
+       defaultsbstmodel=" -b 62 "
+       defaultkappa=" "
+       defaultfmodel=" -a "
+elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="global"
+       defaultweighti="3.2"
+       defaultweightr="8.0"
+       defaultweightm="2.0"
+       defaultmccaskill=1
+       defaultcontrafold=0
+       defaultalgopt=" -A "
+       defaultalgoptit=" -AB " ## chui
+       defaultaof="0.0"
+       defaultsbstmodel=" -b 62 "
+       defaultkappa=" "
+       defaultfmodel=" -a "
+elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then
+       defaultfft=0
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="local"
+elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="global"
+elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then
+       defaultfft=0
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="localgenaf"
+elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then
+       defaultfft=1
+       defaultcycle=2
+       defaultdistance="sixtuples"
+elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then
+       defaultfft=1
+       defaultcycle=2
+       defaultiterate=2
+       defaultdistance="sixtuples"
+elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then
+       defaultfft=0
+       defaultcycle=2
+       defaultdistance="sixtuples"
+elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
+       defaultfft=0
+       defaultcycle=2
+       defaultiterate=2
+       defaultdistance="sixtuples"
+fi
+outputfile=""
+namelength=15
+anysymbol=0
+parallelizationstrategy="BAATARI2"
+kappa=$defaultkappa
+sbstmodel=$defaultsbstmodel
+fmodel=$defaultfmodel
+gop=$defaultgop
+aof=$defaultaof
+cycle=$defaultcycle
+iterate=$defaultiterate
+fft=$defaultfft
+rough=$defaultrough
+distance=$defaultdistance
+forcefft=0
+memopt=" "
+weightopt=" "
+GGOP="-6.00"
+LGOP="-6.00"
+LEXP="-0.000"
+GEXP="-0.000"
+lgop=$defaultlgop
+lexp="-0.100"
+laof=$defaultlaof
+pggop="-2.00"
+pgexp="-0.10"
+pgaof="0.10"
+rgop="-1.530"
+rgep="-0.000"
+seqtype="  "
+weighti=$defaultweighti
+weightr=$defaultweightr
+weightm=$defaultweightm
+rnaalifold=0
+mccaskill=$defaultmccaskill
+contrafold=$defaultcontrafold
+quiet=0
+debug=0
+sw=0
+algopt=$defaultalgopt
+algoptit=$defaultalgoptit
+scorecalcopt=" "
+coreout=0
+corethr="0.5"
+corewin="100"
+coreext=" "
+outputformat="pir"
+outorder="input"
+seed="x"
+seedtable="x"
+auto=0
+groupsize=-1
+partsize=50
+partdist="sixtuples"
+partorderopt=" -x "
+treeout=0
+distout=0
+treein=0
+topin=0
+treeinopt="  "
+seedfiles="/dev/null"
+seedtablefile="/dev/null"
+aamatrix="/dev/null"
+treeinfile="/dev/null"
+rnascoremtx=" "
+laraparams="/dev/null"
+foldalignopt=" "
+treealg=" -X "
+scoreoutarg=" "
+numthreads=0
+randomseed=0
+addfile="/dev/null"
+addarg0=" "
+outnum=" "
+if [ $# -gt 0 ]; then
+       while [ $# -gt 1 ];
+       do
+               if [ "$1" = "--auto" ]; then 
+                       auto=1
+               elif [ "$1" = "--anysymbol" ]; then 
+                       anysymbol=1
+               elif [ "$1" = "--preservecase" ]; then 
+                       anysymbol=1
+               elif [ "$1" = "--clustalout" ]; then 
+                       outputformat="clustal"
+               elif [ "$1" = "--phylipout" ]; then 
+                       outputformat="phylip"
+               elif [ "$1" = "--reorder" ]; then 
+                       outorder="aligned"
+                       partorderopt=" "
+               elif [ "$1" = "--inputorder" ]; then 
+                       outorder="input"
+                       partorderopt=" -x "
+               elif [ "$1" = "--unweight" ]; then 
+                       weightopt=" -u "
+               elif [ "$1" = "--algq" ]; then 
+                       algopt=" -Q "
+                       algoptit=" -QB "
+               elif [ "$1" = "--namelength" ]; then 
+                       shift   
+                       namelength=`expr "$1" - 0`
+               elif [ "$1" = "--groupsize" ]; then 
+                       shift   
+                       groupsize=`expr "$1" - 0`
+               elif [ "$1" = "--partsize" ]; then 
+                       shift   
+                       partsize=`expr "$1" - 0`
+               elif [ "$1" = "--parttree" ]; then 
+                       distance="parttree"
+                       partdist="sixtuples"
+               elif [ "$1" = "--dpparttree" ]; then 
+                       distance="parttree"
+                       partdist="localalign"
+               elif [ "$1" = "--fastaparttree" ]; then 
+                       distance="parttree"
+                       partdist="fasta"
+               elif [ "$1" = "--treeout" ]; then 
+                       treeout=1
+               elif [ "$1" = "--distout" ]; then 
+                       distout=1
+               elif [ "$1" = "--fastswpair" ]; then
+                       distance="fasta"
+                       sw=1
+               elif [ "$1" = "--fastapair" ]; then
+                       distance="fasta"
+                       sw=0
+               elif [ "$1" = "--averagelinkage" ]; then
+                       treealg=" -E "
+               elif [ "$1" = "--minimumlinkage" ]; then
+                       treealg=" -q "
+               elif [ "$1" = "--noscore" ]; then
+                       scorecalcopt=" -Z "
+               elif [ "$1" = "--6merpair" ]; then
+                       distance="sixtuples"
+               elif [ "$1" = "--blastpair" ]; then
+                       distance="blast"
+               elif [ "$1" = "--globalpair" ]; then
+                       distance="global"
+               elif [ "$1" = "--localpair" ]; then
+                       distance="local"
+               elif [ "$1" = "--scarnapair" ]; then
+                       distance="scarna"
+               elif [ "$1" = "--larapair" ]; then
+                       distance="lara"
+               elif [ "$1" = "--slarapair" ]; then
+                       distance="slara"
+               elif [ "$1" = "--foldalignpair" ]; then
+                       distance="foldalignlocal"
+               elif [ "$1" = "--foldalignlocalpair" ]; then
+                       distance="foldalignlocal"
+               elif [ "$1" = "--foldalignglobalpair" ]; then
+                       distance="foldalignglobal"
+               elif [ "$1" = "--globalgenafpair" ]; then
+                       distance="globalgenaf"
+               elif [ "$1" = "--localgenafpair" ]; then
+                       distance="localgenaf"
+               elif [ "$1" = "--genafpair" ]; then
+                       distance="localgenaf"
+               elif [ "$1" = "--memsave" ]; then
+                       memopt=" -M -B "         # -B (bunkatsunashi no riyu ga omoidasenai)
+               elif [ "$1" = "--nomemsave" ]; then
+                       memopt=" -N "
+               elif [ "$1" = "--nuc" ]; then 
+                       seqtype=" -D "
+               elif [ "$1" = "--amino" ]; then 
+                       seqtype=" -P "
+               elif [ "$1" = "--fft" ]; then 
+                       fft=1
+                       forcefft=1
+               elif [ "$1" = "--nofft" ]; then 
+                       fft=0
+               elif [ "$1" = "--quiet" ]; then 
+                       quiet=1
+               elif [ "$1" = "--debug" ]; then 
+                       debug=1
+               elif [ "$1" = "--coreext" ]; then 
+                       coreext=" -c "
+               elif [ "$1" = "--core" ]; then 
+                       coreout=1
+               elif [ "$1" = "--out" ]; then 
+                       shift   
+                       outputfile="$1"
+               elif [ "$1" = "--thread" ]; then 
+                       shift
+                       numthreads=`expr "$1" - 0` 
+               elif [ "$1" = "--randomseed" ]; then 
+                       shift
+                       randomseed=`expr "$1" - 0` 
+               elif [ "$1" = "--bestfirst" ]; then 
+                       parallelizationstrategy="BESTFIRST"
+               elif [ "$1" = "--adhoc0" ]; then 
+                       parallelizationstrategy="BAATARI0"
+               elif [ "$1" = "--adhoc1" ]; then 
+                       parallelizationstrategy="BAATARI1"
+               elif [ "$1" = "--adhoc2" ]; then 
+                       parallelizationstrategy="BAATARI2"
+               elif [ "$1" = "--simplehillclimbing" ]; then 
+                       parallelizationstrategy="BAATARI2"
+               elif [ "$1" = "--scoreout" ]; then 
+                       scoreoutarg="-S -B"
+               elif [ "$1" = "--outnum" ]; then 
+                       scoreoutarg="-n"
+               elif [ "$1" = "--addprofile" ]; then 
+                       shift   
+                       addarg0="-I"
+                       addfile="$1"
+               elif [ "$1" = "--add" ]; then 
+                       shift   
+                       addarg0="-K -I"
+                       addfile="$1"
+               elif [ "$1" = "--maxiterate" ]; then 
+                       shift   
+                       iterate=`expr "$1" - 0` 
+               elif [ "$1" = "--retree" ]; then 
+                       shift   
+                       cycle=`expr "$1" - 0`
+               elif [ "$1" = "--aamatrix" ]; then 
+                       shift   
+                       sbstmodel=" -b -1 "
+                       aamatrix="$1"
+               elif [ "$1" = "--treein" ]; then 
+                       shift   
+                       treeinopt=" -U "
+                       treein=1
+                       treeinfile="$1"
+               elif [ "$1" = "--topin" ]; then 
+                       shift   
+                       treeinopt=" -V "
+                       treein=1
+                       treeinfile="$1"
+                       echo "The --topin option has been disabled." 1>&2
+                       echo "There was a bug in version < 6.530."   1>&2
+                       echo "This bug has not yet been fixed."      1>&2
+                       exit 1
+               elif [ "$1" = "--kappa" ]; then 
+                       shift   
+                       kappa=" -k $1 "
+               elif [ "$1" = "--fmodel" ]; then 
+                       fmodel=" -a "
+               elif [ "$1" = "--jtt" ]; then 
+                       shift   
+                       sbstmodel=" -j $1"
+               elif [ "$1" = "--kimura" ]; then 
+                       shift   
+                       sbstmodel=" -j $1"
+               elif [ "$1" = "--tm" ]; then 
+                       shift   
+                       sbstmodel=" -m $1"
+               elif [ "$1" = "--bl" ]; then 
+                       shift   
+                       sbstmodel=" -b $1"
+               elif [ "$1" = "--weighti" ]; then
+                       shift   
+                       weighti="$1"
+               elif [ "$1" = "--weightr" ]; then
+                       shift   
+                       weightr="$1"
+               elif [ "$1" = "--weightm" ]; then
+                       shift   
+                       weightm="$1"
+               elif [ "$1" = "--rnaalifold" ]; then
+                       rnaalifold=1
+               elif [ "$1" = "--mccaskill" ]; then
+                       mccaskill=1
+                       contrafold=0
+               elif [ "$1" = "--contrafold" ]; then
+                       mccaskill=0
+                       contrafold=1
+               elif [ "$1" = "--ribosum" ]; then
+                       rnascoremtx=" -s "
+               elif [ "$1" = "--op" ]; then 
+                       shift   
+                       gop="$1"
+               elif [ "$1" = "--ep" ]; then 
+                       shift   
+                       aof="$1"
+               elif [ "$1" = "--rop" ]; then 
+                       shift   
+                       rgop="$1"
+               elif [ "$1" = "--rep" ]; then 
+                       shift   
+                       rgep="$1"
+               elif [ "$1" = "--lop" ]; then 
+                       shift   
+                       lgop="$1"
+               elif [ "$1" = "--LOP" ]; then 
+                       shift   
+                       LGOP="$1"
+               elif [ "$1" = "--lep" ]; then 
+                       shift   
+                       laof="$1"
+               elif [ "$1" = "--lexp" ]; then 
+                       shift   
+                       lexp="$1"
+               elif [ "$1" = "--LEXP" ]; then 
+                       shift   
+                       LEXP="$1"
+               elif [ "$1" = "--GEXP" ]; then 
+                       shift   
+                       GEXP="$1"
+               elif [ "$1" = "--GOP" ]; then 
+                       shift   
+                       GGOP="$1"
+               elif [ "$1" = "--gop" ]; then 
+                       shift   
+                       pggop="$1"
+               elif [ "$1" = "--gep" ]; then 
+                       shift   
+                       pgaof="$1"
+               elif [ "$1" = "--gexp" ]; then 
+                       shift   
+                       pgexp="$1"
+               elif [ "$1" = "--laraparams" ]; then 
+                       shift   
+                       laraparams="$1"
+               elif [ "$1" = "--corethr" ]; then 
+                       shift   
+                       corethr="$1"
+               elif [ "$1" = "--corewin" ]; then 
+                       shift   
+                       corewin="$1"
+               elif [ "$1" = "--seedtable" ]; then
+                       shift
+                       seedtable="y"
+                       seedtablefile="$1"
+               elif [ "$1" = "--seed" ]; then
+                       shift
+                       seed="m"
+                       seedfiles="$seedfiles $1"
+               elif [ $progname = "fftns" -o  $progname = "nwns" ]; then
+                       if [ "$1" -gt 0 ]; then
+                               cycle=`expr "$1" - 0`
+                       fi
+               else
+                       echo "Unknown option:  $1" 1>&2
+                       er=1;
+               fi
+               shift   
+       done;
+
+
+
+#      TMPFILE=/tmp/$progname.$$
+       TMPFILE=`mktemp -dt $progname.XXXXXXXXXX`
+       if [ $? -ne 0 ]; then
+               echo "mktemp seems to be obsolete. Re-trying without -t" 1>&2
+               TMPFILE=`mktemp -d /tmp/$progname.XXXXXXXXXX`
+       fi      
+       umask 077
+#      mkdir  $TMPFILE  || er=1
+       if [ $debug -eq 1 ]; then
+               trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0
+       else
+               trap "rm -rf $TMPFILE " 0
+       fi
+       if [ $# -eq 1 ]; then
+               if [ -r "$1" -o "$1" = - ]; then
+
+                       if [ -r "$addfile" ]; then
+                               printf '';
+                       else
+                               echo "$0": Cannot open "$addfile". 1>&2
+                               exit 1;
+                       fi
+
+                       cat "$1"              | tr "\r" "\n" > $TMPFILE/infile 
+                       echo ""                             >> $TMPFILE/infile
+                       cat "$addfile"        | tr "\r" "\n" | grep -v "^$" >> $TMPFILE/infile
+                       cat "$addfile"        | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_addfile
+                       cat "$aamatrix"       | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_aamtx
+                       cat "$treeinfile"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_guidetree
+                       cat "$seedtablefile"  | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_seedtablefile
+                       cat "$laraparams"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_lara.params
+#                      echo $seedfiles
+                       infilename="$1"
+                       seedfilesintmp="/dev/null"
+                       seednseq="0"
+                       set $seedfiles > /dev/null
+                       while [ $# -gt 1 ];
+                       do
+                               shift
+                               if [ -r "$1" ]; then
+                                       cat "$1" | tr "\r" "\n" >  $TMPFILE/seed$#
+                               else
+                                       echo "$0": Cannot open "$1". 1>&2
+                                       exit 1;
+                               fi
+                               seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#`
+                               seedfilesintmp=$seedfilesintmp" "seed$#
+                       done
+#                      ls $TMPFILE
+#                      echo $seedfilesintmp
+#                      echo $seednseq
+
+
+               else
+                       echo "$0": Cannot open "$1". 1>&2
+                       er=1
+#                      exit 1;
+               fi
+       else
+               echo '$#'"=$#" 1>&2
+               er=1
+       fi
+
+
+       if [ $os != "linux" ]; then
+               numthreads=0
+       fi
+
+       if [ $numthreads -eq 0 -a $parallelizationstrategy = "BESTFIRST" ]; then
+               echo 'Impossible' 1>&2;
+               exit 1;
+       fi
+
+       if [ $auto -eq 1 ]; then
+               "$prefix/countlen" < $TMPFILE/infile > $TMPFILE/size
+               nseq=`awk '{print $1}' $TMPFILE/size`
+               nlen=`awk '{print $3}' $TMPFILE/size`
+               if [ $nlen -lt 2000 -a $nseq -lt 100 ]; then
+                       distance="local"
+                       iterate=1000
+               elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
+                       distance="sixtuples"
+                       iterate=2
+               else
+                       distance="sixtuples"
+                       iterate=0
+               fi
+               if [ $quiet -eq 0 ]; then
+                       echo "nseq = " $nseq              1>&2
+                       echo "nlen = " $nlen              1>&2
+                       echo "distance = " $distance      1>&2
+                       echo "iterate = " $iterate        1>&2
+               fi
+       fi
+
+       if [ $parallelizationstrategy = "BESTFIRST" -o  $parallelizationstrategy = "BAATARI0" ]; then
+               iteratelimit=254
+       else
+               iteratelimit=16
+       fi
+       if [ $iterate -gt $iteratelimit ]; then    #??
+               iterate=$iteratelimit
+       fi
+
+       if [ $rnaalifold -eq 1 ]; then
+               rnaopt=" -e $rgep -o $rgop -c $weightm -r $weightr -R $rnascoremtx "
+#              rnaoptit=" -o $rgop -BT -c $weightm -r $weightr -R "
+               rnaoptit=" -o $rgop -F -c $weightm -r $weightr -R "
+       elif [ $mccaskill -eq 1 -o $contrafold -eq 1 ]; then
+               rnaopt=" -o $rgop -c $weightm -r $weightr "
+#              rnaoptit=" -e $rgep -o $rgop -BT -c $weightm -r $weightr $rnascoremtx "
+               rnaoptit=" -e $rgep -o $rgop -F -c $weightm -r $weightr $rnascoremtx "
+       else
+               rnaopt="  "
+               rnaoptit=" -F "
+       fi
+
+       model="$sbstmodel $kappa $fmodel"
+
+       if [ $er -eq 1 ]; then
+               echo "------------------------------------------------------------------------------" 1>&2
+               echo "  MAFFT" $version 1>&2
+#              echo "" 1>&2
+#              echo "  Input format: fasta" 1>&2
+#              echo ""  1>&2
+#              echo "  Usage: `basename $0` [options] inputfile > outputfile" 1>&2
+           echo "  http://mafft.cbrc.jp/alignment/software/" 1>&2
+               echo "  NAR 30:3059-3066 (2002), Briefings in Bioinformatics 9:286-298 (2008)"        1>&2
+#              echo "------------------------------------------------------------------------------" 1>&2
+#              echo "  % mafft in > out" 1>&2
+               echo "------------------------------------------------------------------------------" 1>&2
+#              echo ""  1>&2
+               echo "High speed:" 1>&2
+               echo "  % mafft in > out" 1>&2
+               echo "  % mafft --retree 1 in > out (fast)" 1>&2
+               echo "" 1>&2
+               echo "High accuracy (for <~200 sequences x <~2,000 aa/nt):" 1>&2
+               echo "  % mafft --maxiterate 1000 --localpair  in > out (% linsi in > out is also ok)" 1>&2
+               echo "  % mafft --maxiterate 1000 --genafpair  in > out (% einsi in > out)" 1>&2
+               echo "  % mafft --maxiterate 1000 --globalpair in > out (% ginsi in > out)" 1>&2
+               echo "" 1>&2
+               echo "If unsure which option to use:" 1>&2
+               echo "  % mafft --auto in > out" 1>&2
+               echo "" 1>&2
+#              echo "Other options:" 1>&2
+               echo "--op # :         Gap opening penalty, default: 1.53" 1>&2
+               echo "--ep # :         Offset (works like gap extension penalty), default: 0.0" 1>&2
+               echo "--maxiterate # : Maximum number of iterative refinement, default: 0" 1>&2
+               echo "--clustalout :   Output: clustal format, default: fasta" 1>&2
+               echo "--reorder :      Outorder: aligned, default: input order" 1>&2
+               echo "--quiet :        Do not report progress" 1>&2
+               echo "--thread # :     Number of threads. (# must be <= number of physical cores - 1)" 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --localpair in > out (L-INS-i)" 1>&2
+#              echo " most accurate in many cases, assumes only one alignable domain" 1>&2 
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --genafpair in > out (E-INS-i)" 1>&2
+#              echo " works well if many unalignable residues exist between alignable domains" 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2
+#              echo " suitable for globally alignable sequences            " 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2
+#              echo " accurate and slow, iterative refinement method      " 1>&2
+#              echo "" 1>&2
+#              echo "If the input sequences are long (~1,000,000nt)," 1>&2
+#              echo " % mafft --retree 1 --memsave --fft in > out (FFT-NS-1-memsave, new in v5.8)" 1>&2
+#              echo "" 1>&2
+#              echo "If many (~5,000) sequences are to be aligned," 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 1>&2
+#              echo "" 1>&2
+#              echo " --localpair :      All pairwise local alignment information is included"  1>&2
+#              echo "                    to the objective function, default: off"  1>&2
+#              echo " --globalpair :     All pairwise global alignment information is included"  1>&2
+#              echo "                    to the objective function, default: off"  1>&2
+#              echo " --op # :           Gap opening penalty, default: $defaultgop " 1>&2
+#              echo " --ep # :           Offset (works like gap extension penalty), default: $defaultaof " 1>&2
+#              echo " --bl #, --jtt # :  Scoring matrix, default: BLOSUM62" 1>&2
+#              echo "                    Alternatives are BLOSUM (--bl) 30, 45, 62, 80, " 1>&2
+#              echo "                    or JTT (--jtt) # PAM. " 1>&2
+#              echo " --nuc or --amino : Sequence type, default: auto" 1>&2
+#              echo " --retree # :       The number of tree building in progressive method " 1>&2
+#              echo "                    (see the paper for detail), default: $defaultcycle " 1>&2
+#              echo " --maxiterate # :   Maximum number of iterative refinement, default: $defaultiterate " 1>&2
+#              if [ $defaultfft -eq 1 ]; then
+#                      echo " --fft or --nofft:  FFT is enabled or disabled, default: enabled" 1>&2
+#              else
+#                      echo " --fft or --nofft:  FFT is enabled or disabled, default: disabled" 1>&2
+#              fi
+#              echo " --memsave:         Memory saving mode" 1>&2
+#              echo "                    (for long genomic sequences), default: off" 1>&2
+#              echo " --clustalout :     Output: clustal format, default: fasta" 1>&2
+#              echo " --reorder :        Outorder: aligned, default: input order" 1>&2
+#              echo " --quiet :          Do not report progress" 1>&2
+#              echo "-----------------------------------------------------------------------------" 1>&2
+               exit 1; 
+       fi
+       if [ $sw -eq 1 ]; then
+               swopt=" -A "
+       else
+               swopt=" "
+       fi
+
+       if [ $distance = "fasta" -o $partdist = "fasta" ]; then
+               if [ ! "$FASTA_4_MAFFT" ]; then
+                       FASTA_4_MAFFT=`which fasta34`
+               fi
+
+               if [ ! -x "$FASTA_4_MAFFT" ]; then
+                       echo ""       1>&2
+                       echo "== Install FASTA ========================================================" 1>&2
+                       echo "This option requires the fasta34 program (FASTA version x.xx or higher)"   1>&2
+                       echo "installed in your PATH.  If you have the fasta34 program but have renamed" 1>&2
+                       echo "(like /usr/local/bin/myfasta), set the FASTA_4_MAFFT environment variable" 1>&2
+                       echo "to point your fasta34 (like setenv FASTA_4_MAFFT /usr/local/bin/myfasta)." 1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "lara" -o $distance = "slara" ]; then
+               if [ ! -x "$prefix/mafft_lara" ]; then
+                       echo ""       1>&2
+                       echo "== Install LaRA =========================================================" 1>&2
+                       echo "This option requires LaRA (Bauer et al. http://www.planet-lisa.net/)."     1>&2
+                       echo "The executable have to be renamed to 'mafft_lara' and installed into "     1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "A configuration file of LaRA also have to be given"                        1>&2
+                       echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
+                       echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+               if [ ! -s "$laraparams" ]; then
+                       echo ""       1>&2
+                       echo "== Configure LaRA =======================================================" 1>&2
+                       echo "A configuration file of LaRA have to be given"                             1>&2
+                       echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
+                       echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
+       if [ ! -x "$prefix/foldalign210" ]; then
+                       echo ""       1>&2
+                       echo "== Install FOLDALIGN ====================================================" 1>&2
+                       echo "This option requires FOLDALIGN (Havgaard et al. http://foldalign.ku.dk/)." 1>&2
+                       echo "The executable have to be renamed to 'foldalign210' and installed into "   1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "scarna" ]; then
+               if [ ! -x "$prefix/mxscarnamod" ]; then
+                       echo ""       1>&2
+                       echo "== Install MXSCARNA ======================================================" 1>&2
+                       echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
+                       echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
+                       echo "which contains the modified version of MXSCARNA."                           1>&2
+                       echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
+                       echo "==========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $mccaskill -eq 1 ]; then
+               if [ ! -x "$prefix/mxscarnamod" ]; then
+                       echo ""       1>&2
+                       echo "== Install MXSCARNA ======================================================" 1>&2
+                       echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
+                       echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
+                       echo "which contains the modified version of MXSCARNA."                           1>&2
+                       echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
+                       echo "==========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $contrafold -eq 1 ]; then
+               if [ ! -x "$prefix/contrafold" ]; then
+                       echo ""       1>&2
+                       echo "== Install CONTRAfold ===================================================" 1>&2
+                       echo "This option requires CONTRAfold"                                           1>&2
+                       echo "(Do et al. http://contra.stanford.edu/contrafold/)."                       1>&2
+                       echo "The executable 'contrafold' have to be installed into "                    1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+
+#old
+#      if [ $treeout -eq 1 ]; then
+#              parttreeoutopt="-t"
+#              if [ $cycle -eq 0 ]; then
+#                      treeoutopt="-t -T"
+#                      groupsize=1
+#                      iterate=0 
+#                      if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+#                              distance="distonly"
+#                      fi
+#              else
+#                      treeoutopt="-t"
+#              fi
+#      else
+#              parttreeoutopt=" "
+#              if [ $cycle -eq 0 ]; then
+#                      treeoutopt="-t -T"
+#                      iterate=0 
+#                      if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+#                              distance="distonly"
+#                      fi
+#              else
+#                      treeoutopt=" "
+#              fi
+#      fi
+
+#new
+       if [ $cycle -eq 0 ]; then
+               treeoutopt="-t -T"
+               iterate=0 
+               if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+                       distance="distonly"
+               fi
+               if [ $treeout -eq 1 ]; then
+                       parttreeoutopt="-t"
+                       groupsize=1
+               else
+                       parttreeoutopt=" "
+               fi
+               if [ $distout -eq 1 ]; then
+                       distoutopt="-y -T"
+               fi
+       else
+               if [ $treeout -eq 1 ]; then
+                       parttreeoutopt="-t"
+                       treeoutopt="-t"
+               else
+                       parttreeoutopt=" "
+                       treeoutopt=" "
+               fi
+               if [ $distout -eq 1 ]; then
+                       distoutopt="-y"
+               fi
+       fi
+#
+
+       formatcheck=`grep -c '^[[:blank:]]\+>' $TMPFILE/infile | head -1 `
+       if [ $formatcheck -gt 0 ]; then
+               echo "The first character of a description line must be " 1>&2
+               echo "the greater-than (>) symbol, not a blank."           1>&2
+               echo "Please check the format around the following line(s):"  1>&2
+               grep -n '^[[:blank:]]\+>' $TMPFILE/infile  1>&2
+               exit 1
+       fi
+
+       nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 ` 
+       if [ $nseq -eq 2 ]; then
+               cycle=1
+       fi
+       if [ $cycle -gt 3 ]; then
+               cycle=3
+       fi
+
+       if [ $nseq -gt 4000 -a $iterate -gt 1 ]; then
+               echo "Too many sequences to perform iterative refinement!" 1>&2
+               echo "Please use a progressive method." 1>&2
+               exit 1
+       fi
+
+
+       if [ $distance = "sixtuples" -a \( $seed = "x" -a $seedtable = "x" \) ]; then
+               localparam=" "
+       elif [ $distance = "sixtuples" -a \( $seed != "x" -o $seedtable != "x" \) ]; then
+               if [ $cycle -lt 2 ]; then
+                       cycle=2                # nazeda
+               fi
+               if [ $iterate -lt 2 ]; then
+                       echo "############################################################################" 1>&2
+                       echo "# Warning:" 1>&2
+                       echo "#   Progressive alignment method is incompatible with the --seed option." 1>&2
+                       echo "#   Automatically switched to the iterative refinement method." 1>&2
+                       echo "#   " 1>&2
+                       echo "# Also consider using the '--add' option, which is compatible with" 1>&2
+                       echo "#   the progressive method and FASTER than the '--seed' option." 1>&2
+                       echo "#   Usage is:" 1>&2
+                       echo "#   % mafft --add newSequences existingAlignment > output" 1>&2
+                       echo "############################################################################" 1>&2
+                       iterate=2
+               fi
+               localparam="-l "$weighti
+       elif [ $distance = "parttree" ]; then
+               localparam=" "
+               if [ $groupsize -gt -1 ]; then
+                       cycle=1
+               fi
+       else
+               localparam=" -l "$weighti
+               if [ $cycle -gt 1 ]; then  # 09/01/08
+                       cycle=1
+               fi
+       fi
+
+       if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+               aof="0.000"
+       fi
+
+       if [ "$memopt" = " -M -B " -a "$distance" != "sixtuples" ]; then
+               echo "Impossible" 1>&2
+               exit 1
+       fi
+#exit
+
+       if [ $distance = "parttree" ]; then
+               if [ $seed != "x" -o $seedtable != "x" ]; then
+                       echo "Impossible" 1>&2
+                       exit 1
+               fi
+               if [ $iterate -gt 1 ]; then
+                       echo "Impossible" 1>&2
+                       exit 1
+               fi
+               if [ $outorder = "aligned" ]; then
+                       outorder="input"
+               fi
+               outorder="input"   # partorder ga kiku
+               if [ $partdist = "localalign" ]; then
+                       splitopt=" -L "    # -L -l -> fast 
+               elif [ $partdist = "fasta" ]; then
+                       splitopt=" -S "
+               else
+                       splitopt="  "
+               fi
+       fi
+
+
+#      if [ $nseq -gt 5000 ]; then
+#              fft=0
+#      fi
+       if [ $forcefft -eq 1 ]; then
+               param_fft=" -G "
+               fft=1
+       elif [ $fft -eq 1 ]; then
+               param_fft=" -F "
+       else
+               param_fft=" "
+       fi
+
+       if [ $seed != "x" -a $seedtable != "x" ]; then
+                       echo 'Use either one of seedtable and seed.  Not both.' 1>&2
+                       exit 1
+       fi
+#      if [ $seedtable != "x" -a $anysymbol -gt 0 ]; then
+#                      echo 'The combination of --seedtable and --anysymbol is not supported.' 1>&2
+#                      exit 1
+#      fi
+
+       if [ $treein -eq 1 ]; then
+#              if [ $iterate -gt 0 ]; then
+#                      echo 'Not supported yet.' 1>&2
+#                      exit 1
+#              fi
+               cycle=1
+       fi
+
+       if [ "$addarg0" != " " ]; then
+               "$prefix/countlen" < $TMPFILE/_addfile > $TMPFILE/addsize
+               nadd=`awk '{print $1}' $TMPFILE/addsize`
+               if [ $nadd -eq "0" ]; then
+                       echo Check $addfile 1>&2
+                       exit 1;
+               fi
+               addarg="$addarg0 $nadd"
+               cycle=1
+               iterate=0
+               if [ $seed != "x" -o $seedtable != "x" ]; then
+                       echo 'Impossible' 1>&2;
+                       echo 'Use either ONE of --seed, --seedtable, --addprofile and --add.' 1>&2
+                       exit 1;
+               fi
+       fi
+
+       if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
+               if [ $distance = "sixtuples" ]; then
+                       echo 'Not supported.' 1>&2
+                       echo 'Please add --globalpair, --localpair, --scarnapair,' 1>&2
+                       echo '--larapair, --slarapair, --foldalignlocalpair or --foldalignglobalpair' 1>&2
+                       exit 1
+               fi
+       fi
+
+       if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
+               if [ $distance = "scarna" -o $distance = "lara" -o $distance = "slara" -o $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
+                       strategy="X-I"
+               elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then
+                       strategy="Q-I"
+               fi
+       elif [ $distance = "fasta" -a $sw -eq 0 ]; then
+               strategy="F-I"
+       elif [ $distance = "fasta" -a $sw -eq 1 ]; then
+               strategy="H-I"
+       elif [ $distance = "blast" ]; then
+               strategy="B-I"
+       elif [ $distance = "global" -o $distance = "distonly" ]; then
+               strategy="G-I"
+       elif [ $distance = "local" ]; then
+               strategy="L-I"
+       elif [ $distance = "localgenaf" ]; then
+               strategy="E-I"
+       elif [ $distance = "globalgenaf" ]; then
+               strategy="K-I"
+       elif [ $fft -eq 1 ]; then
+               strategy="FFT-"
+       else
+               strategy="NW-"
+       fi
+       strategy=$strategy"NS-"
+       if [ $iterate -gt 0 ]; then
+               strategy=$strategy"i"
+       elif [ $distance = "parttree" ]; then
+               if [ $partdist = "fasta" ]; then
+                       strategy=$strategy"FastaPartTree-"$cycle
+               elif [ $partdist = "localalign" ]; then
+                       strategy=$strategy"DPPartTree-"$cycle
+               else
+                       strategy=$strategy"PartTree-"$cycle
+               fi
+       else
+               strategy=$strategy$cycle
+       fi
+
+       explanation='?'
+       performance='Not tested.'
+       if [ $strategy = "F-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
+               performance='Most accurate, but very slow'
+       elif [ $strategy = "L-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
+               performance='Probably most accurate, very slow'
+       elif [ $strategy = "E-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment with generalized affine gap costs (Altschul 1998)'
+               performance='Suitable for sequences with long unalignable regions, very slow'
+       elif [ $strategy = "G-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with GLOBAL pairwise alignment information'
+               performance='Suitable for sequences of similar lengths, very slow'
+       elif [ $strategy = "X-INS-i" ]; then
+               explanation='RNA secondary structure information is taken into account.'
+               performance='For short RNA sequences only, extremely slow'
+       elif [ $strategy = "F-INS-1" ]; then
+               explanation='Progressive method incorporating LOCAL pairwise alignment information'
+       elif [ $strategy = "L-INS-1" ]; then
+               explanation='Progressive method incorporating LOCAL pairwise alignment information'
+       elif [ $strategy = "G-INS-1" ]; then
+               explanation='Progressive method incorporating GLOBAL pairwise alignment information'
+       elif [ $strategy = "FFT-NS-i" -o $strategy = "NW-NS-i" ]; then
+               explanation='Iterative refinement method (max. '$iterate' iterations)'
+               if [ $iterate -gt 2 ]; then
+                       performance='Accurate but slow'
+               else
+                       performance='Standard'
+               fi
+       elif [ $strategy = "FFT-NS-2" -o $strategy = "NW-NS-2" ]; then
+               explanation='Progressive method (guide trees were built '$cycle' times.)'
+               performance='Fast but rough'
+       elif [ $strategy = "FFT-NS-1" -o $strategy = "NW-NS-1" ]; then
+               explanation='Progressive method (rough guide tree was used.)'
+               performance='Very fast but very rough'
+       fi
+
+       if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
+               outputopt=" -c $strategy -r $TMPFILE/order  "
+       elif [ $outputformat = "clustal" -a $outorder = "input" ]; then
+               outputopt=" -c $strategy  "
+       elif [ $outputformat = "phylip" -a $outorder = "aligned" ]; then
+               outputopt=" -y -r $TMPFILE/order "
+       elif [ $outputformat = "phylip" -a $outorder = "input" ]; then
+               outputopt=" -y "
+       elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then
+               outputopt=" -f -r $TMPFILE/order "
+       else
+               outputopt="null"
+       fi
+       
+       (
+               cd $TMPFILE;
+
+               if [ $quiet -gt 0 ]; then
+
+                       if [ $anysymbol -eq 1 ]; then
+                               mv infile orig
+                               "$prefix/replaceu" -i orig > infile 2>/dev/null || exit 1
+                       fi
+
+                       if [ $seed != "x" ]; then
+                               mv infile infile2
+                               if [ $anysymbol -eq 1 ]; then
+                                       mv orig orig2
+                                       cat /dev/null > orig
+                               fi
+                               cat /dev/null > infile
+                               cat /dev/null > hat3.seed
+                               seedoffset=0
+#                              echo "seednseq="$seednseq
+#                              echo "seedoffset="$seedoffset
+                               set $seednseq > /dev/null
+#                              echo $#
+                               while [ $# -gt 1 ]
+                               do
+                                       shift
+#                                      echo "num="$#
+
+                                       if [ $anysymbol -eq 1 ]; then
+                                               cat seed$# >> orig
+                                               "$prefix/replaceu" -i seed$# -o $seedoffset > clean 2>/dev/null || exit 1
+                                               mv clean seed$#
+                                       fi
+                                       "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile 2>/dev/null || exit 1
+                                       cat hat3 >> hat3.seed
+#                                      echo "$1"
+                                       seedoffset=`expr $seedoffset + $1`
+#                                      echo "$1"
+#                                      echo "seedoffset="$seedoffset
+                               done;
+#                              echo "seedoffset="$seedoffset
+                               if [ $anysymbol -eq 1 ]; then
+                                       "$prefix/replaceu" -i orig2 -o $seedoffset >> infile 2>/dev/null || exit 1  # yarinaoshi
+                                       cat orig2 >> orig
+                               else
+                                       cat infile2 >> infile
+                               fi
+                       elif [ $seedtable != "x" ]; then
+                               cat _seedtablefile > hat3.seed
+                       else
+                               cat /dev/null > hat3.seed
+                       fi
+#                      cat hat3.seed
+
+
+                       if [ $mccaskill -eq 1 ]; then
+                               "$prefix/mccaskillwrap" -C $numthreads -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
+                       elif [ $contrafold -eq 1 ]; then
+                               "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
+                       fi
+                       if [ $distance = "fasta" ]; then
+                               "$prefix/dndfast7" $swopt < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "blast" ]; then
+                               "$prefix/dndblast" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignlocal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignglobal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "slara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "lara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "scarna" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "global" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -F < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "local" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -L < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "globalgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null 2>&1    || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "localgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "distonly" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null  2>&1      || exit 1
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "parttree" ]; then
+                               "$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
+                               mv hat3.seed hat3
+                       else
+                               "$prefix/disttbfast" -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $algopt $treealg $scoreoutarg < infile   > pre 2>/dev/null || exit 1
+                               mv hat3.seed hat3
+                       fi
+                       while [ $cycle -gt 1 ]
+                       do
+                               if [ $distance = "parttree" ]; then
+                                       mv pre infile
+                                       "$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
+                               else
+                                       "$prefix/tbfast" -O $outnum -C $numthreads $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft  $localparam $algopt -J $treealg $scoreoutarg < pre > /dev/null 2>&1 || exit 1
+                               fi
+                               cycle=`expr $cycle - 1`
+                       done
+                       if [ $iterate -gt 0 ]; then
+                               if [ $distance = "sixtuples" ]; then
+                                   "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
+                               fi
+                               "$prefix/dvtditr" -C $numthreads -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof  -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy  $scoreoutarg < pre     > /dev/null 2>&1 || exit 1
+                       fi
+               else
+
+                       if [ $anysymbol -eq 1 ]; then
+                               mv infile orig
+                               "$prefix/replaceu" -i orig > infile || exit 1
+                       fi
+
+                       if [ $seed != "x" ]; then
+                               mv infile infile2
+                               if [ $anysymbol -eq 1 ]; then
+                                       mv orig orig2
+                                       cat /dev/null > orig
+                               fi
+                               cat /dev/null > infile
+                               cat /dev/null > hat3.seed
+                               seedoffset=0
+#                              echo "seednseq="$seednseq
+#                              echo "seedoffset="$seedoffset
+                               set $seednseq > /dev/null
+#                              echo $#
+                               while [ $# -gt 1 ]
+                               do
+                                       shift
+#                                      echo "num="$#
+
+                                       if [ $anysymbol -eq 1 ]; then
+                                               cat seed$# >> orig
+                                               "$prefix/replaceu" -i seed$# -o $seedoffset > clean || exit 1
+                                               mv clean seed$#
+                                       fi
+                                       "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile || exit 1
+                                       cat hat3 >> hat3.seed
+#                                      echo "$1"
+                                       seedoffset=`expr $seedoffset + $1`
+#                                      echo "$1"
+#                                      echo "seedoffset="$seedoffset
+                               done;
+#                              echo "seedoffset="$seedoffset
+                               if [ $anysymbol -eq 1 ]; then
+                                       "$prefix/replaceu" -i orig2 -o $seedoffset >> infile || exit 1 # yarinaoshi
+                                       cat orig2 >> orig
+                               else
+                                       cat infile2 >> infile
+                               fi
+                       elif [ $seedtable != "x" ]; then
+                               cat _seedtablefile > hat3.seed
+                       else
+                               cat /dev/null > hat3.seed
+                       fi
+#                      cat hat3.seed
+
+                       if [ $mccaskill -eq 1 ]; then
+                               "$prefix/mccaskillwrap" -C $numthreads -d "$prefix" -i infile > hat4  || exit 1
+                       elif [ $contrafold -eq 1 ]; then
+                               "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4  || exit 1
+                       fi
+                       if [ $distance = "fasta" ]; then
+                               "$prefix/dndfast7" $swopt < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "blast" ]; then
+                               "$prefix/dndblast" < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "foldalignlocal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignglobal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop  -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "slara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "lara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "scarna" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null   || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "global" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof   -F  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "local" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -L  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "globalgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "localgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "distonly" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null            || exit 1
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "parttree" ]; then
+                               "$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
+                               mv hat3.seed hat3
+                       else
+                               "$prefix/disttbfast" -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft  $algopt $treealg $scoreoutarg < infile   > pre || exit 1
+                               mv hat3.seed hat3
+                       fi
+
+                       while [ $cycle -gt 1 ]
+                       do
+                               if [ $distance = "parttree" ]; then
+                                       mv pre infile
+                                       "$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
+                               else
+                                       "$prefix/tbfast" -O $outnum -C $numthreads $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft $localparam $algopt -J $treealg $scoreoutarg < pre > /dev/null || exit 1
+                               fi
+                               cycle=`expr $cycle - 1`
+                       done
+                       if [ $iterate -gt 0 ]; then
+                               if [ $distance = "sixtuples" ]; then
+                               "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
+                               fi
+                               "$prefix/dvtditr" -C $numthreads -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy  $scoreoutarg < pre     > /dev/null || exit 1
+                       fi
+               fi
+
+               if [ $coreout -eq 1 ]; then
+                       "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2
+                       mv pre2 pre
+               elif [ $anysymbol -eq 1 ]; then
+                       "$prefix/restoreu" -a pre -i orig > restored || exit 1
+                       mv restored pre
+               fi
+
+               if [ $quiet -eq 0 ]; then
+                       echo '' 1>&2
+                       if [ $mccaskill -eq 1 ]; then
+                               echo "RNA base pairing probaility was calculated by the McCaskill algorithm (1)" 1>&2
+                               echo "implemented in Vienna RNA package (2) and MXSCARNA (3), and then" 1>&2
+                               echo "incorporated in the iterative alignment process (4)." 1>&2
+                               echo "(1) McCaskill, 1990, Biopolymers 29:1105-1119" 1>&2
+                               echo "(2) Hofacker et al., 2002, J. Mol. Biol. 319:3724-3732" 1>&2
+                               echo "(3) Tabei et al., 2008, BMC Bioinformatics 9:33" 1>&2
+                               echo "(4) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
+                               echo "" 1>&2
+                       elif [ $contrafold -eq 1 ]; then
+                               echo "RNA base pairing probaility was calculated by the CONTRAfold algorithm (1)" 1>&2
+                               echo "and then incorporated in the iterative alignment process (4)." 1>&2
+                               echo "(1) Do et al., 2006, Bioinformatics 22:e90-98" 1>&2
+                               echo "(2) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
+                               echo "" 1>&2
+                       fi
+                       if [ $distance = "fasta" -o $partdist = "fasta" ]; then
+                               echo "Pairwise alignments were computed by FASTA" 1>&2
+                               echo "(Pearson & Lipman, 1988, PNAS 85:2444-2448)" 1>&2
+                       fi
+                       if [ $distance = "blast" ]; then
+                               echo "Pairwise alignments were computed by BLAST" 1>&2
+                               echo "(Altschul et al., 1997, NAR 25:3389-3402)" 1>&2
+                       fi
+                       if [ $distance = "scarna" ]; then
+                               echo "Pairwise alignments were computed by MXSCARNA" 1>&2
+                               echo "(Tabei et al., 2008, BMC Bioinformatics 9:33)." 1>&2
+                       fi
+                       if [ $distance = "lara" -o $distance = "slara" ]; then
+                               echo "Pairwise alignments were computed by LaRA" 1>&2
+                               echo "(Bauer et al., 2007, BMC Bioinformatics 8:271)." 1>&2
+                       fi
+                       if [ $distance = "foldalignlocal" ]; then
+                               echo "Pairwise alignments were computed by FOLDALIGN (local)" 1>&2
+                               echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
+                       fi
+                       if [ $distance = "foldalignglobal" ]; then
+                               echo "Pairwise alignments were computed by FOLDALIGN (global)" 1>&2
+                               echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
+                       fi
+                       printf "\n" 1>&2
+                       echo 'Strategy:' 1>&2
+                       printf ' '$strategy 1>&2
+                       echo ' ('$performance')' 1>&2
+                       echo ' '$explanation 1>&2
+                       echo '' 1>&2
+                       echo "If unsure which option to use, try 'mafft --auto input > output'." 1>&2
+#                      echo "If long gaps are expected, try 'mafft --ep 0.0 --auto input > output'." 1>&2
+                       echo "If the possibility of long gaps can be excluded, add '--ep 0.123'." 1>&2
+                       echo "For more information, see 'mafft --help', 'mafft --man' and the mafft page." 1>&2
+                       echo '' 1>&2
+               fi
+       )
+
+       if [ "$outputfile" = "" ]; then
+               if [ "$outputopt" = "null" ]; then
+                       cat < $TMPFILE/pre || exit 1
+               else
+                       "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre || exit 1
+               fi
+       else
+               if [ "$outputopt" = "null" ]; then
+                       cat < $TMPFILE/pre > "$outputfile" || exit 1
+               else
+                       "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre > "$outputfile" || exit 1
+               fi
+       fi
+
+       if [ $treeout -eq 1 ]; then
+               cp $TMPFILE/infile.tree "$infilename.tree"
+       fi
+
+       if [ $distout -eq 1 ]; then
+               cp $TMPFILE/hat2 "$infilename.hat2"
+       fi
+
+       exit 0;
+fi
+
+prog="awk"
+
+tmpawk=`which nawk 2>/dev/null | awk '{print $1}'`
+if [ -x "$tmpawk" ]; then
+       prog="$tmpawk"
+fi
+
+tmpawk=`which gawk 2>/dev/null | awk '{print $1}'`
+if [ -x "$tmpawk" ]; then
+       prog="$tmpawk"
+fi
+
+#echo "prog="$prog 1>&2
+
+umask 077
+(
+$prog '
+BEGIN {
+       prefix = ENVIRON["prefix"];
+       version = ENVIRON["version"];
+       myself = ENVIRON["myself"];
+       while( 1 )
+       {
+               options = ""
+               printf( "\n" ) > "/dev/tty";
+               printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
+               printf( "\n" )                                                                           > "/dev/tty";
+               printf( "   MAFFT %s\n", version )                                                       > "/dev/tty";
+               printf( "\n" )                                                                           > "/dev/tty";
+               printf( "        Copyright (c) 2011 Kazutaka Katoh\n" )                                  > "/dev/tty";
+               printf( "        NAR 30:3059-3066, NAR 33:511-518\n" )                                   > "/dev/tty";
+               printf( "        http://mafft.cbrc.jp/alignment/software/\n" )       > "/dev/tty";
+               printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
+               printf( "\n" ) > "/dev/tty";
+       
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Input file? (fasta format)\n@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" )
+                       if( res == 0 || NF == 0 )
+                               continue;
+                       infile = sprintf( "%s", $0 );
+       
+                       res = getline < infile;
+                       close( infile );
+                       if( res == -1 )
+                       {
+                               printf( "%s: No such file.\n\n", infile ) > "/dev/tty";
+                               printf( "Filename extension (eg., .txt) must be typed, if any.\n\n" ) > "/dev/tty";
+                       }
+                       else if( res == 0 )
+                               printf( "%s: Empty.\n", infile ) > "/dev/tty";
+                       else
+                       {
+                               printf( "OK. infile = %s\n\n", infile ) > "/dev/tty";
+                               break;
+                       }
+               }
+               nseq = 0;
+       
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Output file?\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 || NF == 0 )
+                               continue;
+                       else
+                       {
+                               outfile = sprintf( "%s", $0 );
+                               printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
+                               break;
+                       }
+               }
+       
+               while( 1 )
+               {
+                       outargs = "";
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Output format?\n" ) > "/dev/tty";
+                       printf( "  1. Clustal format / Sorted\n" ) > "/dev/tty";
+                       printf( "  2. Clustal format / Input order\n" ) > "/dev/tty";
+                       printf( "  3. Fasta format   / Sorted\n" ) > "/dev/tty";
+                       printf( "  4. Fasta format   / Input order\n" ) > "/dev/tty";
+                       printf( "  5. Phylip format  / Sorted\n" ) > "/dev/tty";
+                       printf( "  6. Phylip format  / Input order\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
+                               continue;
+                       else
+                       {
+                               if( resnum == 1 )
+                                       outargs = "--clustalout --reorder";
+                               else if( resnum == 2 )
+                                       outargs = "--clustalout --inputorder";
+                               else if( resnum == 3 )
+                                       outargs = "--reorder";
+                               else if( resnum == 4 )
+                                       outargs = "--inputorder";
+                               else if( resnum == 5 )
+                                       outargs = "--phylipout --reorder";
+                               else if( resnum == 6 )
+                                       outargs = "--phylipout --inputorder";
+                               else
+                                       continue;
+                               printf( "OK. arguments = %s\n\n", outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+       
+               while( 1 )
+               {
+                       arguments = "";
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Strategy?\n" ) > "/dev/tty";
+                       printf( "  1. --auto\n" ) > "/dev/tty";
+                       printf( "  2. FFT-NS-1 (fast)\n" ) > "/dev/tty";
+                       printf( "  3. FFT-NS-2 (default)\n" ) > "/dev/tty";
+                       printf( "  4. G-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "  5. L-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "  6. E-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
+                               continue;
+                       else
+                       {
+                               if( resnum == 1 )
+                                       arguments = "--auto";
+                               else if( resnum == 2 )
+                                       arguments = "--retree 1";
+                               else if( resnum == 3 )
+                                       arguments = "--retree 2";
+                               else if( resnum == 4 )
+                                       arguments = "--globalpair --maxiterate 16";
+                               else if( resnum == 5 )
+                                       arguments = "--localpair  --maxiterate 16";
+                               else if( resnum == 6 )
+                                       arguments = "--genafpair  --maxiterate 16";
+                               else
+                                       arguments = sprintf( "%s", $0 );
+                               printf( "OK. arguments = %s %s\n\n", arguments, outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+
+
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Additional arguments? (--ep #, --op #, --kappa #, etc)\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 || NF == 0 )
+                       {
+                               break;
+                       }
+                       else
+                       {
+                               addargs = sprintf( "%s", $0 );
+                               printf( "OK. arguments = %s %s %s\n\n", addargs, arguments, outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+
+               arguments = sprintf( "%s %s %s", addargs, arguments, outargs );
+
+               print ""
+               command = sprintf( "\"%s\" %s \"%s\" > \"%s\"", myself, arguments, infile, outfile );
+               gsub( /\\/, "/", command );
+
+
+               printf( "command=\n%s\n", command ) > "/dev/tty";
+       
+       
+               while( 1 )
+               {
+                       go = 0;
+                       printf( "OK?\n" ) > "/dev/tty";
+                       printf( "@ [Y] " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 )
+                               continue;
+                       else if( NF == 0 || $0 ~ /^[Yy]/ )
+                       {
+                               go=1;
+                               break;
+                       }
+                       else
+                               break;
+               }
+               if( go ) break;
+               printf( "\n" ) > "/dev/tty";
+               printf( "\n" ) > "/dev/tty";
+       }
+       system( command );
+       command = sprintf( "less \"%s\"", outfile );
+       system( command );
+       printf( "Press Enter to exit." ) > "/dev/tty";
+       res = getline < "/dev/tty";
+}
+'
+)
+exit 0;
diff --git a/binaries/src/mafft/binaries/mafft-distance b/binaries/src/mafft/binaries/mafft-distance
new file mode 100644 (file)
index 0000000..2dd7778
Binary files /dev/null and b/binaries/src/mafft/binaries/mafft-distance differ
diff --git a/binaries/src/mafft/binaries/mafft-homologs.1 b/binaries/src/mafft/binaries/mafft-homologs.1
new file mode 100644 (file)
index 0000000..a9c9682
--- /dev/null
@@ -0,0 +1,131 @@
+.\"     Title: MAFFT-HOMOLOGS
+.\"    Author: Kazutaka Katoh <katoh_at_bioreg.kyushu-u.ac.jp.>
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\"      Date: 2007-08-14
+.\"    Manual: Mafft Manual
+.\"    Source: mafft-homologs 2.1
+.\"
+.TH "MAFFT\-HOMOLOGS" "1" "2007\-06\-09" "mafft\-homologs 2.1" "Mafft Manual"
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+.RS 0
+mafft\-homologs \- aligns sequences together with homologues automatically collected from SwissProt via NCBI BLAST
+.RE
+.SH "SYNOPSIS"
+.RS 0
+\fBmafft\-homologs\fR [\fBoptions\fR] \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.SH "DESCRIPTION"
+.RS 0
+The accuracy of an alignment of a few distantly related sequences is considerably improved when being aligned together with their close homologs. The reason for the improvement is probably the same as that for PSI\-BLAST. That is, the positions of highly conserved residues, those with many gaps and other additional information is brought by close homologs. According to Katoh et al. (2005), the improvement by adding close homologs is 10% or so, which is comparable to the improvement by incorporating structural information of a pair of sequences. Mafft\-homologs in a mafft server works like this:
+.sp
+.RS 4
+\h'-04' 1.\h'+02'Collect a number (50 by default) of close homologs (E=1e\-10 by default) of the input sequences.
+.RE
+.sp
+.RS 4
+\h'-04' 2.\h'+02'Align the input sequences and homologs all together using the L\-INS\-i strategy.
+.RE
+.sp
+.RS 4
+\h'-04' 3.\h'+02'Remove the homologs.
+.RE
+.RE
+.SH "OPTIONS"
+.RS 0
+.PP
+\fB\-a\fR \fI\fIn\fR\fR
+.RS 4
+The number of collected sequences (default: 50).
+.RE
+.PP
+\fB\-e\fR \fI\fIn\fR\fR
+.RS 4
+Threshold value (default: 1e\-10).
+.RE
+.PP
+\fB\-o\fR \fI\fIxxx\fR\fR
+.RS 4
+Options for mafft (default: " \-\-op 1.53 \-\-ep 0.123 \-\-maxiterate 1000 --localpair --reorder").
+.RE
+.PP
+\fB\-l\fR
+.RS 4
+Locally carries out BLAST searches instead of NCBI BLAST (requires locally installed BLAST and a database).
+.RE
+.PP
+\fB\-f\fR
+.RS 4
+Outputs collected homologues also (default: off).
+.RE
+.PP
+\fB\-w\fR
+.RS 4
+entire sequences are subjected to BLAST search (default: well\-aligned region only)
+.RE
+.RE
+.SH "REQUIREMENTS"
+.RS 0
+.PP
+MAFFT version > 5.58.
+.PP
+Either of
+.RS 4
+.PP
+lynx (when remote BLAST server is used)
+.PP
+BLAST and a protein sequence database (when local BLAST is used)
+.RE
+.RE
+.SH "REFERENCES"
+.RS 0
+.PP
+Katoh, Kuma, Toh and Miyata (Nucleic Acids Res. 33:511\-518, 2005) MAFFT version 5: improvement in accuracy of multiple sequence alignment.
+.RE
+.SH "SEE ALSO"
+.RS 0
+.PP
+\fBmafft\fR(1)
+.RE
+.SH "AUTHORS"
+.RS 0
+.PP
+\fBKazutaka Katoh\fR <\&katoh_at_bioreg.kyushu\-u.ac.jp.\&>
+.sp -1n
+.IP "" 4
+Wrote Mafft.
+.PP
+\fBCharles Plessy\fR <\&charles\-debian\-nospam@plessy.org\&>
+.sp -1n
+.IP "" 4
+Wrote this manpage in DocBook XML for the Debian distribution, using Mafft's homepage as a template.
+.RE
+.SH "COPYRIGHT"
+.RS 0
+Copyright \(co 2002\-2007 Kazutaka Katoh (mafft)
+.br
+Copyright \(co 2007 Charles Plessy (this manpage)
+.br
+.PP
+Mafft and its manpage are offered under the following conditions:
+.PP
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+.sp
+.RS 4
+\h'-04' 1.\h'+02'Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+.RE
+.sp
+.RS 4
+\h'-04' 2.\h'+02'Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+.RE
+.sp
+.RS 4
+\h'-04' 3.\h'+02'The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
+.RE
+.PP
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.br
+.RE
diff --git a/binaries/src/mafft/binaries/mafft-homologs.rb b/binaries/src/mafft/binaries/mafft-homologs.rb
new file mode 100644 (file)
index 0000000..c1a2468
--- /dev/null
@@ -0,0 +1,374 @@
+#!/usr/bin/env ruby
+
+localdb = "sp"        
+# database name from which homologues are collected 
+# by locally installed blast. Leave this if you do 
+# not use the '-l' option.
+
+mafftpath = "/usr/bin/mafft"   
+# path of mafft. "/usr/local/bin/mafft"
+# if mafft is in your command path, "mafft" is ok.
+
+blastpath = "blastall"   
+# path of blastall. 
+# if blastall is in your command path, "blastall" is ok.
+
+# mafft-homologs.rb  v. 2.1 aligns sequences together with homologues 
+# automatically collected from SwissProt via NCBI BLAST.
+#
+# mafft > 5.58 is required
+#
+# Usage:
+#   mafft-homologs.rb [options] input > output
+# Options:
+#   -a #      the number of collected sequences (default: 50)
+#   -e #      threshold value (default: 1e-10)
+#   -o "xxx"  options for mafft 
+#             (default: " --op 1.53 --ep 0.123 --maxiterate 1000")
+#   -l        locally carries out blast searches instead of NCBI blast
+#             (requires locally installed blast and a database)
+#   -f        outputs collected homologues also (default: off)
+#   -w        entire sequences are subjected to BLAST search 
+#             (default: well-aligned region only)
+
+require 'getopts'
+require 'tempfile'
+
+# mktemp
+GC.disable
+temp_vf = Tempfile.new("_vf").path
+temp_if = Tempfile.new("_if").path
+temp_pf = Tempfile.new("_pf").path
+temp_af = Tempfile.new("_af").path
+temp_qf = Tempfile.new("_qf").path
+temp_bf = Tempfile.new("_bf").path
+temp_rid = Tempfile.new("_rid").path
+temp_res = Tempfile.new("_res").path
+
+
+system( mafftpath + " --help > #{temp_vf} 2>&1" )
+pfp = File.open( "#{temp_vf}", 'r' )
+while pfp.gets
+       break if $_ =~ /MAFFT v/
+end
+pfp.close
+if( $_ ) then
+       mafftversion = sub( /^\D*/, "" ).split(" ").slice(0).strip.to_s
+else
+       mafftversion = "0"
+end
+if( mafftversion < "5.58" ) then
+       puts ""
+       puts "======================================================"
+       puts "Install new mafft (v. >= 5.58)"
+       puts "======================================================"
+       puts ""
+       exit
+end
+
+srand ( 0 )
+
+def readfasta( fp, name, seq )
+       nseq = 0
+       tmpseq = ""
+       while fp.gets
+               if $_ =~ /^>/ then
+                       name.push( $_.sub(/>/,"").strip )
+                       seq.push( tmpseq ) if nseq > 0
+                       nseq += 1
+                       tmpseq = ""
+               else
+                       tmpseq += $_.strip
+               end
+       end
+       seq.push( tmpseq )
+       return nseq
+end
+
+nadd = 50
+eval = 1e-10
+local = 0
+fullout = 0
+entiresearch = 0
+corewin = 50
+corethr = 0.3
+mafftopt = " --op 1.53 --ep 0.123 --localpair --maxiterate 1000 --reorder "
+if getopts( "s", "f", "w", "l", "h", "e:", "a:", "o:", "c:", "d:" ) == nil ||  ARGV.length == 0 || $OPT_h then
+       puts "Usage: #{$0} [-h -l -e# -a# -o\"[options for mafft]\"] input_file"
+       exit
+end
+
+if $OPT_c then
+       corewin = $OPT_c.to_i
+end
+if $OPT_d then
+       corethr = $OPT_d.to_f
+end
+if $OPT_w
+       entiresearch = 1
+end
+if $OPT_f
+       fullout = 1
+end
+if $OPT_s
+       fullout = 0
+end
+if $OPT_l
+       local = 1
+end
+if $OPT_e then
+       eval = $OPT_e.to_f
+end
+if $OPT_a then
+       nadd = $OPT_a.to_i
+end
+if $OPT_o then
+       mafftopt += " " + $OPT_o + " "
+end
+
+system "cat " + ARGV.to_s + " > #{temp_if}"
+ar = mafftopt.split(" ")
+nar = ar.length
+for i in 0..(nar-1)
+       if ar[i] == "--seed" then
+               system "cat #{ar[i+1]} >> #{temp_if}"
+       end
+end
+
+nseq = 0
+ifp = File.open( "#{temp_if}", 'r' )
+       while ifp.gets
+               nseq += 1 if $_ =~ /^>/
+       end
+ifp.close
+
+if nseq >= 100 then
+       STDERR.puts "The number of input sequences must be <100."
+       exit
+elsif nseq == 1 then
+       system( "cp #{temp_if}"  + " #{temp_pf}" )
+else
+       STDERR.puts "Performing preliminary alignment .. "
+       if entiresearch == 1 then
+#              system( mafftpath + " --maxiterate 1000 --localpair #{temp_if} > #{temp_pf}" )
+               system( mafftpath + " --maxiterate 0 --retree 2 #{temp_if} > #{temp_pf}" )
+       else
+               system( mafftpath + " --maxiterate 1000 --localpair --core --coreext --corethr #{corethr.to_s} --corewin #{corewin.to_s} #{temp_if} > #{temp_pf}" )
+       end
+end
+
+pfp = File.open( "#{temp_pf}", 'r' )
+inname = []
+inseq = []
+slen = []
+act = []
+nin = 0
+nin = readfasta( pfp, inname, inseq )
+for i in 0..(nin-1)
+       slen.push( inseq[i].gsub(/-/,"").length )
+       act.push( 1 )
+end
+pfp.close
+
+pfp = File.open( "#{temp_if}", 'r' )
+orname = []
+orseq = []
+nin = 0
+nin = readfasta( pfp, orname, orseq )
+pfp.close
+
+allen = inseq[0].length
+for i in 0..(nin-2)
+       for j in (i+1)..(nin-1)
+               next if act[i] == 0
+               next if act[j] == 0
+               pid = 0.0
+               total = 0
+               for a in 0..(allen-1)
+                       next if inseq[i][a,1] == "-" || inseq[j][a,1] == "-"
+                       total += 1
+                       pid += 1.0 if inseq[i][a,1] == inseq[j][a,1]
+               end
+               pid /= total
+#              puts "#{i.to_s}, #{j.to_s}, #{pid.to_s}"
+               if pid > 0.5 then
+                       if slen[i] < slen[j]
+                               act[i] = 0 
+                       else
+                               act[j] = 0 
+                       end
+               end
+       end
+end
+#p act
+
+
+afp = File.open( "#{temp_af}", 'w' )
+
+STDERR.puts "Searching .. \n"
+ids = []
+add = []
+sco = []
+for i in 0..(nin-1)
+       inseq[i].gsub!(/-/,"")
+       afp.puts ">" + orname[i]
+       afp.puts orseq[i]
+
+#      afp.puts ">" + inname[i]
+#      afp.puts inseq[i]
+
+       STDERR.puts "Query (#{i+1}/#{nin})\n" + inname[i]
+       if act[i] == 0 then
+               STDERR.puts "Skip.\n\n"
+               next 
+       end
+
+       if local == 0 then
+               command = "lynx -source 'http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?QUERY=" + inseq[i] + "&DATABASE=swissprot&HITLIST_SIZE=" + nadd.to_s + "&FILTER=L&EXPECT='" + eval.to_s + "'&FORMAT_TYPE=TEXT&PROGRAM=blastp&SERVICE=plain&NCBI_GI=on&PAGE=Proteins&CMD=Put' > #{temp_rid}"
+               system command
+       
+               ridp = File.open( "#{temp_rid}", 'r' )
+               while ridp.gets
+                       break if $_ =~ / RID = (.*)/
+               end
+               ridp.close
+               rid = $1.strip
+               STDERR.puts "Submitted to NCBI. rid = " + rid
+       
+               STDERR.printf "Waiting "
+               while 1 
+                       STDERR.printf "."
+                       sleep 10
+                       command = "lynx -source 'http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?RID=" + rid + "&DESCRIPTIONS=500&ALIGNMENTS=" + nadd.to_s + "&ALIGNMENT_TYPE=Pairwise&OVERVIEW=no&CMD=Get&FORMAT_TYPE=XML' > #{temp_res}"
+                       system command
+                       resp = File.open( "#{temp_res}", 'r' )
+#                      resp.gets
+#                      if $_ =~ /WAITING/ then
+#                              resp.close
+#                              next
+#                      end
+                       while( resp.gets )
+                               break if $_ =~ /QBlastInfoBegin/
+                       end
+                       resp.gets
+                       if $_ =~ /WAITING/ then
+                               resp.close
+                               next
+                       else
+                               resp.close
+                               break
+                       end
+               end
+       else
+#              puts "Not supported"
+#              exit
+               qfp = File.open( "#{temp_qf}", 'w' )
+                       qfp.puts "> "
+                       qfp.puts inseq[i]
+               qfp.close
+               command = blastpath + "  -p blastp  -e #{eval} -b 1000 -m 7 -i #{temp_qf} -d #{localdb} > #{temp_res}"
+               system command
+               resp = File.open( "#{temp_res}", 'r' )
+       end
+       STDERR.puts " Done.\n\n"
+
+       resp = File.open( "#{temp_res}", 'r' )
+       while 1
+               while resp.gets
+                       break if $_ =~ /<Hit_id>(.*)<\/Hit_id>/ || $_ =~ /(<Iteration_stat>)/
+               end
+               id = $1
+               break if $_ =~ /<Iteration_stat>/
+#              p id
+               while resp.gets
+                       break if $_ =~ /<Hsp_bit-score>(.*)<\/Hsp_bit-score>/
+               end
+               score = $1.to_f
+#              p score
+
+               known = ids.index( id )
+               if known != nil then
+                       if sco[known] >= score then
+                               next
+                       else
+                               ids.delete_at( known )
+                               add.delete_at( known )
+                               sco.delete_at( known )
+                       end
+               end
+               while resp.gets
+                       break if $_ =~ /<Hsp_hseq>(.*)<\/Hsp_hseq>/
+               end
+#              break if $1 == nil
+               target = $1.sub( /-/, "" ).sub( /U/, "X" )
+#              p target
+#              STDERR.puts "adding 1 seq"
+               ids.push( id )
+               sco.push( score )
+               add.push( target )
+       end
+       resp.close
+end
+
+n = ids.length
+
+outnum = 0
+while n > 0 && outnum < nadd
+       m = rand( n )
+       afp.puts ">_addedbymaffte_" + ids[m]
+       afp.puts add[m]
+       ids.delete_at( m )
+       add.delete_at( m )
+       n -= 1
+       outnum += 1
+end
+afp.close
+
+STDERR.puts "Performing alignment .. "
+system( mafftpath + mafftopt + " #{temp_af} > #{temp_bf}" )
+STDERR.puts "done."
+
+bfp = File.open( "#{temp_bf}", 'r' )
+outseq = []
+outnam = []
+readfasta( bfp, outnam, outseq )
+bfp.close
+
+outseq2 = []
+outnam2 = []
+
+len = outseq.length
+for i in 0..(len-1)
+#      p outnam[i]
+       if fullout == 0 && outnam[i] =~ /_addedbymaffte_/ then
+               next
+       end
+       outseq2.push( outseq[i] )
+       outnam2.push( outnam[i].sub( /_addedbymaffte_/, "_ho_" ) )
+end
+
+nout = outseq2.length
+len = outseq[0].length
+p = len
+while p>0
+       p -= 1
+    allgap = 1
+    for j in 0..(nout-1)
+               if outseq2[j][p,1] != "-" then
+                       allgap = 0
+                       break
+               end
+    end
+    if allgap == 1 then
+        for j in 0..(nout-1)
+            outseq2[j][p,1] = ""
+        end
+    end
+end
+for i in 0..(nout-1)
+       puts ">" + outnam2[i]
+       puts outseq2[i].gsub( /.{1,60}/, "\\0\n" )
+end
+
+
+system( "rm -rf #{temp_if} #{temp_vf} #{temp_af} #{temp_bf} #{temp_pf} #{temp_qf} #{temp_res} #{temp_rid}" )
diff --git a/binaries/src/mafft/binaries/mafft-profile b/binaries/src/mafft/binaries/mafft-profile
new file mode 100644 (file)
index 0000000..f23b56b
Binary files /dev/null and b/binaries/src/mafft/binaries/mafft-profile differ
diff --git a/binaries/src/mafft/binaries/mafft.1 b/binaries/src/mafft/binaries/mafft.1
new file mode 100644 (file)
index 0000000..8636334
--- /dev/null
@@ -0,0 +1,479 @@
+.\"     Title: MAFFT
+.\"    Author: Kazutaka Katoh <kazutaka.katoh@aist.go.jp>
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\"      Date: 2007-08-14
+.\"    Manual: Mafft Manual
+.\"    Source: mafft 6.240
+.\"
+.TH "MAFFT" "1" "2007\-06\-09" "mafft 6.240" "Mafft Manual"
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "THIS MANUAL IS FOR V6.2XX (2007)"
+Recent versions (v6.8xx; 2010 Nov.) have more features than those described below.
+See also the tips page at 
+http://mafft.cbrc.jp/alignment/software/tips0.html
+.SH "NAME"
+.RS 0
+.sp
+mafft \- Multiple alignment program for amino acid or nucleotide sequences
+.RE
+.SH "SYNOPSIS"
+.RS 0
+.HP 6
+\fBmafft\fR [\fBoptions\fR] \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBlinsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBginsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBeinsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 7
+\fBfftnsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBfftns\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 5
+\fBnwns\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBnwnsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 14
+\fBmafft\-profile\fR \fIgroup1\fR \fIgroup2\fR [>\ \fIoutput\fR]
+.HP
+.sp
+\fIinput\fR, \fIgroup1\fR and \fIgroup2\fR must be in FASTA format.
+.RE
+.SH "DESCRIPTION"
+.RS 0
+\fBMAFFT\fR is a multiple sequence alignment program for unix\-like operating systems. It offers a range of multiple alignment methods.
+.SS "Accuracy\-oriented methods:"
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'L\-INS\-i (probably most accurate; recommended for <200 sequences; iterative refinement method incorporating local pairwise alignment information):
+.HP 6
+\fBmafft\fR \fB\-\-localpair\fR \fB\-\-maxiterate\fR\ \fI1000\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBlinsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'G\-INS\-i (suitable for sequences of similar lengths; recommended for <200 sequences; iterative refinement method incorporating global pairwise alignment information):
+.HP 6
+\fBmafft\fR \fB\-\-globalpair\fR \fB\-\-maxiterate\fR\ \fI1000\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBginsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'E\-INS\-i (suitable for sequences containing large unalignable regions; recommended for <200 sequences):
+.HP 6
+\fBmafft\fR \fB\-\-ep\fR\ \fI0\fR \fB\-\-genafpair\fR \fB\-\-maxiterate\fR\ \fI1000\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBeinsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.br
+
+For E\-INS\-i, the
+\fB\-\-ep\fR
+\fI0\fR
+option is recommended to allow large gaps.
+.RE
+.SS "Speed\-oriented methods:"
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'FFT\-NS\-i (iterative refinement method; two cycles only):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI2\fR \fB\-\-maxiterate\fR\ \fI2\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 7
+\fBfftnsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'FFT\-NS\-i (iterative refinement method; max. 1000 iterations):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI2\fR \fB\-\-maxiterate\fR\ \fI1000\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'FFT\-NS\-2 (fast; progressive method):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI2\fR \fB\-\-maxiterate\fR\ \fI0\fR \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBfftns\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'FFT\-NS\-1 (very fast; recommended for >2000 sequences; progressive method with a rough guide tree):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI1\fR \fB\-\-maxiterate\fR\ \fI0\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'NW\-NS\-i (iterative refinement method without FFT approximation; two cycles only):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI2\fR \fB\-\-maxiterate\fR\ \fI2\fR \fB\-\-nofft\fR\ \fIinput\fR [>\ \fIoutput\fR]
+.HP 7
+\fBnwnsi\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'NW\-NS\-2 (fast; progressive method without the FFT approximation):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI2\fR \fB\-\-maxiterate\fR\ \fI0\fR \fB\-\-nofft\fR\ \fIinput\fR [>\ \fIoutput\fR]
+.HP 6
+\fBnwns\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'NW\-NS\-PartTree\-1 (recommended for ~10,000 to ~50,000 sequences; progressive method with the PartTree algorithm):
+.HP 6
+\fBmafft\fR \fB\-\-retree\fR\ \fI1\fR \fB\-\-maxiterate\fR\ \fI0\fR \fB\-\-nofft\fR\ \fB\-\-parttree\fR \fIinput\fR [>\ \fIoutput\fR]
+.RE
+.SS "Group\-to\-group alignments"
+.HP 6
+.RS 4
+\fBmafft\-profile\fR \fIgroup1\fR \fIgroup2\fR [>\ \fIoutput\fR]
+.sp
+or:
+.sp
+\fBmafft\fR \fB\-\-maxiterate\fR\ \fI1000\fR \fB\-\-seed\fR\ \fIgroup1\fR \fB\-\-seed\fR\ \fIgroup2\fR /dev/null [>\ \fIoutput\fR]
+.RE
+.RE
+.RE
+.SH "OPTIONS"
+.SS "Algorithm"
+.RS 0
+.PP
+\fB\-\-auto\fR
+.RS 4
+Automatically selects an appropriate strategy from L\-INS\-i, FFT\-NS\-i and FFT\-NS\-2, according to data 
+size.  Default: off (always FFT\-NS\-2)
+.RE
+.PP
+\fB\-\-6merpair\fR
+.RS 4
+Distance is calculated based on the number of shared 6mers.  Default: on
+.RE
+.PP
+\fB\-\-globalpair\fR
+.RS 4
+All pairwise alignments are computed with the Needleman\-Wunsch
+algorithm.  More accurate but slower 
+than \-\-6merpair.  Suitable for a set of
+globally alignable sequences.  Applicable to 
+up to ~200 sequences.  A combination with \-\-maxiterate 1000 is recommended (G\-INS\-i).  Default: off (6mer distance is used)
+.RE
+.PP
+\fB\-\-localpair\fR
+.RS 4
+All pairwise alignments are computed with the Smith\-Waterman
+algorithm.  More accurate but slower
+than \-\-6merpair.  Suitable for a set of 
+locally alignable sequences.  Applicable to 
+up to ~200 sequences.  A combination with \-\-maxiterate 1000 is recommended (L\-INS\-i).  Default: off (6mer distance is used)
+.RE
+.PP
+\fB\-\-genafpair\fR
+.RS 4
+All pairwise alignments are computed with a local
+algorithm with the generalized affine gap cost
+(Altschul 1998).  More accurate but slower
+than \-\-6merpair.  Suitable when large internal gaps
+are expected.  Applicable to 
+up to ~200 sequences.  A combination with \-\-maxiterate 1000 is recommended (E\-INS\-i).  Default: off (6mer distance is used)
+.RE
+.\".PP
+.\"\fB\-\-fastswpair\fR
+.\".RS 4
+.\"Distance is calculated based on a FASTA alignment. 
+.\"FASTA is required.  Default: off (6mer distance is used)
+.\".RE
+.PP
+\fB\-\-fastapair\fR
+.RS 4
+All pairwise alignments are computed with FASTA (Pearson and Lipman 1988).
+FASTA is required.  Default: off (6mer distance is used)
+.RE
+.\".PP
+.\"\fB\-\-blastpair\fR
+.\".RS 4
+.\"Distance is calculated based on a BLAST alignment.  BLAST is 
+.\"required.  Default: off (6mer distance is used)
+.\".RE
+.PP
+\fB\-\-weighti\fR \fInumber\fR
+.RS 4
+Weighting factor for the consistency term calculated from pairwise alignments.  Valid when 
+either of \-\-globalpair, \-\-localpair,  \-\-genafpair, \-\-fastapair or 
+\-\-blastpair is selected.  Default: 2.7
+.RE
+.PP
+\fB\-\-retree\fR \fInumber\fR
+.RS 4
+Guide tree is built \fInumber\fR times in the 
+progressive stage.  Valid with 6mer distance.  Default: 2
+.RE
+.PP
+\fB\-\-maxiterate\fR \fInumber\fR
+.RS 4
+\fInumber\fR cycles of iterative refinement are performed.  Default: 0
+.RE
+.PP
+\fB\-\-fft\fR
+.RS 4
+Use FFT approximation in group\-to\-group alignment.  Default: on
+.RE
+.PP
+\fB\-\-nofft\fR
+.RS 4
+Do not use FFT approximation in group\-to\-group alignment.  Default: off
+.RE
+.PP
+\fB\-\-noscore\fR
+.RS 4
+Alignment score is not checked in the iterative refinement stage.  Default: off (score is checked)
+.RE
+.PP
+\fB\-\-memsave\fR
+.RS 4
+Use the Myers\-Miller (1988) algorithm.  Default: automatically turned on when the alignment length exceeds 10,000 (aa/nt).
+.RE
+.PP
+\fB\-\-parttree\fR
+.RS 4
+Use a fast tree\-building method (PartTree, Katoh and Toh 2007) with
+the 6mer distance.  Recommended for a large number (> ~10,000) 
+of sequences are input.  Default: off
+.RE
+.PP
+\fB\-\-dpparttree\fR
+.RS 4
+The PartTree algorithm is used with distances based on DP.  Slightly
+more accurate and slower than \-\-parttree.  Recommended for a large
+number (> ~10,000) of sequences are input.   Default: off
+.RE
+.PP
+\fB\-\-fastaparttree\fR
+.RS 4
+The PartTree algorithm is used with distances based on FASTA.  Slightly more accurate and slower than \-\-parttree.  Recommended for a large number (> ~10,000) of sequences are input.  FASTA is required.  Default: off
+.RE
+.PP
+\fB\-\-partsize\fR \fInumber\fR
+.RS 4
+The number of partitions in the PartTree algorithm.  Default: 50
+.RE
+.PP
+\fB\-\-groupsize\fR \fInumber\fR
+.RS 4
+Do not make alignment larger than \fInumber\fR sequences. Valid only with the \-\-*parttree options.  Default: the number of input sequences
+.RE
+.RE
+.SS "Parameter"
+.RS 0
+.PP
+\fB\-\-op\fR \fInumber\fR
+.RS 4
+Gap opening penalty at group\-to\-group alignment.  Default: 1.53
+.RE
+.PP
+\fB\-\-ep\fR \fInumber\fR
+.RS 4
+Offset value, which works like gap extension penalty, for
+group\-to\-group alignment.  Default: 0.123
+.RE
+.PP
+\fB\-\-lop\fR \fInumber\fR
+.RS 4
+Gap opening penalty at local pairwise 
+alignment.  Valid when
+the \-\-localpair or \-\-genafpair option is selected.  Default: \-2.00
+.RE
+.PP
+\fB\-\-lep\fR \fInumber\fR
+.RS 4
+Offset value at local pairwise alignment.  Valid when
+the \-\-localpair or \-\-genafpair option is selected.  Default: 0.1
+.RE
+.PP
+\fB\-\-lexp\fR \fInumber\fR
+.RS 4
+Gap extension penalty at local pairwise alignment.  Valid when
+the \-\-localpair or \-\-genafpair option is selected.  Default: \-0.1
+.RE
+.PP
+\fB\-\-LOP\fR \fInumber\fR
+.RS 4
+Gap opening penalty to skip the alignment.  Valid when the
+\-\-genafpair option is selected.   Default: \-6.00
+.RE
+.PP
+\fB\-\-LEXP\fR \fInumber\fR
+.RS 4
+Gap extension penalty to skip the alignment.  Valid when the
+\-\-genafpair option is selected.   Default: 0.00
+.RE
+.PP
+\fB\-\-bl\fR \fInumber\fR
+.RS 4
+BLOSUM \fInumber\fR matrix (Henikoff and Henikoff 1992) is used.  \fInumber\fR=30, 45, 62 or 80.  Default: 62
+.RE
+.PP
+\fB\-\-jtt\fR \fInumber\fR
+.RS 4
+JTT PAM \fInumber\fR (Jones et al. 1992) matrix is used.  \fInumber\fR>0.  Default: BLOSUM62
+.RE
+.PP
+\fB\-\-tm\fR \fInumber\fR
+.RS 4
+Transmembrane PAM \fInumber\fR (Jones et al. 1994) matrix is used.  \fInumber\fR>0.  Default: BLOSUM62
+.RE
+.PP
+\fB\-\-aamatrix\fR \fImatrixfile\fR
+.RS 4
+Use a user\-defined AA scoring matrix.  The format of \fImatrixfile\fR is
+the same to that of BLAST.  Ignored when nucleotide sequences are input.   Default: BLOSUM62
+.RE
+.PP
+\fB\-\-fmodel\fR
+.RS 4
+Incorporate the AA/nuc composition information into
+the scoring matrix.  Default: off
+.RE
+.RE
+.SS "Output"
+.RS 0
+.PP
+\fB\-\-clustalout\fR
+.RS 4
+Output format: clustal format.  Default: off (fasta format)
+.RE
+.PP
+\fB\-\-inputorder\fR
+.RS 4
+Output order: same as input.  Default: on
+.RE
+.PP
+\fB\-\-reorder\fR
+.RS 4
+Output order: aligned.  Default: off (inputorder)
+.RE
+.PP
+\fB\-\-treeout\fR
+.RS 4
+Guide tree is output to the \fIinput\fR.tree file.  Default: off
+.RE
+.PP
+\fB\-\-quiet\fR
+.RS 4
+Do not report progress.  Default: off
+.RE
+.RE
+.SS "Input"
+.RS 0
+.PP
+\fB\-\-nuc\fR
+.RS 4
+Assume the sequences are nucleotide.  Default: auto
+.RE
+.PP
+\fB\-\-amino\fR
+.RS 4
+Assume the sequences are amino acid.  Default: auto
+.RE
+.PP
+\fB\-\-seed\fR \fIalignment1\fR [\fB--seed\fR \fIalignment2\fR \fB--seed\fR \fIalignment3\fR ...]
+.RS 4
+Seed alignments given in \fIalignment_n\fR (fasta format) are aligned with 
+sequences in \fIinput\fR.  The alignment within every seed is preserved.
+.RE
+.RE
+.SH "FILES"
+.RS 0
+.PP
+Mafft stores the input sequences and other files in a temporary directory, which by default is located in
+\fI/tmp\fR.
+.RE
+.SH "ENVIONMENT"
+.RS 0
+.PP
+\fBMAFFT_BINARIES\fR
+.RS 4
+Indicates the location of the binary files used by mafft. By default, they are searched in
+\fI/usr/local/lib/mafft\fR, but on Debian systems, they are searched in
+\fI/usr/lib/mafft\fR.
+.RE
+.PP
+\fBFASTA_4_MAFFT\fR
+.RS 4
+This variable can be set to indicate to mafft the location to the fasta34 program if it is not in the PATH.
+.RE
+.RE
+.SH "SEE ALSO"
+.RS 0
+.PP
+
+\fBmafft\-homologs\fR(1)
+.RE
+.SH "REFERENCES"
+.RS 0
+.SS "In English"
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'Katoh and Toh (Bioinformatics 23:372\-374, 2007) PartTree: an algorithm to build an approximate tree from a large number of unaligned sequences (describes the PartTree algorithm).
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'Katoh, Kuma, Toh and Miyata (Nucleic Acids Res. 33:511\-518, 2005) MAFFT version 5: improvement in accuracy of multiple sequence alignment (describes [ancestral versions of] the G\-INS\-i, L\-INS\-i and E\-INS\-i strategies)
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'Katoh, Misawa, Kuma and Miyata (Nucleic Acids Res. 30:3059\-3066, 2002) MAFFT: a novel method for rapid multiple sequence alignment based on fast Fourier transform (describes the FFT\-NS\-1, FFT\-NS\-2 and FFT\-NS\-i strategies)
+.RE
+.SS "In Japanese"
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'Katoh and Misawa (Seibutsubutsuri 46:312\-317, 2006) Multiple Sequence Alignments: the Next Generation
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'Katoh and Kuma (Kagaku to Seibutsu 44:102\-108, 2006) Jissen\-teki Multiple Alignment
+.RE
+.RE
+.SH "AUTHORS"
+.RS 0
+.PP
+\fBKazutaka Katoh\fR <\&kazutaka.katoh_at_aist.go.jp\&>
+.sp -1n
+.IP "" 4
+Wrote Mafft.
+.PP
+\fBCharles Plessy\fR <\&charles\-debian\-nospam_at_plessy.org\&>
+.sp -1n
+.IP "" 4
+Wrote this manpage in DocBook XML for the Debian distribution, using Mafft's homepage as a template.
+.RE
+.SH "COPYRIGHT"
+.RS 0
+Copyright \(co 2002\-2007 Kazutaka Katoh (mafft)
+.br
+Copyright \(co 2007 Charles Plessy (this manpage)
+.br
+.PP
+Mafft and its manpage are offered under the following conditions:
+.PP
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+.sp
+.RS 4
+\h'-04' 1.\h'+02'Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+.RE
+.sp
+.RS 4
+\h'-04' 2.\h'+02'Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+.RE
+.sp
+.RS 4
+\h'-04' 3.\h'+02'The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
+.RE
+.PP
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.br
+.RE
diff --git a/binaries/src/mafft/binaries/mccaskillwrap b/binaries/src/mafft/binaries/mccaskillwrap
new file mode 100644 (file)
index 0000000..8f1a46e
Binary files /dev/null and b/binaries/src/mafft/binaries/mccaskillwrap differ
diff --git a/binaries/src/mafft/binaries/multi2hat3s b/binaries/src/mafft/binaries/multi2hat3s
new file mode 100644 (file)
index 0000000..96b8a96
Binary files /dev/null and b/binaries/src/mafft/binaries/multi2hat3s differ
diff --git a/binaries/src/mafft/binaries/mxscarnamod b/binaries/src/mafft/binaries/mxscarnamod
new file mode 100644 (file)
index 0000000..c873d31
Binary files /dev/null and b/binaries/src/mafft/binaries/mxscarnamod differ
diff --git a/binaries/src/mafft/binaries/pair2hat3s b/binaries/src/mafft/binaries/pair2hat3s
new file mode 100644 (file)
index 0000000..654defa
Binary files /dev/null and b/binaries/src/mafft/binaries/pair2hat3s differ
diff --git a/binaries/src/mafft/binaries/pairash b/binaries/src/mafft/binaries/pairash
new file mode 100644 (file)
index 0000000..abb91cc
Binary files /dev/null and b/binaries/src/mafft/binaries/pairash differ
diff --git a/binaries/src/mafft/binaries/pairlocalalign b/binaries/src/mafft/binaries/pairlocalalign
new file mode 100644 (file)
index 0000000..fb7ad4b
Binary files /dev/null and b/binaries/src/mafft/binaries/pairlocalalign differ
diff --git a/binaries/src/mafft/binaries/regtable2seq b/binaries/src/mafft/binaries/regtable2seq
new file mode 100644 (file)
index 0000000..b6ecafb
Binary files /dev/null and b/binaries/src/mafft/binaries/regtable2seq differ
diff --git a/binaries/src/mafft/binaries/replaceu b/binaries/src/mafft/binaries/replaceu
new file mode 100644 (file)
index 0000000..6e1bdb2
Binary files /dev/null and b/binaries/src/mafft/binaries/replaceu differ
diff --git a/binaries/src/mafft/binaries/restoreu b/binaries/src/mafft/binaries/restoreu
new file mode 100644 (file)
index 0000000..f57e783
Binary files /dev/null and b/binaries/src/mafft/binaries/restoreu differ
diff --git a/binaries/src/mafft/binaries/rnatest b/binaries/src/mafft/binaries/rnatest
new file mode 100644 (file)
index 0000000..b0c9b18
Binary files /dev/null and b/binaries/src/mafft/binaries/rnatest differ
diff --git a/binaries/src/mafft/binaries/score b/binaries/src/mafft/binaries/score
new file mode 100644 (file)
index 0000000..f5a362e
Binary files /dev/null and b/binaries/src/mafft/binaries/score differ
diff --git a/binaries/src/mafft/binaries/seq2regtable b/binaries/src/mafft/binaries/seq2regtable
new file mode 100644 (file)
index 0000000..2fb8589
Binary files /dev/null and b/binaries/src/mafft/binaries/seq2regtable differ
diff --git a/binaries/src/mafft/binaries/setcore b/binaries/src/mafft/binaries/setcore
new file mode 100644 (file)
index 0000000..8d17ec6
Binary files /dev/null and b/binaries/src/mafft/binaries/setcore differ
diff --git a/binaries/src/mafft/binaries/sextet5 b/binaries/src/mafft/binaries/sextet5
new file mode 100644 (file)
index 0000000..4991fd3
Binary files /dev/null and b/binaries/src/mafft/binaries/sextet5 differ
diff --git a/binaries/src/mafft/binaries/splittbfast b/binaries/src/mafft/binaries/splittbfast
new file mode 100644 (file)
index 0000000..cb91ebb
Binary files /dev/null and b/binaries/src/mafft/binaries/splittbfast differ
diff --git a/binaries/src/mafft/binaries/tbfast b/binaries/src/mafft/binaries/tbfast
new file mode 100644 (file)
index 0000000..c9b9167
Binary files /dev/null and b/binaries/src/mafft/binaries/tbfast differ
diff --git a/binaries/src/mafft/scripts/mafft b/binaries/src/mafft/scripts/mafft
new file mode 100644 (file)
index 0000000..7f2efc7
--- /dev/null
@@ -0,0 +1,1658 @@
+#! /bin/sh
+
+
+er=0;
+myself=`dirname "$0"`/`basename "$0"`; export myself
+version="v6.857b (2011/05/30)"; export version
+LANG=C; export LANG
+os=`uname`
+progname=`basename "$0"`
+if [ `echo $os | grep -i cygwin` ]; then
+       os="cygwin"
+elif [ `echo $os | grep -i darwin` ]; then
+       os="darwin"
+elif [ `echo $os | grep -i sunos` ]; then
+       os="sunos"
+elif [ `echo $os | grep -i linux` ]; then
+       os="linux"
+else
+       os="unix"
+fi
+export os
+
+if [ "$MAFFT_BINARIES" ]; then
+       prefix="$MAFFT_BINARIES"
+else
+       prefix=/usr/local/libexec/mafft
+fi
+export prefix
+
+if [ $# -gt 0 ]; then
+       if [ "$1" = "--man" ]; then 
+               man "$prefix/mafft.1"
+               exit 0;
+       fi
+fi
+
+if [ ! -x "$prefix/tbfast" ]; then
+       echo "" 1>&2
+       echo "correctly installed?" 1>&2
+       echo "mafft binaries have to be installed in \$MAFFT_BINARIES" 1>&2
+       echo "or the $prefix directory". 1>&2
+       echo "" 1>&2
+       exit 1
+       er=1
+fi
+
+defaultiterate=0
+defaultcycle=2
+defaultgop="1.53"
+#defaultaof="0.123"
+defaultaof="0.000"
+defaultlaof="0.100"
+defaultlgop="-2.00"
+defaultfft=1
+defaultrough=0
+defaultdistance="sixtuples"
+#defaultdistance="local"
+defaultweighti="2.7"
+defaultweightr="0.0"
+defaultweightm="1.0"
+defaultmccaskill=0
+defaultcontrafold=0
+defaultalgopt="  "
+defaultalgoptit="  "
+defaultsbstmodel=" -b 62 "
+defaultfmodel=" "
+defaultkappa=" "
+if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="scarna"
+       defaultweighti="3.2"
+       defaultweightr="8.0"
+       defaultweightm="2.0"
+       defaultmccaskill=1
+       defaultcontrafold=0
+       defaultalgopt=" -A "
+       defaultalgoptit=" -AB " ## chui
+       defaultaof="0.0"
+       defaultsbstmodel=" -b 62 "
+       defaultkappa=" "
+       defaultfmodel=" -a "
+elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="global"
+       defaultweighti="3.2"
+       defaultweightr="8.0"
+       defaultweightm="2.0"
+       defaultmccaskill=1
+       defaultcontrafold=0
+       defaultalgopt=" -A "
+       defaultalgoptit=" -AB " ## chui
+       defaultaof="0.0"
+       defaultsbstmodel=" -b 62 "
+       defaultkappa=" "
+       defaultfmodel=" -a "
+elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then
+       defaultfft=0
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="local"
+elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then
+       defaultfft=1
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="global"
+elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then
+       defaultfft=0
+       defaultcycle=1
+       defaultiterate=1000
+       defaultdistance="localgenaf"
+elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then
+       defaultfft=1
+       defaultcycle=2
+       defaultdistance="sixtuples"
+elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then
+       defaultfft=1
+       defaultcycle=2
+       defaultiterate=2
+       defaultdistance="sixtuples"
+elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then
+       defaultfft=0
+       defaultcycle=2
+       defaultdistance="sixtuples"
+elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
+       defaultfft=0
+       defaultcycle=2
+       defaultiterate=2
+       defaultdistance="sixtuples"
+fi
+outputfile=""
+namelength=15
+anysymbol=0
+parallelizationstrategy="BAATARI2"
+kappa=$defaultkappa
+sbstmodel=$defaultsbstmodel
+fmodel=$defaultfmodel
+gop=$defaultgop
+aof=$defaultaof
+cycle=$defaultcycle
+iterate=$defaultiterate
+fft=$defaultfft
+rough=$defaultrough
+distance=$defaultdistance
+forcefft=0
+memopt=" "
+weightopt=" "
+GGOP="-6.00"
+LGOP="-6.00"
+LEXP="-0.000"
+GEXP="-0.000"
+lgop=$defaultlgop
+lexp="-0.100"
+laof=$defaultlaof
+pggop="-2.00"
+pgexp="-0.10"
+pgaof="0.10"
+rgop="-1.530"
+rgep="-0.000"
+seqtype="  "
+weighti=$defaultweighti
+weightr=$defaultweightr
+weightm=$defaultweightm
+rnaalifold=0
+mccaskill=$defaultmccaskill
+contrafold=$defaultcontrafold
+quiet=0
+debug=0
+sw=0
+algopt=$defaultalgopt
+algoptit=$defaultalgoptit
+scorecalcopt=" "
+coreout=0
+corethr="0.5"
+corewin="100"
+coreext=" "
+outputformat="pir"
+outorder="input"
+seed="x"
+seedtable="x"
+auto=0
+groupsize=-1
+partsize=50
+partdist="sixtuples"
+partorderopt=" -x "
+treeout=0
+distout=0
+treein=0
+topin=0
+treeinopt="  "
+seedfiles="/dev/null"
+seedtablefile="/dev/null"
+aamatrix="/dev/null"
+treeinfile="/dev/null"
+rnascoremtx=" "
+laraparams="/dev/null"
+foldalignopt=" "
+treealg=" -X "
+scoreoutarg=" "
+numthreads=0
+randomseed=0
+addfile="/dev/null"
+addarg0=" "
+outnum=" "
+if [ $# -gt 0 ]; then
+       while [ $# -gt 1 ];
+       do
+               if [ "$1" = "--auto" ]; then 
+                       auto=1
+               elif [ "$1" = "--anysymbol" ]; then 
+                       anysymbol=1
+               elif [ "$1" = "--preservecase" ]; then 
+                       anysymbol=1
+               elif [ "$1" = "--clustalout" ]; then 
+                       outputformat="clustal"
+               elif [ "$1" = "--phylipout" ]; then 
+                       outputformat="phylip"
+               elif [ "$1" = "--reorder" ]; then 
+                       outorder="aligned"
+                       partorderopt=" "
+               elif [ "$1" = "--inputorder" ]; then 
+                       outorder="input"
+                       partorderopt=" -x "
+               elif [ "$1" = "--unweight" ]; then 
+                       weightopt=" -u "
+               elif [ "$1" = "--algq" ]; then 
+                       algopt=" -Q "
+                       algoptit=" -QB "
+               elif [ "$1" = "--namelength" ]; then 
+                       shift   
+                       namelength=`expr "$1" - 0`
+               elif [ "$1" = "--groupsize" ]; then 
+                       shift   
+                       groupsize=`expr "$1" - 0`
+               elif [ "$1" = "--partsize" ]; then 
+                       shift   
+                       partsize=`expr "$1" - 0`
+               elif [ "$1" = "--parttree" ]; then 
+                       distance="parttree"
+                       partdist="sixtuples"
+               elif [ "$1" = "--dpparttree" ]; then 
+                       distance="parttree"
+                       partdist="localalign"
+               elif [ "$1" = "--fastaparttree" ]; then 
+                       distance="parttree"
+                       partdist="fasta"
+               elif [ "$1" = "--treeout" ]; then 
+                       treeout=1
+               elif [ "$1" = "--distout" ]; then 
+                       distout=1
+               elif [ "$1" = "--fastswpair" ]; then
+                       distance="fasta"
+                       sw=1
+               elif [ "$1" = "--fastapair" ]; then
+                       distance="fasta"
+                       sw=0
+               elif [ "$1" = "--averagelinkage" ]; then
+                       treealg=" -E "
+               elif [ "$1" = "--minimumlinkage" ]; then
+                       treealg=" -q "
+               elif [ "$1" = "--noscore" ]; then
+                       scorecalcopt=" -Z "
+               elif [ "$1" = "--6merpair" ]; then
+                       distance="sixtuples"
+               elif [ "$1" = "--blastpair" ]; then
+                       distance="blast"
+               elif [ "$1" = "--globalpair" ]; then
+                       distance="global"
+               elif [ "$1" = "--localpair" ]; then
+                       distance="local"
+               elif [ "$1" = "--scarnapair" ]; then
+                       distance="scarna"
+               elif [ "$1" = "--larapair" ]; then
+                       distance="lara"
+               elif [ "$1" = "--slarapair" ]; then
+                       distance="slara"
+               elif [ "$1" = "--foldalignpair" ]; then
+                       distance="foldalignlocal"
+               elif [ "$1" = "--foldalignlocalpair" ]; then
+                       distance="foldalignlocal"
+               elif [ "$1" = "--foldalignglobalpair" ]; then
+                       distance="foldalignglobal"
+               elif [ "$1" = "--globalgenafpair" ]; then
+                       distance="globalgenaf"
+               elif [ "$1" = "--localgenafpair" ]; then
+                       distance="localgenaf"
+               elif [ "$1" = "--genafpair" ]; then
+                       distance="localgenaf"
+               elif [ "$1" = "--memsave" ]; then
+                       memopt=" -M -B "         # -B (bunkatsunashi no riyu ga omoidasenai)
+               elif [ "$1" = "--nomemsave" ]; then
+                       memopt=" -N "
+               elif [ "$1" = "--nuc" ]; then 
+                       seqtype=" -D "
+               elif [ "$1" = "--amino" ]; then 
+                       seqtype=" -P "
+               elif [ "$1" = "--fft" ]; then 
+                       fft=1
+                       forcefft=1
+               elif [ "$1" = "--nofft" ]; then 
+                       fft=0
+               elif [ "$1" = "--quiet" ]; then 
+                       quiet=1
+               elif [ "$1" = "--debug" ]; then 
+                       debug=1
+               elif [ "$1" = "--coreext" ]; then 
+                       coreext=" -c "
+               elif [ "$1" = "--core" ]; then 
+                       coreout=1
+               elif [ "$1" = "--out" ]; then 
+                       shift   
+                       outputfile="$1"
+               elif [ "$1" = "--thread" ]; then 
+                       shift
+                       numthreads=`expr "$1" - 0` 
+               elif [ "$1" = "--randomseed" ]; then 
+                       shift
+                       randomseed=`expr "$1" - 0` 
+               elif [ "$1" = "--bestfirst" ]; then 
+                       parallelizationstrategy="BESTFIRST"
+               elif [ "$1" = "--adhoc0" ]; then 
+                       parallelizationstrategy="BAATARI0"
+               elif [ "$1" = "--adhoc1" ]; then 
+                       parallelizationstrategy="BAATARI1"
+               elif [ "$1" = "--adhoc2" ]; then 
+                       parallelizationstrategy="BAATARI2"
+               elif [ "$1" = "--simplehillclimbing" ]; then 
+                       parallelizationstrategy="BAATARI2"
+               elif [ "$1" = "--scoreout" ]; then 
+                       scoreoutarg="-S -B"
+               elif [ "$1" = "--outnum" ]; then 
+                       scoreoutarg="-n"
+               elif [ "$1" = "--addprofile" ]; then 
+                       shift   
+                       addarg0="-I"
+                       addfile="$1"
+               elif [ "$1" = "--add" ]; then 
+                       shift   
+                       addarg0="-K -I"
+                       addfile="$1"
+               elif [ "$1" = "--maxiterate" ]; then 
+                       shift   
+                       iterate=`expr "$1" - 0` 
+               elif [ "$1" = "--retree" ]; then 
+                       shift   
+                       cycle=`expr "$1" - 0`
+               elif [ "$1" = "--aamatrix" ]; then 
+                       shift   
+                       sbstmodel=" -b -1 "
+                       aamatrix="$1"
+               elif [ "$1" = "--treein" ]; then 
+                       shift   
+                       treeinopt=" -U "
+                       treein=1
+                       treeinfile="$1"
+               elif [ "$1" = "--topin" ]; then 
+                       shift   
+                       treeinopt=" -V "
+                       treein=1
+                       treeinfile="$1"
+                       echo "The --topin option has been disabled." 1>&2
+                       echo "There was a bug in version < 6.530."   1>&2
+                       echo "This bug has not yet been fixed."      1>&2
+                       exit 1
+               elif [ "$1" = "--kappa" ]; then 
+                       shift   
+                       kappa=" -k $1 "
+               elif [ "$1" = "--fmodel" ]; then 
+                       fmodel=" -a "
+               elif [ "$1" = "--jtt" ]; then 
+                       shift   
+                       sbstmodel=" -j $1"
+               elif [ "$1" = "--kimura" ]; then 
+                       shift   
+                       sbstmodel=" -j $1"
+               elif [ "$1" = "--tm" ]; then 
+                       shift   
+                       sbstmodel=" -m $1"
+               elif [ "$1" = "--bl" ]; then 
+                       shift   
+                       sbstmodel=" -b $1"
+               elif [ "$1" = "--weighti" ]; then
+                       shift   
+                       weighti="$1"
+               elif [ "$1" = "--weightr" ]; then
+                       shift   
+                       weightr="$1"
+               elif [ "$1" = "--weightm" ]; then
+                       shift   
+                       weightm="$1"
+               elif [ "$1" = "--rnaalifold" ]; then
+                       rnaalifold=1
+               elif [ "$1" = "--mccaskill" ]; then
+                       mccaskill=1
+                       contrafold=0
+               elif [ "$1" = "--contrafold" ]; then
+                       mccaskill=0
+                       contrafold=1
+               elif [ "$1" = "--ribosum" ]; then
+                       rnascoremtx=" -s "
+               elif [ "$1" = "--op" ]; then 
+                       shift   
+                       gop="$1"
+               elif [ "$1" = "--ep" ]; then 
+                       shift   
+                       aof="$1"
+               elif [ "$1" = "--rop" ]; then 
+                       shift   
+                       rgop="$1"
+               elif [ "$1" = "--rep" ]; then 
+                       shift   
+                       rgep="$1"
+               elif [ "$1" = "--lop" ]; then 
+                       shift   
+                       lgop="$1"
+               elif [ "$1" = "--LOP" ]; then 
+                       shift   
+                       LGOP="$1"
+               elif [ "$1" = "--lep" ]; then 
+                       shift   
+                       laof="$1"
+               elif [ "$1" = "--lexp" ]; then 
+                       shift   
+                       lexp="$1"
+               elif [ "$1" = "--LEXP" ]; then 
+                       shift   
+                       LEXP="$1"
+               elif [ "$1" = "--GEXP" ]; then 
+                       shift   
+                       GEXP="$1"
+               elif [ "$1" = "--GOP" ]; then 
+                       shift   
+                       GGOP="$1"
+               elif [ "$1" = "--gop" ]; then 
+                       shift   
+                       pggop="$1"
+               elif [ "$1" = "--gep" ]; then 
+                       shift   
+                       pgaof="$1"
+               elif [ "$1" = "--gexp" ]; then 
+                       shift   
+                       pgexp="$1"
+               elif [ "$1" = "--laraparams" ]; then 
+                       shift   
+                       laraparams="$1"
+               elif [ "$1" = "--corethr" ]; then 
+                       shift   
+                       corethr="$1"
+               elif [ "$1" = "--corewin" ]; then 
+                       shift   
+                       corewin="$1"
+               elif [ "$1" = "--seedtable" ]; then
+                       shift
+                       seedtable="y"
+                       seedtablefile="$1"
+               elif [ "$1" = "--seed" ]; then
+                       shift
+                       seed="m"
+                       seedfiles="$seedfiles $1"
+               elif [ $progname = "fftns" -o  $progname = "nwns" ]; then
+                       if [ "$1" -gt 0 ]; then
+                               cycle=`expr "$1" - 0`
+                       fi
+               else
+                       echo "Unknown option:  $1" 1>&2
+                       er=1;
+               fi
+               shift   
+       done;
+
+
+
+#      TMPFILE=/tmp/$progname.$$
+       TMPFILE=`mktemp -dt $progname.XXXXXXXXXX`
+       if [ $? -ne 0 ]; then
+               echo "mktemp seems to be obsolete. Re-trying without -t" 1>&2
+               TMPFILE=`mktemp -d /tmp/$progname.XXXXXXXXXX`
+       fi      
+       umask 077
+#      mkdir  $TMPFILE  || er=1
+       if [ $debug -eq 1 ]; then
+               trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0
+       else
+               trap "rm -rf $TMPFILE " 0
+       fi
+       if [ $# -eq 1 ]; then
+               if [ -r "$1" -o "$1" = - ]; then
+
+                       if [ -r "$addfile" ]; then
+                               printf '';
+                       else
+                               echo "$0": Cannot open "$addfile". 1>&2
+                               exit 1;
+                       fi
+
+                       cat "$1"              | tr "\r" "\n" > $TMPFILE/infile 
+                       echo ""                             >> $TMPFILE/infile
+                       cat "$addfile"        | tr "\r" "\n" | grep -v "^$" >> $TMPFILE/infile
+                       cat "$addfile"        | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_addfile
+                       cat "$aamatrix"       | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_aamtx
+                       cat "$treeinfile"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_guidetree
+                       cat "$seedtablefile"  | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_seedtablefile
+                       cat "$laraparams"     | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_lara.params
+#                      echo $seedfiles
+                       infilename="$1"
+                       seedfilesintmp="/dev/null"
+                       seednseq="0"
+                       set $seedfiles > /dev/null
+                       while [ $# -gt 1 ];
+                       do
+                               shift
+                               if [ -r "$1" ]; then
+                                       cat "$1" | tr "\r" "\n" >  $TMPFILE/seed$#
+                               else
+                                       echo "$0": Cannot open "$1". 1>&2
+                                       exit 1;
+                               fi
+                               seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#`
+                               seedfilesintmp=$seedfilesintmp" "seed$#
+                       done
+#                      ls $TMPFILE
+#                      echo $seedfilesintmp
+#                      echo $seednseq
+
+
+               else
+                       echo "$0": Cannot open "$1". 1>&2
+                       er=1
+#                      exit 1;
+               fi
+       else
+               echo '$#'"=$#" 1>&2
+               er=1
+       fi
+
+
+       if [ $os != "linux" ]; then
+               numthreads=0
+       fi
+
+       if [ $numthreads -eq 0 -a $parallelizationstrategy = "BESTFIRST" ]; then
+               echo 'Impossible' 1>&2;
+               exit 1;
+       fi
+
+       if [ $auto -eq 1 ]; then
+               "$prefix/countlen" < $TMPFILE/infile > $TMPFILE/size
+               nseq=`awk '{print $1}' $TMPFILE/size`
+               nlen=`awk '{print $3}' $TMPFILE/size`
+               if [ $nlen -lt 2000 -a $nseq -lt 100 ]; then
+                       distance="local"
+                       iterate=1000
+               elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then
+                       distance="sixtuples"
+                       iterate=2
+               else
+                       distance="sixtuples"
+                       iterate=0
+               fi
+               if [ $quiet -eq 0 ]; then
+                       echo "nseq = " $nseq              1>&2
+                       echo "nlen = " $nlen              1>&2
+                       echo "distance = " $distance      1>&2
+                       echo "iterate = " $iterate        1>&2
+               fi
+       fi
+
+       if [ $parallelizationstrategy = "BESTFIRST" -o  $parallelizationstrategy = "BAATARI0" ]; then
+               iteratelimit=254
+       else
+               iteratelimit=16
+       fi
+       if [ $iterate -gt $iteratelimit ]; then    #??
+               iterate=$iteratelimit
+       fi
+
+       if [ $rnaalifold -eq 1 ]; then
+               rnaopt=" -e $rgep -o $rgop -c $weightm -r $weightr -R $rnascoremtx "
+#              rnaoptit=" -o $rgop -BT -c $weightm -r $weightr -R "
+               rnaoptit=" -o $rgop -F -c $weightm -r $weightr -R "
+       elif [ $mccaskill -eq 1 -o $contrafold -eq 1 ]; then
+               rnaopt=" -o $rgop -c $weightm -r $weightr "
+#              rnaoptit=" -e $rgep -o $rgop -BT -c $weightm -r $weightr $rnascoremtx "
+               rnaoptit=" -e $rgep -o $rgop -F -c $weightm -r $weightr $rnascoremtx "
+       else
+               rnaopt="  "
+               rnaoptit=" -F "
+       fi
+
+       model="$sbstmodel $kappa $fmodel"
+
+       if [ $er -eq 1 ]; then
+               echo "------------------------------------------------------------------------------" 1>&2
+               echo "  MAFFT" $version 1>&2
+#              echo "" 1>&2
+#              echo "  Input format: fasta" 1>&2
+#              echo ""  1>&2
+#              echo "  Usage: `basename $0` [options] inputfile > outputfile" 1>&2
+           echo "  http://mafft.cbrc.jp/alignment/software/" 1>&2
+               echo "  NAR 30:3059-3066 (2002), Briefings in Bioinformatics 9:286-298 (2008)"        1>&2
+#              echo "------------------------------------------------------------------------------" 1>&2
+#              echo "  % mafft in > out" 1>&2
+               echo "------------------------------------------------------------------------------" 1>&2
+#              echo ""  1>&2
+               echo "High speed:" 1>&2
+               echo "  % mafft in > out" 1>&2
+               echo "  % mafft --retree 1 in > out (fast)" 1>&2
+               echo "" 1>&2
+               echo "High accuracy (for <~200 sequences x <~2,000 aa/nt):" 1>&2
+               echo "  % mafft --maxiterate 1000 --localpair  in > out (% linsi in > out is also ok)" 1>&2
+               echo "  % mafft --maxiterate 1000 --genafpair  in > out (% einsi in > out)" 1>&2
+               echo "  % mafft --maxiterate 1000 --globalpair in > out (% ginsi in > out)" 1>&2
+               echo "" 1>&2
+               echo "If unsure which option to use:" 1>&2
+               echo "  % mafft --auto in > out" 1>&2
+               echo "" 1>&2
+#              echo "Other options:" 1>&2
+               echo "--op # :         Gap opening penalty, default: 1.53" 1>&2
+               echo "--ep # :         Offset (works like gap extension penalty), default: 0.0" 1>&2
+               echo "--maxiterate # : Maximum number of iterative refinement, default: 0" 1>&2
+               echo "--clustalout :   Output: clustal format, default: fasta" 1>&2
+               echo "--reorder :      Outorder: aligned, default: input order" 1>&2
+               echo "--quiet :        Do not report progress" 1>&2
+               echo "--thread # :     Number of threads. (# must be <= number of physical cores - 1)" 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --localpair in > out (L-INS-i)" 1>&2
+#              echo " most accurate in many cases, assumes only one alignable domain" 1>&2 
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --genafpair in > out (E-INS-i)" 1>&2
+#              echo " works well if many unalignable residues exist between alignable domains" 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2
+#              echo " suitable for globally alignable sequences            " 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2
+#              echo " accurate and slow, iterative refinement method      " 1>&2
+#              echo "" 1>&2
+#              echo "If the input sequences are long (~1,000,000nt)," 1>&2
+#              echo " % mafft --retree 1 --memsave --fft in > out (FFT-NS-1-memsave, new in v5.8)" 1>&2
+#              echo "" 1>&2
+#              echo "If many (~5,000) sequences are to be aligned," 1>&2
+#              echo "" 1>&2
+#              echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 1>&2
+#              echo "" 1>&2
+#              echo " --localpair :      All pairwise local alignment information is included"  1>&2
+#              echo "                    to the objective function, default: off"  1>&2
+#              echo " --globalpair :     All pairwise global alignment information is included"  1>&2
+#              echo "                    to the objective function, default: off"  1>&2
+#              echo " --op # :           Gap opening penalty, default: $defaultgop " 1>&2
+#              echo " --ep # :           Offset (works like gap extension penalty), default: $defaultaof " 1>&2
+#              echo " --bl #, --jtt # :  Scoring matrix, default: BLOSUM62" 1>&2
+#              echo "                    Alternatives are BLOSUM (--bl) 30, 45, 62, 80, " 1>&2
+#              echo "                    or JTT (--jtt) # PAM. " 1>&2
+#              echo " --nuc or --amino : Sequence type, default: auto" 1>&2
+#              echo " --retree # :       The number of tree building in progressive method " 1>&2
+#              echo "                    (see the paper for detail), default: $defaultcycle " 1>&2
+#              echo " --maxiterate # :   Maximum number of iterative refinement, default: $defaultiterate " 1>&2
+#              if [ $defaultfft -eq 1 ]; then
+#                      echo " --fft or --nofft:  FFT is enabled or disabled, default: enabled" 1>&2
+#              else
+#                      echo " --fft or --nofft:  FFT is enabled or disabled, default: disabled" 1>&2
+#              fi
+#              echo " --memsave:         Memory saving mode" 1>&2
+#              echo "                    (for long genomic sequences), default: off" 1>&2
+#              echo " --clustalout :     Output: clustal format, default: fasta" 1>&2
+#              echo " --reorder :        Outorder: aligned, default: input order" 1>&2
+#              echo " --quiet :          Do not report progress" 1>&2
+#              echo "-----------------------------------------------------------------------------" 1>&2
+               exit 1; 
+       fi
+       if [ $sw -eq 1 ]; then
+               swopt=" -A "
+       else
+               swopt=" "
+       fi
+
+       if [ $distance = "fasta" -o $partdist = "fasta" ]; then
+               if [ ! "$FASTA_4_MAFFT" ]; then
+                       FASTA_4_MAFFT=`which fasta34`
+               fi
+
+               if [ ! -x "$FASTA_4_MAFFT" ]; then
+                       echo ""       1>&2
+                       echo "== Install FASTA ========================================================" 1>&2
+                       echo "This option requires the fasta34 program (FASTA version x.xx or higher)"   1>&2
+                       echo "installed in your PATH.  If you have the fasta34 program but have renamed" 1>&2
+                       echo "(like /usr/local/bin/myfasta), set the FASTA_4_MAFFT environment variable" 1>&2
+                       echo "to point your fasta34 (like setenv FASTA_4_MAFFT /usr/local/bin/myfasta)." 1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "lara" -o $distance = "slara" ]; then
+               if [ ! -x "$prefix/mafft_lara" ]; then
+                       echo ""       1>&2
+                       echo "== Install LaRA =========================================================" 1>&2
+                       echo "This option requires LaRA (Bauer et al. http://www.planet-lisa.net/)."     1>&2
+                       echo "The executable have to be renamed to 'mafft_lara' and installed into "     1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "A configuration file of LaRA also have to be given"                        1>&2
+                       echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
+                       echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+               if [ ! -s "$laraparams" ]; then
+                       echo ""       1>&2
+                       echo "== Configure LaRA =======================================================" 1>&2
+                       echo "A configuration file of LaRA have to be given"                             1>&2
+                       echo "mafft-xinsi --larapair --laraparams parameter_file"                        1>&2
+                       echo "mafft-xinsi --slarapair --laraparams parameter_file"                       1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
+       if [ ! -x "$prefix/foldalign210" ]; then
+                       echo ""       1>&2
+                       echo "== Install FOLDALIGN ====================================================" 1>&2
+                       echo "This option requires FOLDALIGN (Havgaard et al. http://foldalign.ku.dk/)." 1>&2
+                       echo "The executable have to be renamed to 'foldalign210' and installed into "   1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $distance = "scarna" ]; then
+               if [ ! -x "$prefix/mxscarnamod" ]; then
+                       echo ""       1>&2
+                       echo "== Install MXSCARNA ======================================================" 1>&2
+                       echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
+                       echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
+                       echo "which contains the modified version of MXSCARNA."                           1>&2
+                       echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
+                       echo "==========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $mccaskill -eq 1 ]; then
+               if [ ! -x "$prefix/mxscarnamod" ]; then
+                       echo ""       1>&2
+                       echo "== Install MXSCARNA ======================================================" 1>&2
+                       echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required."          1>&2
+                       echo "Please 'make' at the 'extensions' directory of the MAFFT source package,"   1>&2
+                       echo "which contains the modified version of MXSCARNA."                           1>&2
+                       echo "http://align.bmr.kyushu-u.ac.jp/mafft/software/source.html "                1>&2
+                       echo "==========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+       if [ $contrafold -eq 1 ]; then
+               if [ ! -x "$prefix/contrafold" ]; then
+                       echo ""       1>&2
+                       echo "== Install CONTRAfold ===================================================" 1>&2
+                       echo "This option requires CONTRAfold"                                           1>&2
+                       echo "(Do et al. http://contra.stanford.edu/contrafold/)."                       1>&2
+                       echo "The executable 'contrafold' have to be installed into "                    1>&2
+                       echo "the $prefix directory. "                                                   1>&2
+                       echo "=========================================================================" 1>&2
+                       echo "" 1>&2
+                       exit 1
+               fi
+       fi
+
+#old
+#      if [ $treeout -eq 1 ]; then
+#              parttreeoutopt="-t"
+#              if [ $cycle -eq 0 ]; then
+#                      treeoutopt="-t -T"
+#                      groupsize=1
+#                      iterate=0 
+#                      if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+#                              distance="distonly"
+#                      fi
+#              else
+#                      treeoutopt="-t"
+#              fi
+#      else
+#              parttreeoutopt=" "
+#              if [ $cycle -eq 0 ]; then
+#                      treeoutopt="-t -T"
+#                      iterate=0 
+#                      if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+#                              distance="distonly"
+#                      fi
+#              else
+#                      treeoutopt=" "
+#              fi
+#      fi
+
+#new
+       if [ $cycle -eq 0 ]; then
+               treeoutopt="-t -T"
+               iterate=0 
+               if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+                       distance="distonly"
+               fi
+               if [ $treeout -eq 1 ]; then
+                       parttreeoutopt="-t"
+                       groupsize=1
+               else
+                       parttreeoutopt=" "
+               fi
+               if [ $distout -eq 1 ]; then
+                       distoutopt="-y -T"
+               fi
+       else
+               if [ $treeout -eq 1 ]; then
+                       parttreeoutopt="-t"
+                       treeoutopt="-t"
+               else
+                       parttreeoutopt=" "
+                       treeoutopt=" "
+               fi
+               if [ $distout -eq 1 ]; then
+                       distoutopt="-y"
+               fi
+       fi
+#
+
+       formatcheck=`grep -c '^[[:blank:]]\+>' $TMPFILE/infile | head -1 `
+       if [ $formatcheck -gt 0 ]; then
+               echo "The first character of a description line must be " 1>&2
+               echo "the greater-than (>) symbol, not a blank."           1>&2
+               echo "Please check the format around the following line(s):"  1>&2
+               grep -n '^[[:blank:]]\+>' $TMPFILE/infile  1>&2
+               exit 1
+       fi
+
+       nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 ` 
+       if [ $nseq -eq 2 ]; then
+               cycle=1
+       fi
+       if [ $cycle -gt 3 ]; then
+               cycle=3
+       fi
+
+       if [ $nseq -gt 4000 -a $iterate -gt 1 ]; then
+               echo "Too many sequences to perform iterative refinement!" 1>&2
+               echo "Please use a progressive method." 1>&2
+               exit 1
+       fi
+
+
+       if [ $distance = "sixtuples" -a \( $seed = "x" -a $seedtable = "x" \) ]; then
+               localparam=" "
+       elif [ $distance = "sixtuples" -a \( $seed != "x" -o $seedtable != "x" \) ]; then
+               if [ $cycle -lt 2 ]; then
+                       cycle=2                # nazeda
+               fi
+               if [ $iterate -lt 2 ]; then
+                       echo "############################################################################" 1>&2
+                       echo "# Warning:" 1>&2
+                       echo "#   Progressive alignment method is incompatible with the --seed option." 1>&2
+                       echo "#   Automatically switched to the iterative refinement method." 1>&2
+                       echo "#   " 1>&2
+                       echo "# Also consider using the '--add' option, which is compatible with" 1>&2
+                       echo "#   the progressive method and FASTER than the '--seed' option." 1>&2
+                       echo "#   Usage is:" 1>&2
+                       echo "#   % mafft --add newSequences existingAlignment > output" 1>&2
+                       echo "############################################################################" 1>&2
+                       iterate=2
+               fi
+               localparam="-l "$weighti
+       elif [ $distance = "parttree" ]; then
+               localparam=" "
+               if [ $groupsize -gt -1 ]; then
+                       cycle=1
+               fi
+       else
+               localparam=" -l "$weighti
+               if [ $cycle -gt 1 ]; then  # 09/01/08
+                       cycle=1
+               fi
+       fi
+
+       if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then
+               aof="0.000"
+       fi
+
+       if [ "$memopt" = " -M -B " -a "$distance" != "sixtuples" ]; then
+               echo "Impossible" 1>&2
+               exit 1
+       fi
+#exit
+
+       if [ $distance = "parttree" ]; then
+               if [ $seed != "x" -o $seedtable != "x" ]; then
+                       echo "Impossible" 1>&2
+                       exit 1
+               fi
+               if [ $iterate -gt 1 ]; then
+                       echo "Impossible" 1>&2
+                       exit 1
+               fi
+               if [ $outorder = "aligned" ]; then
+                       outorder="input"
+               fi
+               outorder="input"   # partorder ga kiku
+               if [ $partdist = "localalign" ]; then
+                       splitopt=" -L "    # -L -l -> fast 
+               elif [ $partdist = "fasta" ]; then
+                       splitopt=" -S "
+               else
+                       splitopt="  "
+               fi
+       fi
+
+
+#      if [ $nseq -gt 5000 ]; then
+#              fft=0
+#      fi
+       if [ $forcefft -eq 1 ]; then
+               param_fft=" -G "
+               fft=1
+       elif [ $fft -eq 1 ]; then
+               param_fft=" -F "
+       else
+               param_fft=" "
+       fi
+
+       if [ $seed != "x" -a $seedtable != "x" ]; then
+                       echo 'Use either one of seedtable and seed.  Not both.' 1>&2
+                       exit 1
+       fi
+#      if [ $seedtable != "x" -a $anysymbol -gt 0 ]; then
+#                      echo 'The combination of --seedtable and --anysymbol is not supported.' 1>&2
+#                      exit 1
+#      fi
+
+       if [ $treein -eq 1 ]; then
+#              if [ $iterate -gt 0 ]; then
+#                      echo 'Not supported yet.' 1>&2
+#                      exit 1
+#              fi
+               cycle=1
+       fi
+
+       if [ "$addarg0" != " " ]; then
+               "$prefix/countlen" < $TMPFILE/_addfile > $TMPFILE/addsize
+               nadd=`awk '{print $1}' $TMPFILE/addsize`
+               if [ $nadd -eq "0" ]; then
+                       echo Check $addfile 1>&2
+                       exit 1;
+               fi
+               addarg="$addarg0 $nadd"
+               cycle=1
+               iterate=0
+               if [ $seed != "x" -o $seedtable != "x" ]; then
+                       echo 'Impossible' 1>&2;
+                       echo 'Use either ONE of --seed, --seedtable, --addprofile and --add.' 1>&2
+                       exit 1;
+               fi
+       fi
+
+       if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
+               if [ $distance = "sixtuples" ]; then
+                       echo 'Not supported.' 1>&2
+                       echo 'Please add --globalpair, --localpair, --scarnapair,' 1>&2
+                       echo '--larapair, --slarapair, --foldalignlocalpair or --foldalignglobalpair' 1>&2
+                       exit 1
+               fi
+       fi
+
+       if [ $mccaskill -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then
+               if [ $distance = "scarna" -o $distance = "lara" -o $distance = "slara" -o $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then
+                       strategy="X-I"
+               elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then
+                       strategy="Q-I"
+               fi
+       elif [ $distance = "fasta" -a $sw -eq 0 ]; then
+               strategy="F-I"
+       elif [ $distance = "fasta" -a $sw -eq 1 ]; then
+               strategy="H-I"
+       elif [ $distance = "blast" ]; then
+               strategy="B-I"
+       elif [ $distance = "global" -o $distance = "distonly" ]; then
+               strategy="G-I"
+       elif [ $distance = "local" ]; then
+               strategy="L-I"
+       elif [ $distance = "localgenaf" ]; then
+               strategy="E-I"
+       elif [ $distance = "globalgenaf" ]; then
+               strategy="K-I"
+       elif [ $fft -eq 1 ]; then
+               strategy="FFT-"
+       else
+               strategy="NW-"
+       fi
+       strategy=$strategy"NS-"
+       if [ $iterate -gt 0 ]; then
+               strategy=$strategy"i"
+       elif [ $distance = "parttree" ]; then
+               if [ $partdist = "fasta" ]; then
+                       strategy=$strategy"FastaPartTree-"$cycle
+               elif [ $partdist = "localalign" ]; then
+                       strategy=$strategy"DPPartTree-"$cycle
+               else
+                       strategy=$strategy"PartTree-"$cycle
+               fi
+       else
+               strategy=$strategy$cycle
+       fi
+
+       explanation='?'
+       performance='Not tested.'
+       if [ $strategy = "F-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
+               performance='Most accurate, but very slow'
+       elif [ $strategy = "L-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information'
+               performance='Probably most accurate, very slow'
+       elif [ $strategy = "E-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment with generalized affine gap costs (Altschul 1998)'
+               performance='Suitable for sequences with long unalignable regions, very slow'
+       elif [ $strategy = "G-INS-i" ]; then
+               explanation='Iterative refinement method (<'$iterate') with GLOBAL pairwise alignment information'
+               performance='Suitable for sequences of similar lengths, very slow'
+       elif [ $strategy = "X-INS-i" ]; then
+               explanation='RNA secondary structure information is taken into account.'
+               performance='For short RNA sequences only, extremely slow'
+       elif [ $strategy = "F-INS-1" ]; then
+               explanation='Progressive method incorporating LOCAL pairwise alignment information'
+       elif [ $strategy = "L-INS-1" ]; then
+               explanation='Progressive method incorporating LOCAL pairwise alignment information'
+       elif [ $strategy = "G-INS-1" ]; then
+               explanation='Progressive method incorporating GLOBAL pairwise alignment information'
+       elif [ $strategy = "FFT-NS-i" -o $strategy = "NW-NS-i" ]; then
+               explanation='Iterative refinement method (max. '$iterate' iterations)'
+               if [ $iterate -gt 2 ]; then
+                       performance='Accurate but slow'
+               else
+                       performance='Standard'
+               fi
+       elif [ $strategy = "FFT-NS-2" -o $strategy = "NW-NS-2" ]; then
+               explanation='Progressive method (guide trees were built '$cycle' times.)'
+               performance='Fast but rough'
+       elif [ $strategy = "FFT-NS-1" -o $strategy = "NW-NS-1" ]; then
+               explanation='Progressive method (rough guide tree was used.)'
+               performance='Very fast but very rough'
+       fi
+
+       if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
+               outputopt=" -c $strategy -r $TMPFILE/order  "
+       elif [ $outputformat = "clustal" -a $outorder = "input" ]; then
+               outputopt=" -c $strategy  "
+       elif [ $outputformat = "phylip" -a $outorder = "aligned" ]; then
+               outputopt=" -y -r $TMPFILE/order "
+       elif [ $outputformat = "phylip" -a $outorder = "input" ]; then
+               outputopt=" -y "
+       elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then
+               outputopt=" -f -r $TMPFILE/order "
+       else
+               outputopt="null"
+       fi
+       
+       (
+               cd $TMPFILE;
+
+               if [ $quiet -gt 0 ]; then
+
+                       if [ $anysymbol -eq 1 ]; then
+                               mv infile orig
+                               "$prefix/replaceu" -i orig > infile 2>/dev/null || exit 1
+                       fi
+
+                       if [ $seed != "x" ]; then
+                               mv infile infile2
+                               if [ $anysymbol -eq 1 ]; then
+                                       mv orig orig2
+                                       cat /dev/null > orig
+                               fi
+                               cat /dev/null > infile
+                               cat /dev/null > hat3.seed
+                               seedoffset=0
+#                              echo "seednseq="$seednseq
+#                              echo "seedoffset="$seedoffset
+                               set $seednseq > /dev/null
+#                              echo $#
+                               while [ $# -gt 1 ]
+                               do
+                                       shift
+#                                      echo "num="$#
+
+                                       if [ $anysymbol -eq 1 ]; then
+                                               cat seed$# >> orig
+                                               "$prefix/replaceu" -i seed$# -o $seedoffset > clean 2>/dev/null || exit 1
+                                               mv clean seed$#
+                                       fi
+                                       "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile 2>/dev/null || exit 1
+                                       cat hat3 >> hat3.seed
+#                                      echo "$1"
+                                       seedoffset=`expr $seedoffset + $1`
+#                                      echo "$1"
+#                                      echo "seedoffset="$seedoffset
+                               done;
+#                              echo "seedoffset="$seedoffset
+                               if [ $anysymbol -eq 1 ]; then
+                                       "$prefix/replaceu" -i orig2 -o $seedoffset >> infile 2>/dev/null || exit 1  # yarinaoshi
+                                       cat orig2 >> orig
+                               else
+                                       cat infile2 >> infile
+                               fi
+                       elif [ $seedtable != "x" ]; then
+                               cat _seedtablefile > hat3.seed
+                       else
+                               cat /dev/null > hat3.seed
+                       fi
+#                      cat hat3.seed
+
+
+                       if [ $mccaskill -eq 1 ]; then
+                               "$prefix/mccaskillwrap" -C $numthreads -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
+                       elif [ $contrafold -eq 1 ]; then
+                               "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
+                       fi
+                       if [ $distance = "fasta" ]; then
+                               "$prefix/dndfast7" $swopt < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "blast" ]; then
+                               "$prefix/dndblast" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignlocal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignglobal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "slara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "lara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "scarna" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "global" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -F < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "local" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -L < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "globalgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null 2>&1    || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "localgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N < infile > /dev/null  2>&1      || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "distonly" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null  2>&1      || exit 1
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "parttree" ]; then
+                               "$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
+                               mv hat3.seed hat3
+                       else
+                               "$prefix/disttbfast" -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $algopt $treealg $scoreoutarg < infile   > pre 2>/dev/null || exit 1
+                               mv hat3.seed hat3
+                       fi
+                       while [ $cycle -gt 1 ]
+                       do
+                               if [ $distance = "parttree" ]; then
+                                       mv pre infile
+                                       "$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
+                               else
+                                       "$prefix/tbfast" -O $outnum -C $numthreads $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft  $localparam $algopt -J $treealg $scoreoutarg < pre > /dev/null 2>&1 || exit 1
+                               fi
+                               cycle=`expr $cycle - 1`
+                       done
+                       if [ $iterate -gt 0 ]; then
+                               if [ $distance = "sixtuples" ]; then
+                                   "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
+                               fi
+                               "$prefix/dvtditr" -C $numthreads -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof  -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy  $scoreoutarg < pre     > /dev/null 2>&1 || exit 1
+                       fi
+               else
+
+                       if [ $anysymbol -eq 1 ]; then
+                               mv infile orig
+                               "$prefix/replaceu" -i orig > infile || exit 1
+                       fi
+
+                       if [ $seed != "x" ]; then
+                               mv infile infile2
+                               if [ $anysymbol -eq 1 ]; then
+                                       mv orig orig2
+                                       cat /dev/null > orig
+                               fi
+                               cat /dev/null > infile
+                               cat /dev/null > hat3.seed
+                               seedoffset=0
+#                              echo "seednseq="$seednseq
+#                              echo "seedoffset="$seedoffset
+                               set $seednseq > /dev/null
+#                              echo $#
+                               while [ $# -gt 1 ]
+                               do
+                                       shift
+#                                      echo "num="$#
+
+                                       if [ $anysymbol -eq 1 ]; then
+                                               cat seed$# >> orig
+                                               "$prefix/replaceu" -i seed$# -o $seedoffset > clean || exit 1
+                                               mv clean seed$#
+                                       fi
+                                       "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile || exit 1
+                                       cat hat3 >> hat3.seed
+#                                      echo "$1"
+                                       seedoffset=`expr $seedoffset + $1`
+#                                      echo "$1"
+#                                      echo "seedoffset="$seedoffset
+                               done;
+#                              echo "seedoffset="$seedoffset
+                               if [ $anysymbol -eq 1 ]; then
+                                       "$prefix/replaceu" -i orig2 -o $seedoffset >> infile || exit 1 # yarinaoshi
+                                       cat orig2 >> orig
+                               else
+                                       cat infile2 >> infile
+                               fi
+                       elif [ $seedtable != "x" ]; then
+                               cat _seedtablefile > hat3.seed
+                       else
+                               cat /dev/null > hat3.seed
+                       fi
+#                      cat hat3.seed
+
+                       if [ $mccaskill -eq 1 ]; then
+                               "$prefix/mccaskillwrap" -C $numthreads -d "$prefix" -i infile > hat4  || exit 1
+                       elif [ $contrafold -eq 1 ]; then
+                               "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4  || exit 1
+                       fi
+                       if [ $distance = "fasta" ]; then
+                               "$prefix/dndfast7" $swopt < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "blast" ]; then
+                               "$prefix/dndblast" < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "foldalignlocal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "foldalignglobal" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop  -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "slara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "lara" ]; then
+                               "$prefix/pairlocalalign" -C $numthreads -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "scarna" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null   || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>&1 || exit 1
+                       elif [ $distance = "global" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof   -F  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "local" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -L  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "globalgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "localgenaf" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model  -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N  < infile > /dev/null     || exit 1
+                               cat hat3.seed hat3 > hatx
+                               mv hatx hat3
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "distonly" ]; then
+                               "$prefix/pairlocalalign"   -C $numthreads $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null            || exit 1
+                               "$prefix/tbfast" $outnum $addarg -C $numthreads $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg $scoreoutarg < infile   > /dev/null || exit 1
+                       elif [ $distance = "parttree" ]; then
+                               "$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
+                               mv hat3.seed hat3
+                       else
+                               "$prefix/disttbfast" -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft  $algopt $treealg $scoreoutarg < infile   > pre || exit 1
+                               mv hat3.seed hat3
+                       fi
+
+                       while [ $cycle -gt 1 ]
+                       do
+                               if [ $distance = "parttree" ]; then
+                                       mv pre infile
+                                       "$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
+                               else
+                                       "$prefix/tbfast" -O $outnum -C $numthreads $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft $localparam $algopt -J $treealg $scoreoutarg < pre > /dev/null || exit 1
+                               fi
+                               cycle=`expr $cycle - 1`
+                       done
+                       if [ $iterate -gt 0 ]; then
+                               if [ $distance = "sixtuples" ]; then
+                               "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
+                               fi
+                               "$prefix/dvtditr" -C $numthreads -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy  $scoreoutarg < pre     > /dev/null || exit 1
+                       fi
+               fi
+
+               if [ $coreout -eq 1 ]; then
+                       "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2
+                       mv pre2 pre
+               elif [ $anysymbol -eq 1 ]; then
+                       "$prefix/restoreu" -a pre -i orig > restored || exit 1
+                       mv restored pre
+               fi
+
+               if [ $quiet -eq 0 ]; then
+                       echo '' 1>&2
+                       if [ $mccaskill -eq 1 ]; then
+                               echo "RNA base pairing probaility was calculated by the McCaskill algorithm (1)" 1>&2
+                               echo "implemented in Vienna RNA package (2) and MXSCARNA (3), and then" 1>&2
+                               echo "incorporated in the iterative alignment process (4)." 1>&2
+                               echo "(1) McCaskill, 1990, Biopolymers 29:1105-1119" 1>&2
+                               echo "(2) Hofacker et al., 2002, J. Mol. Biol. 319:3724-3732" 1>&2
+                               echo "(3) Tabei et al., 2008, BMC Bioinformatics 9:33" 1>&2
+                               echo "(4) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
+                               echo "" 1>&2
+                       elif [ $contrafold -eq 1 ]; then
+                               echo "RNA base pairing probaility was calculated by the CONTRAfold algorithm (1)" 1>&2
+                               echo "and then incorporated in the iterative alignment process (4)." 1>&2
+                               echo "(1) Do et al., 2006, Bioinformatics 22:e90-98" 1>&2
+                               echo "(2) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>&2
+                               echo "" 1>&2
+                       fi
+                       if [ $distance = "fasta" -o $partdist = "fasta" ]; then
+                               echo "Pairwise alignments were computed by FASTA" 1>&2
+                               echo "(Pearson & Lipman, 1988, PNAS 85:2444-2448)" 1>&2
+                       fi
+                       if [ $distance = "blast" ]; then
+                               echo "Pairwise alignments were computed by BLAST" 1>&2
+                               echo "(Altschul et al., 1997, NAR 25:3389-3402)" 1>&2
+                       fi
+                       if [ $distance = "scarna" ]; then
+                               echo "Pairwise alignments were computed by MXSCARNA" 1>&2
+                               echo "(Tabei et al., 2008, BMC Bioinformatics 9:33)." 1>&2
+                       fi
+                       if [ $distance = "lara" -o $distance = "slara" ]; then
+                               echo "Pairwise alignments were computed by LaRA" 1>&2
+                               echo "(Bauer et al., 2007, BMC Bioinformatics 8:271)." 1>&2
+                       fi
+                       if [ $distance = "foldalignlocal" ]; then
+                               echo "Pairwise alignments were computed by FOLDALIGN (local)" 1>&2
+                               echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
+                       fi
+                       if [ $distance = "foldalignglobal" ]; then
+                               echo "Pairwise alignments were computed by FOLDALIGN (global)" 1>&2
+                               echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>&2
+                       fi
+                       printf "\n" 1>&2
+                       echo 'Strategy:' 1>&2
+                       printf ' '$strategy 1>&2
+                       echo ' ('$performance')' 1>&2
+                       echo ' '$explanation 1>&2
+                       echo '' 1>&2
+                       echo "If unsure which option to use, try 'mafft --auto input > output'." 1>&2
+#                      echo "If long gaps are expected, try 'mafft --ep 0.0 --auto input > output'." 1>&2
+                       echo "If the possibility of long gaps can be excluded, add '--ep 0.123'." 1>&2
+                       echo "For more information, see 'mafft --help', 'mafft --man' and the mafft page." 1>&2
+                       echo '' 1>&2
+               fi
+       )
+
+       if [ "$outputfile" = "" ]; then
+               if [ "$outputopt" = "null" ]; then
+                       cat < $TMPFILE/pre || exit 1
+               else
+                       "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre || exit 1
+               fi
+       else
+               if [ "$outputopt" = "null" ]; then
+                       cat < $TMPFILE/pre > "$outputfile" || exit 1
+               else
+                       "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre > "$outputfile" || exit 1
+               fi
+       fi
+
+       if [ $treeout -eq 1 ]; then
+               cp $TMPFILE/infile.tree "$infilename.tree"
+       fi
+
+       if [ $distout -eq 1 ]; then
+               cp $TMPFILE/hat2 "$infilename.hat2"
+       fi
+
+       exit 0;
+fi
+
+prog="awk"
+
+tmpawk=`which nawk 2>/dev/null | awk '{print $1}'`
+if [ -x "$tmpawk" ]; then
+       prog="$tmpawk"
+fi
+
+tmpawk=`which gawk 2>/dev/null | awk '{print $1}'`
+if [ -x "$tmpawk" ]; then
+       prog="$tmpawk"
+fi
+
+#echo "prog="$prog 1>&2
+
+umask 077
+(
+$prog '
+BEGIN {
+       prefix = ENVIRON["prefix"];
+       version = ENVIRON["version"];
+       myself = ENVIRON["myself"];
+       while( 1 )
+       {
+               options = ""
+               printf( "\n" ) > "/dev/tty";
+               printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
+               printf( "\n" )                                                                           > "/dev/tty";
+               printf( "   MAFFT %s\n", version )                                                       > "/dev/tty";
+               printf( "\n" )                                                                           > "/dev/tty";
+               printf( "        Copyright (c) 2011 Kazutaka Katoh\n" )                                  > "/dev/tty";
+               printf( "        NAR 30:3059-3066, NAR 33:511-518\n" )                                   > "/dev/tty";
+               printf( "        http://mafft.cbrc.jp/alignment/software/\n" )       > "/dev/tty";
+               printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
+               printf( "\n" ) > "/dev/tty";
+       
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Input file? (fasta format)\n@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" )
+                       if( res == 0 || NF == 0 )
+                               continue;
+                       infile = sprintf( "%s", $0 );
+       
+                       res = getline < infile;
+                       close( infile );
+                       if( res == -1 )
+                       {
+                               printf( "%s: No such file.\n\n", infile ) > "/dev/tty";
+                               printf( "Filename extension (eg., .txt) must be typed, if any.\n\n" ) > "/dev/tty";
+                       }
+                       else if( res == 0 )
+                               printf( "%s: Empty.\n", infile ) > "/dev/tty";
+                       else
+                       {
+                               printf( "OK. infile = %s\n\n", infile ) > "/dev/tty";
+                               break;
+                       }
+               }
+               nseq = 0;
+       
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Output file?\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 || NF == 0 )
+                               continue;
+                       else
+                       {
+                               outfile = sprintf( "%s", $0 );
+                               printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
+                               break;
+                       }
+               }
+       
+               while( 1 )
+               {
+                       outargs = "";
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Output format?\n" ) > "/dev/tty";
+                       printf( "  1. Clustal format / Sorted\n" ) > "/dev/tty";
+                       printf( "  2. Clustal format / Input order\n" ) > "/dev/tty";
+                       printf( "  3. Fasta format   / Sorted\n" ) > "/dev/tty";
+                       printf( "  4. Fasta format   / Input order\n" ) > "/dev/tty";
+                       printf( "  5. Phylip format  / Sorted\n" ) > "/dev/tty";
+                       printf( "  6. Phylip format  / Input order\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
+                               continue;
+                       else
+                       {
+                               if( resnum == 1 )
+                                       outargs = "--clustalout --reorder";
+                               else if( resnum == 2 )
+                                       outargs = "--clustalout --inputorder";
+                               else if( resnum == 3 )
+                                       outargs = "--reorder";
+                               else if( resnum == 4 )
+                                       outargs = "--inputorder";
+                               else if( resnum == 5 )
+                                       outargs = "--phylipout --reorder";
+                               else if( resnum == 6 )
+                                       outargs = "--phylipout --inputorder";
+                               else
+                                       continue;
+                               printf( "OK. arguments = %s\n\n", outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+       
+               while( 1 )
+               {
+                       arguments = "";
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Strategy?\n" ) > "/dev/tty";
+                       printf( "  1. --auto\n" ) > "/dev/tty";
+                       printf( "  2. FFT-NS-1 (fast)\n" ) > "/dev/tty";
+                       printf( "  3. FFT-NS-2 (default)\n" ) > "/dev/tty";
+                       printf( "  4. G-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "  5. L-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "  6. E-INS-i  (accurate)\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
+                               continue;
+                       else
+                       {
+                               if( resnum == 1 )
+                                       arguments = "--auto";
+                               else if( resnum == 2 )
+                                       arguments = "--retree 1";
+                               else if( resnum == 3 )
+                                       arguments = "--retree 2";
+                               else if( resnum == 4 )
+                                       arguments = "--globalpair --maxiterate 16";
+                               else if( resnum == 5 )
+                                       arguments = "--localpair  --maxiterate 16";
+                               else if( resnum == 6 )
+                                       arguments = "--genafpair  --maxiterate 16";
+                               else
+                                       arguments = sprintf( "%s", $0 );
+                               printf( "OK. arguments = %s %s\n\n", arguments, outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+
+
+               while( 1 )
+               {
+                       printf( "\n" ) > "/dev/tty";
+                       printf( "Additional arguments? (--ep #, --op #, --kappa #, etc)\n" ) > "/dev/tty";
+                       printf( "@ " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 || NF == 0 )
+                       {
+                               break;
+                       }
+                       else
+                       {
+                               addargs = sprintf( "%s", $0 );
+                               printf( "OK. arguments = %s %s %s\n\n", addargs, arguments, outargs ) > "/dev/tty";
+                               break;
+                       }
+               }
+
+               arguments = sprintf( "%s %s %s", addargs, arguments, outargs );
+
+               print ""
+               command = sprintf( "\"%s\" %s \"%s\" > \"%s\"", myself, arguments, infile, outfile );
+               gsub( /\\/, "/", command );
+
+
+               printf( "command=\n%s\n", command ) > "/dev/tty";
+       
+       
+               while( 1 )
+               {
+                       go = 0;
+                       printf( "OK?\n" ) > "/dev/tty";
+                       printf( "@ [Y] " ) > "/dev/tty";
+                       res = getline < "/dev/tty";
+                       close( "/dev/tty" );
+                       if( res == 0 )
+                               continue;
+                       else if( NF == 0 || $0 ~ /^[Yy]/ )
+                       {
+                               go=1;
+                               break;
+                       }
+                       else
+                               break;
+               }
+               if( go ) break;
+               printf( "\n" ) > "/dev/tty";
+               printf( "\n" ) > "/dev/tty";
+       }
+       system( command );
+       command = sprintf( "less \"%s\"", outfile );
+       system( command );
+       printf( "Press Enter to exit." ) > "/dev/tty";
+       res = getline < "/dev/tty";
+}
+'
+)
+exit 0;
diff --git a/binaries/src/mafft/scripts/mafft-homologs.rb b/binaries/src/mafft/scripts/mafft-homologs.rb
new file mode 100644 (file)
index 0000000..a90e0f5
--- /dev/null
@@ -0,0 +1,374 @@
+#!/usr/bin/env ruby
+
+localdb = "sp"        
+# database name from which homologues are collected 
+# by locally installed blast. Leave this if you do 
+# not use the '-l' option.
+
+mafftpath = "/usr/local/bin/mafft"   
+# path of mafft. "/usr/local/bin/mafft"
+# if mafft is in your command path, "mafft" is ok.
+
+blastpath = "blastall"   
+# path of blastall. 
+# if blastall is in your command path, "blastall" is ok.
+
+# mafft-homologs.rb  v. 2.1 aligns sequences together with homologues 
+# automatically collected from SwissProt via NCBI BLAST.
+#
+# mafft > 5.58 is required
+#
+# Usage:
+#   mafft-homologs.rb [options] input > output
+# Options:
+#   -a #      the number of collected sequences (default: 50)
+#   -e #      threshold value (default: 1e-10)
+#   -o "xxx"  options for mafft 
+#             (default: " --op 1.53 --ep 0.123 --maxiterate 1000")
+#   -l        locally carries out blast searches instead of NCBI blast
+#             (requires locally installed blast and a database)
+#   -f        outputs collected homologues also (default: off)
+#   -w        entire sequences are subjected to BLAST search 
+#             (default: well-aligned region only)
+
+require 'getopts'
+require 'tempfile'
+
+# mktemp
+GC.disable
+temp_vf = Tempfile.new("_vf").path
+temp_if = Tempfile.new("_if").path
+temp_pf = Tempfile.new("_pf").path
+temp_af = Tempfile.new("_af").path
+temp_qf = Tempfile.new("_qf").path
+temp_bf = Tempfile.new("_bf").path
+temp_rid = Tempfile.new("_rid").path
+temp_res = Tempfile.new("_res").path
+
+
+system( mafftpath + " --help > #{temp_vf} 2>&1" )
+pfp = File.open( "#{temp_vf}", 'r' )
+while pfp.gets
+       break if $_ =~ /MAFFT v/
+end
+pfp.close
+if( $_ ) then
+       mafftversion = sub( /^\D*/, "" ).split(" ").slice(0).strip.to_s
+else
+       mafftversion = "0"
+end
+if( mafftversion < "5.58" ) then
+       puts ""
+       puts "======================================================"
+       puts "Install new mafft (v. >= 5.58)"
+       puts "======================================================"
+       puts ""
+       exit
+end
+
+srand ( 0 )
+
+def readfasta( fp, name, seq )
+       nseq = 0
+       tmpseq = ""
+       while fp.gets
+               if $_ =~ /^>/ then
+                       name.push( $_.sub(/>/,"").strip )
+                       seq.push( tmpseq ) if nseq > 0
+                       nseq += 1
+                       tmpseq = ""
+               else
+                       tmpseq += $_.strip
+               end
+       end
+       seq.push( tmpseq )
+       return nseq
+end
+
+nadd = 50
+eval = 1e-10
+local = 0
+fullout = 0
+entiresearch = 0
+corewin = 50
+corethr = 0.3
+mafftopt = " --op 1.53 --ep 0.123 --localpair --maxiterate 1000 --reorder "
+if getopts( "s", "f", "w", "l", "h", "e:", "a:", "o:", "c:", "d:" ) == nil ||  ARGV.length == 0 || $OPT_h then
+       puts "Usage: #{$0} [-h -l -e# -a# -o\"[options for mafft]\"] input_file"
+       exit
+end
+
+if $OPT_c then
+       corewin = $OPT_c.to_i
+end
+if $OPT_d then
+       corethr = $OPT_d.to_f
+end
+if $OPT_w
+       entiresearch = 1
+end
+if $OPT_f
+       fullout = 1
+end
+if $OPT_s
+       fullout = 0
+end
+if $OPT_l
+       local = 1
+end
+if $OPT_e then
+       eval = $OPT_e.to_f
+end
+if $OPT_a then
+       nadd = $OPT_a.to_i
+end
+if $OPT_o then
+       mafftopt += " " + $OPT_o + " "
+end
+
+system "cat " + ARGV.to_s + " > #{temp_if}"
+ar = mafftopt.split(" ")
+nar = ar.length
+for i in 0..(nar-1)
+       if ar[i] == "--seed" then
+               system "cat #{ar[i+1]} >> #{temp_if}"
+       end
+end
+
+nseq = 0
+ifp = File.open( "#{temp_if}", 'r' )
+       while ifp.gets
+               nseq += 1 if $_ =~ /^>/
+       end
+ifp.close
+
+if nseq >= 100 then
+       STDERR.puts "The number of input sequences must be <100."
+       exit
+elsif nseq == 1 then
+       system( "cp #{temp_if}"  + " #{temp_pf}" )
+else
+       STDERR.puts "Performing preliminary alignment .. "
+       if entiresearch == 1 then
+#              system( mafftpath + " --maxiterate 1000 --localpair #{temp_if} > #{temp_pf}" )
+               system( mafftpath + " --maxiterate 0 --retree 2 #{temp_if} > #{temp_pf}" )
+       else
+               system( mafftpath + " --maxiterate 1000 --localpair --core --coreext --corethr #{corethr.to_s} --corewin #{corewin.to_s} #{temp_if} > #{temp_pf}" )
+       end
+end
+
+pfp = File.open( "#{temp_pf}", 'r' )
+inname = []
+inseq = []
+slen = []
+act = []
+nin = 0
+nin = readfasta( pfp, inname, inseq )
+for i in 0..(nin-1)
+       slen.push( inseq[i].gsub(/-/,"").length )
+       act.push( 1 )
+end
+pfp.close
+
+pfp = File.open( "#{temp_if}", 'r' )
+orname = []
+orseq = []
+nin = 0
+nin = readfasta( pfp, orname, orseq )
+pfp.close
+
+allen = inseq[0].length
+for i in 0..(nin-2)
+       for j in (i+1)..(nin-1)
+               next if act[i] == 0
+               next if act[j] == 0
+               pid = 0.0
+               total = 0
+               for a in 0..(allen-1)
+                       next if inseq[i][a,1] == "-" || inseq[j][a,1] == "-"
+                       total += 1
+                       pid += 1.0 if inseq[i][a,1] == inseq[j][a,1]
+               end
+               pid /= total
+#              puts "#{i.to_s}, #{j.to_s}, #{pid.to_s}"
+               if pid > 0.5 then
+                       if slen[i] < slen[j]
+                               act[i] = 0 
+                       else
+                               act[j] = 0 
+                       end
+               end
+       end
+end
+#p act
+
+
+afp = File.open( "#{temp_af}", 'w' )
+
+STDERR.puts "Searching .. \n"
+ids = []
+add = []
+sco = []
+for i in 0..(nin-1)
+       inseq[i].gsub!(/-/,"")
+       afp.puts ">" + orname[i]
+       afp.puts orseq[i]
+
+#      afp.puts ">" + inname[i]
+#      afp.puts inseq[i]
+
+       STDERR.puts "Query (#{i+1}/#{nin})\n" + inname[i]
+       if act[i] == 0 then
+               STDERR.puts "Skip.\n\n"
+               next 
+       end
+
+       if local == 0 then
+               command = "lynx -source 'http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?QUERY=" + inseq[i] + "&DATABASE=swissprot&HITLIST_SIZE=" + nadd.to_s + "&FILTER=L&EXPECT='" + eval.to_s + "'&FORMAT_TYPE=TEXT&PROGRAM=blastp&SERVICE=plain&NCBI_GI=on&PAGE=Proteins&CMD=Put' > #{temp_rid}"
+               system command
+       
+               ridp = File.open( "#{temp_rid}", 'r' )
+               while ridp.gets
+                       break if $_ =~ / RID = (.*)/
+               end
+               ridp.close
+               rid = $1.strip
+               STDERR.puts "Submitted to NCBI. rid = " + rid
+       
+               STDERR.printf "Waiting "
+               while 1 
+                       STDERR.printf "."
+                       sleep 10
+                       command = "lynx -source 'http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?RID=" + rid + "&DESCRIPTIONS=500&ALIGNMENTS=" + nadd.to_s + "&ALIGNMENT_TYPE=Pairwise&OVERVIEW=no&CMD=Get&FORMAT_TYPE=XML' > #{temp_res}"
+                       system command
+                       resp = File.open( "#{temp_res}", 'r' )
+#                      resp.gets
+#                      if $_ =~ /WAITING/ then
+#                              resp.close
+#                              next
+#                      end
+                       while( resp.gets )
+                               break if $_ =~ /QBlastInfoBegin/
+                       end
+                       resp.gets
+                       if $_ =~ /WAITING/ then
+                               resp.close
+                               next
+                       else
+                               resp.close
+                               break
+                       end
+               end
+       else
+#              puts "Not supported"
+#              exit
+               qfp = File.open( "#{temp_qf}", 'w' )
+                       qfp.puts "> "
+                       qfp.puts inseq[i]
+               qfp.close
+               command = blastpath + "  -p blastp  -e #{eval} -b 1000 -m 7 -i #{temp_qf} -d #{localdb} > #{temp_res}"
+               system command
+               resp = File.open( "#{temp_res}", 'r' )
+       end
+       STDERR.puts " Done.\n\n"
+
+       resp = File.open( "#{temp_res}", 'r' )
+       while 1
+               while resp.gets
+                       break if $_ =~ /<Hit_id>(.*)<\/Hit_id>/ || $_ =~ /(<Iteration_stat>)/
+               end
+               id = $1
+               break if $_ =~ /<Iteration_stat>/
+#              p id
+               while resp.gets
+                       break if $_ =~ /<Hsp_bit-score>(.*)<\/Hsp_bit-score>/
+               end
+               score = $1.to_f
+#              p score
+
+               known = ids.index( id )
+               if known != nil then
+                       if sco[known] >= score then
+                               next
+                       else
+                               ids.delete_at( known )
+                               add.delete_at( known )
+                               sco.delete_at( known )
+                       end
+               end
+               while resp.gets
+                       break if $_ =~ /<Hsp_hseq>(.*)<\/Hsp_hseq>/
+               end
+#              break if $1 == nil
+               target = $1.sub( /-/, "" ).sub( /U/, "X" )
+#              p target
+#              STDERR.puts "adding 1 seq"
+               ids.push( id )
+               sco.push( score )
+               add.push( target )
+       end
+       resp.close
+end
+
+n = ids.length
+
+outnum = 0
+while n > 0 && outnum < nadd
+       m = rand( n )
+       afp.puts ">_addedbymaffte_" + ids[m]
+       afp.puts add[m]
+       ids.delete_at( m )
+       add.delete_at( m )
+       n -= 1
+       outnum += 1
+end
+afp.close
+
+STDERR.puts "Performing alignment .. "
+system( mafftpath + mafftopt + " #{temp_af} > #{temp_bf}" )
+STDERR.puts "done."
+
+bfp = File.open( "#{temp_bf}", 'r' )
+outseq = []
+outnam = []
+readfasta( bfp, outnam, outseq )
+bfp.close
+
+outseq2 = []
+outnam2 = []
+
+len = outseq.length
+for i in 0..(len-1)
+#      p outnam[i]
+       if fullout == 0 && outnam[i] =~ /_addedbymaffte_/ then
+               next
+       end
+       outseq2.push( outseq[i] )
+       outnam2.push( outnam[i].sub( /_addedbymaffte_/, "_ho_" ) )
+end
+
+nout = outseq2.length
+len = outseq[0].length
+p = len
+while p>0
+       p -= 1
+    allgap = 1
+    for j in 0..(nout-1)
+               if outseq2[j][p,1] != "-" then
+                       allgap = 0
+                       break
+               end
+    end
+    if allgap == 1 then
+        for j in 0..(nout-1)
+            outseq2[j][p,1] = ""
+        end
+    end
+end
+for i in 0..(nout-1)
+       puts ">" + outnam2[i]
+       puts outseq2[i].gsub( /.{1,60}/, "\\0\n" )
+end
+
+
+system( "rm -rf #{temp_if} #{temp_vf} #{temp_af} #{temp_bf} #{temp_pf} #{temp_qf} #{temp_res} #{temp_rid}" )