New Mafft binaries for 32 bit linux system
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 10:58:50 +0000 (10:58 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 10:58:50 +0000 (10:58 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4289 e3abac25-378b-4346-85de-24260fe3988d

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

index c2408d9..2a5738d 100644 (file)
Binary files a/binaries/linuxIA32/mafft/contrafoldwrap and b/binaries/linuxIA32/mafft/contrafoldwrap differ
index 3cc8676..f35eadb 100644 (file)
Binary files a/binaries/linuxIA32/mafft/countlen and b/binaries/linuxIA32/mafft/countlen differ
index dd6d4c9..ebaa021 100644 (file)
Binary files a/binaries/linuxIA32/mafft/disttbfast and b/binaries/linuxIA32/mafft/disttbfast differ
index 220e3e1..48b4dd7 100644 (file)
Binary files a/binaries/linuxIA32/mafft/dndblast and b/binaries/linuxIA32/mafft/dndblast differ
index b7ab1ec..00309d4 100644 (file)
Binary files a/binaries/linuxIA32/mafft/dndfast7 and b/binaries/linuxIA32/mafft/dndfast7 differ
index 80e41eb..40b4a77 100644 (file)
Binary files a/binaries/linuxIA32/mafft/dndpre and b/binaries/linuxIA32/mafft/dndpre differ
index 96e1ab8..79ef56a 100644 (file)
Binary files a/binaries/linuxIA32/mafft/dndpre2 and b/binaries/linuxIA32/mafft/dndpre2 differ
index 1845c67..c8a073a 100644 (file)
Binary files a/binaries/linuxIA32/mafft/dvtditr and b/binaries/linuxIA32/mafft/dvtditr differ
index e1e6017..34c6cb1 100644 (file)
Binary files a/binaries/linuxIA32/mafft/f2cl and b/binaries/linuxIA32/mafft/f2cl differ
index 9d691ed..2bee56b 100644 (file)
Binary files a/binaries/linuxIA32/mafft/getlag and b/binaries/linuxIA32/mafft/getlag differ
index 93578e7..16b6660 100644 (file)
@@ -3,7 +3,7 @@
 
 er=0;
 myself=`dirname "$0"`/`basename "$0"`; export myself
-version="v6.717b (2009/12/03)"; export version
+version="v6.857b (2011/05/30)"; export version
 LANG=C; export LANG
 os=`uname`
 progname=`basename "$0"`
@@ -13,6 +13,8 @@ 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
@@ -21,7 +23,7 @@ export os
 if [ "$MAFFT_BINARIES" ]; then
        prefix="$MAFFT_BINARIES"
 else
-       prefix=/usr/lib/mafft
+       prefix=/usr/libexec/mafft
 fi
 export prefix
 
@@ -129,6 +131,10 @@ elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then
        defaultiterate=2
        defaultdistance="sixtuples"
 fi
+outputfile=""
+namelength=15
+anysymbol=0
+parallelizationstrategy="BAATARI2"
 kappa=$defaultkappa
 sbstmodel=$defaultsbstmodel
 fmodel=$defaultfmodel
@@ -193,13 +199,25 @@ 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=" "
@@ -211,6 +229,9 @@ if [ $# -gt 0 ]; then
                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`
@@ -289,6 +310,37 @@ if [ $# -gt 0 ]; 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` 
@@ -436,7 +488,18 @@ if [ $# -gt 0 ]; then
        fi
        if [ $# -eq 1 ]; then
                if [ -r "$1" -o "$1" = - ]; then
-                       cat "$1" | tr "\r" "\n" > $TMPFILE/infile 
+
+                       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
@@ -449,13 +512,20 @@ if [ $# -gt 0 ]; then
                        while [ $# -gt 1 ];
                        do
                                shift
-                               cat "$1" | tr "\r" "\n" >  $TMPFILE/seed$#
+                               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
@@ -467,6 +537,15 @@ if [ $# -gt 0 ]; then
        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`
@@ -489,8 +568,13 @@ if [ $# -gt 0 ]; then
                fi
        fi
 
-       if [ $iterate -gt 16 ]; then    #??
-               iterate=16
+       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
@@ -515,7 +599,7 @@ if [ $# -gt 0 ]; then
 #              echo "  Input format: fasta" 1>&2
 #              echo ""  1>&2
 #              echo "  Usage: `basename $0` [options] inputfile > outputfile" 1>&2
-           echo "  http://align.bmr.kyushu-u.ac.jp/mafft/software/" 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
@@ -523,7 +607,7 @@ if [ $# -gt 0 ]; then
 #              echo ""  1>&2
                echo "High speed:" 1>&2
                echo "  % mafft in > out" 1>&2
-               echo "  % mafft --retree 1 in > out (fastest)" 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
@@ -540,6 +624,7 @@ if [ $# -gt 0 ]; then
                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 
@@ -759,7 +844,7 @@ if [ $# -gt 0 ]; then
                cycle=3
        fi
 
-       if [ $nseq -gt 1000 -a $iterate -gt 1 ]; then
+       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
@@ -772,6 +857,19 @@ if [ $# -gt 0 ]; 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=" "
@@ -834,6 +932,10 @@ if [ $# -gt 0 ]; 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
@@ -843,6 +945,23 @@ if [ $# -gt 0 ]; then
                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
@@ -931,20 +1050,35 @@ if [ $# -gt 0 ]; then
        fi
 
        if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
-               outputopt=" -c $strategy -r order  "
+               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 order "
+               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
@@ -956,7 +1090,13 @@ if [ $# -gt 0 ]; then
                                do
                                        shift
 #                                      echo "num="$#
-                                       "$prefix/multi2hat3s" -t $nseq  -o $seedoffset -i seed$# >> infile 2>/dev/null || exit 1
+
+                                       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`
@@ -964,15 +1104,22 @@ if [ $# -gt 0 ]; then
 #                                      echo "seedoffset="$seedoffset
                                done;
 #                              echo "seedoffset="$seedoffset
-                               cat infile2 >> infile
+                               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" -d "$prefix" -i infile > hat4 2>/dev/null || exit 1
+                               "$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
@@ -980,65 +1127,65 @@ if [ $# -gt 0 ]; then
                                "$prefix/dndfast7" $swopt < infile > /dev/null  2>&1      || exit 1
                                cat hat3.seed hat3 > hatx
                                mv hatx hat3
-                               "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "foldalignlocal" ]; then
-                               "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "foldalignglobal" ]; then
-                               "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $pgexp -f $pggop -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "slara" ]; then
-                               "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "lara" ]; then
-                               "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "scarna" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "global" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -F < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "local" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -L < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "globalgenaf" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null 2>&1    || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "localgenaf" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N < infile > /dev/null  2>&1      || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "distonly" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null  2>&1      || exit 1
-                               "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < infile   > /dev/null 2>&1 || exit 1
+                               "$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" $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $algopt $treealg < infile   > pre 2>/dev/null || exit 1
+                               "$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 ]
@@ -1047,19 +1194,29 @@ if [ $# -gt 0 ]; 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" $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft  $localparam $algopt -J $treealg < pre > /dev/null 2>&1 || exit 1
+                                       "$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"       < pre     > /dev/null 2>&1 || exit 1
+                                   "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
                                fi
-                               "$prefix/dvtditr" $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof  -I $iterate $weightopt $treeinopt $algoptit $treealg < pre     > /dev/null 2>&1 || exit 1
+                               "$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
@@ -1071,7 +1228,13 @@ if [ $# -gt 0 ]; then
                                do
                                        shift
 #                                      echo "num="$#
-                                       "$prefix/multi2hat3s" -t $nseq  -o $seedoffset -i seed$# >> infile  || exit 1
+
+                                       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`
@@ -1079,15 +1242,21 @@ if [ $# -gt 0 ]; then
 #                                      echo "seedoffset="$seedoffset
                                done;
 #                              echo "seedoffset="$seedoffset
-                               cat infile2 >> infile
+                               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" -d "$prefix" -i infile > hat4  || exit 1
+                               "$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
@@ -1095,65 +1264,65 @@ if [ $# -gt 0 ]; then
                                "$prefix/dndfast7" $swopt < infile > /dev/null     || exit 1
                                cat hat3.seed hat3 > hatx
                                mv hatx hat3
-                               "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "blast" ]; then
                                "$prefix/dndblast" < infile > /dev/null     || exit 1
                                cat hat3.seed hat3 > hatx
                                mv hatx hat3
-                               "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "foldalignlocal" ]; then
-                               "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "foldalignglobal" ]; then
-                               "$prefix/pairlocalalign" $seqtype $foldalignopt $model -g $pgexp -f $pggop  -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "slara" ]; then
-                               "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -T -d "$prefix" < infile > /dev/null || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "lara" ]; then
-                               "$prefix/pairlocalalign" -p $laraparams  $seqtype $model  -f $lgop  -B -d "$prefix" < infile > /dev/null || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "scarna" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -f $pggop  -s -d "$prefix" < infile > /dev/null   || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam   $algopt $treealg < 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 = "global" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof   -F  < infile > /dev/null     || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "local" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -L  < infile > /dev/null     || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "globalgenaf" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -g $pgexp -f $pggop  -h $pgaof -O $GGOP -E $GEXP -K  < infile > /dev/null     || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "localgenaf" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model  -g $lexp -f $lgop  -h $laof -O $LGOP -E $LEXP -N  < infile > /dev/null     || exit 1
+                               "$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" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < 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 = "distonly" ]; then
-                               "$prefix/pairlocalalign"   $seqtype $model -g $pgexp -f $pggop  -h $pgaof  -t < infile > /dev/null            || exit 1
-                               "$prefix/tbfast" $rnaopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft $localparam  $algopt $treealg < infile   > /dev/null || exit 1
+                               "$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" $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h "-"$aof  $param_fft  $algopt $treealg < infile   > pre || exit 1
+                               "$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
 
@@ -1163,30 +1332,95 @@ if [ $# -gt 0 ]; 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" $rnaopt $weightopt $treeoutopt $distoutopt $memopt $seqtype $model  -f "-"$gop  -h "-"$aof $param_fft $localparam $algopt -J $treealg < pre > /dev/null || exit 1
+                                       "$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"       < pre     > /dev/null 2>&1 || exit 1
+                               "$prefix/dndpre" -C $numthreads < pre     > /dev/null 2>&1 || exit 1
                                fi
-                               "$prefix/dvtditr" $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -h "-"$aof -I $iterate $weightopt $treeinopt $algoptit $treealg < pre     > /dev/null || exit 1
+                               "$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 < pre || exit 1
+                       cat < $TMPFILE/pre || exit 1
                else
-                       "$prefix/f2cl" $outputopt < pre || exit 1
+                       "$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"
@@ -1196,60 +1430,6 @@ if [ $# -gt 0 ]; then
                cp $TMPFILE/hat2 "$infilename.hat2"
        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
        exit 0;
 fi
 
@@ -1265,25 +1445,15 @@ if [ -x "$tmpawk" ]; then
        prog="$tmpawk"
 fi
 
-echo "prog="$prog 1>&2
+#echo "prog="$prog 1>&2
 
 umask 077
-export defaultaof
-export defaultgop
-export defaultfft
-export defaultcycle
-export defaultiterate
 (
 $prog '
 BEGIN {
        prefix = ENVIRON["prefix"];
        version = ENVIRON["version"];
        myself = ENVIRON["myself"];
-       defaultgop = ENVIRON["defaultgop"]
-       defaultaof = ENVIRON["defaultaof"]
-       defaultfft = ENVIRON["defaultfft"]
-       defaultcycle = ENVIRON["defaultcycle"]
-       defaultiterate = ENVIRON["defaultiterate"]
        while( 1 )
        {
                options = ""
@@ -1292,9 +1462,9 @@ BEGIN {
                printf( "\n" )                                                                           > "/dev/tty";
                printf( "   MAFFT %s\n", version )                                                       > "/dev/tty";
                printf( "\n" )                                                                           > "/dev/tty";
-               printf( "        Copyright (c) 2009 Kazutaka Katoh\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://align.bmr.kyushu-u.ac.jp/mafft/software/\n" )       > "/dev/tty";
+               printf( "        http://mafft.cbrc.jp/alignment/software/\n" )       > "/dev/tty";
                printf( "---------------------------------------------------------------------\n" )      > "/dev/tty";
                printf( "\n" ) > "/dev/tty";
        
@@ -1306,13 +1476,15 @@ BEGIN {
                        close( "/dev/tty" )
                        if( res == 0 || NF == 0 )
                                continue;
-                       infile0 = sprintf( "%s", $1 );
-                       infile = sprintf( "%s", $1 );
+                       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
@@ -1334,178 +1506,129 @@ BEGIN {
                                continue;
                        else
                        {
-                               outfile = sprintf( "%s", $1 );
+                               outfile = sprintf( "%s", $0 );
                                printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty";
                                break;
                        }
                }
        
-       
                while( 1 )
                {
-                       retree = defaultcycle
+                       outargs = "";
                        printf( "\n" ) > "/dev/tty";
-                       printf( "Number of tree-rebuilding?\n" ) > "/dev/tty";
-                       printf( "@ [%d] ", retree ) > "/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" );
-                       if( res == 0 )
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
                                continue;
-                       else if( NF == 0 )
-                               ;
-                       else
-                               retree = 0 + $1;
-                       if( retree < 1 || 10 < retree )
-                               ;
                        else
                        {
-                               printf( "OK. %d\n\n", retree ) > "/dev/tty";
+                               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 )
                {
-                       niterate = defaultiterate;
+                       arguments = "";
                        printf( "\n" ) > "/dev/tty";
-                       printf( "Maximum number of iterations?\n" ) > "/dev/tty";
-                       printf( "@ [%d] ", niterate ) > "/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" );
-                       if( res == 0 )
+#                      printf( "res=%d, NF=%d\n", res, NF );
+
+                       resnum = 0 + $1;
+#                      printf( "resnum=%d\n", resnum );
+
+                       if( resnum < 1 || 6 < resnum )
                                continue;
-                       else if( NF == 0 )
-                               ;
-                       else
-                               niterate = 0 + $1;
-                       if( niterate < 0 || 1000 < niterate )
-                               ;
                        else
                        {
-                               printf( "OK. %d\n\n", niterate ) > "/dev/tty";
+                               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 )
-               {
-                       fft = defaultfft;
-                       printf( "\n" ) > "/dev/tty";
-                       printf( "Use fft?\n" ) > "/dev/tty";
-                       printf( "@ [%s] ", fft?"Yes":"No" ) > "/dev/tty";
-                       res = getline < "/dev/tty";
-                       close( "/dev/tty" );
-                       if( res == 0 )
-                               continue;
-                       else if( NF == 0 )
-                       {
-                               break;
-                       }
-                       else if( NF == 0 || $0 ~ /^[Yy]/ )
-                       {
-                               fft = 1;
-                               break;
-                       }
-                       else if( NF == 0 || $0 ~ /^[Nn]/ )
-                       {
-                               fft = 0;
-                               break;
-                       }
-               }
-               if( fft )
-               {
-                               printf( "OK. FFT is enabled.\n\n" ) > "/dev/tty";
-                               fftparam = " ";
-               }
-               else
-               {
-                               printf( "OK. FFT is disabled.\n\n" ) > "/dev/tty";
-                               fftparam = " --nofft ";
-               }
 
                while( 1 )
                {
-                       scoringmatrix = 3;
                        printf( "\n" ) > "/dev/tty";
-                       printf( "Scoring matrix? (ignored when DNA sequence is input.)\n" ) > "/dev/tty";
-                       printf( " 1. BLOSUM 30\n" ) > "/dev/tty";
-                       printf( " 2. BLOSUM 45\n" ) > "/dev/tty";
-                       printf( " 3. BLOSUM 62\n" ) > "/dev/tty";
-                       printf( " 4. BLOSUM 80\n" ) > "/dev/tty";
-                       printf( " 5. JTT 200\n" ) > "/dev/tty";
-                       printf( " 6. JTT 100\n" ) > "/dev/tty";
-                       printf( "@ [%d] ", scoringmatrix ) > "/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 )
-                               continue;
-                       else if( NF == 0 )
-                               ;
-                       else
-                               scoringmatrix = 0 + $1;
-                       if( scoringmatrix < 1 || 6 < scoringmatrix )
-                               ;
-                       else
+                       if( res == 0 || NF == 0 )
                        {
                                break;
                        }
-               }
-               if( scoringmatrix == 1 )
-                       scoringparam = " --bl 30 ";
-               else if( scoringmatrix == 2 )
-                       scoringparam = " --bl 45 ";
-               else if( scoringmatrix == 3 )
-                       scoringparam = " --bl 62 ";
-               else if( scoringmatrix == 4 )
-                       scoringparam = " --bl 80 ";
-               else if( scoringmatrix == 5 )
-                       scoringparam = " --jtt 200 ";
-               else if( scoringmatrix == 6 )
-                       scoringparam = " --jtt 100 ";
-               printf( "OK. %s\n\n",scoringparam ) > "/dev/tty";
-       
-               while( 1 )
-               {
-                       penalty = 0.0 + defaultgop;
-                       offset = 0.0 + defaultaof;
-                       printf( "\n" ) > "/dev/tty";
-                       printf( "Parameters (gap opening penalty, offset)?\n", penalty, offset ) > "/dev/tty";
-                       printf( "@ [%5.3f, %5.3f] ", penalty, offset ) > "/dev/tty";
-                       res = getline < "/dev/tty";
-                       close( "/dev/tty" );
-                       if( res == 0 )
-                               continue;
-                       else if( NF == 2 )
-                       {
-                               penalty = 0.0 + $1;
-                               offset = 0.0 + $2;
-                       }
-                       else if( NF == 0 )
-                               ;
-                       else
-                               continue;
-                       if( penalty < 0.0 || 10.0 < penalty )
-                               ;
-                       else if( offset < 0.0 || 10.0 < offset )
-                               ;
                        else
                        {
-                               printf( "OK. %5.3f %5.3f\n\n", penalty, offset ) > "/dev/tty";
+                               addargs = sprintf( "%s", $0 );
+                               printf( "OK. arguments = %s %s %s\n\n", addargs, arguments, outargs ) > "/dev/tty";
                                break;
                        }
                }
-       
-               command = sprintf( "\"%s\" %s --retree %d --maxiterate %d %s --op %f --ep %f %s > %s", myself, fftparam, retree, niterate, scoringparam, penalty, offset, infile, outfile );
+
+               arguments = sprintf( "%s %s %s", addargs, arguments, outargs );
+
+               print ""
+               command = sprintf( "\"%s\" %s \"%s\" > \"%s\"", myself, arguments, infile, outfile );
                gsub( /\\/, "/", command );
 
 
-               printf( "%s\n\n", command ) > "/dev/tty";
+               printf( "command=\n%s\n", command ) > "/dev/tty";
        
        
                while( 1 )
                {
                        go = 0;
-                       printf( "\n" ) > "/dev/tty";
                        printf( "OK?\n" ) > "/dev/tty";
                        printf( "@ [Y] " ) > "/dev/tty";
                        res = getline < "/dev/tty";
@@ -1525,6 +1648,8 @@ BEGIN {
                printf( "\n" ) > "/dev/tty";
        }
        system( command );
+       command = sprintf( "less \"%s\"", outfile );
+       system( command );
        printf( "Press Enter to exit." ) > "/dev/tty";
        res = getline < "/dev/tty";
 }
index 74b828e..2dd7778 100644 (file)
Binary files a/binaries/linuxIA32/mafft/mafft-distance and b/binaries/linuxIA32/mafft/mafft-distance differ
diff --git a/binaries/linuxIA32/mafft/mafft-homologs.rb b/binaries/linuxIA32/mafft/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}" )
index 8ebc53f..f23b56b 100644 (file)
Binary files a/binaries/linuxIA32/mafft/mafft-profile and b/binaries/linuxIA32/mafft/mafft-profile differ
index 87ac748..8636334 100644 (file)
@@ -1,5 +1,5 @@
 .\"     Title: MAFFT
-.\"    Author: Kazutaka Katoh <katoh_at_bioreg.kyushu-u.ac.jp.>
+.\"    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
 .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"
@@ -198,7 +203,7 @@ FASTA is required.  Default: off (6mer distance is used)
 \fB\-\-weighti\fR \fInumber\fR
 .RS 4
 Weighting factor for the consistency term calculated from pairwise alignments.  Valid when 
-either of \-\-blobalpair, \-\-localpair,  \-\-genafpair, \-\-fastapair or 
+either of \-\-globalpair, \-\-localpair,  \-\-genafpair, \-\-fastapair or 
 \-\-blastpair is selected.  Default: 2.7
 .RE
 .PP
@@ -273,7 +278,7 @@ Gap opening penalty at group\-to\-group alignment.  Default: 1.53
 \fB\-\-ep\fR \fInumber\fR
 .RS 4
 Offset value, which works like gap extension penalty, for
-group\-to\-group alignment.  Deafult: 0.123
+group\-to\-group alignment.  Default: 0.123
 .RE
 .PP
 \fB\-\-lop\fR \fInumber\fR
@@ -331,7 +336,7 @@ the same to that of BLAST.  Ignored when nucleotide sequences are input.   Defau
 \fB\-\-fmodel\fR
 .RS 4
 Incorporate the AA/nuc composition information into
-the scoring matrix.  Deafult: off
+the scoring matrix.  Default: off
 .RE
 .RE
 .SS "Output"
@@ -367,12 +372,12 @@ Do not report progress.  Default: off
 .PP
 \fB\-\-nuc\fR
 .RS 4
-Assume the sequences are nucleotide.  Deafult: auto
+Assume the sequences are nucleotide.  Default: auto
 .RE
 .PP
 \fB\-\-amino\fR
 .RS 4
-Assume the sequences are amino acid.  Deafult: auto
+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 ...]
@@ -436,7 +441,7 @@ This variable can be set to indicate to mafft the location to the fasta34 progra
 .SH "AUTHORS"
 .RS 0
 .PP
-\fBKazutaka Katoh\fR <\&katoh_at_bioreg.kyushu\-u.ac.jp\&>
+\fBKazutaka Katoh\fR <\&kazutaka.katoh_at_aist.go.jp\&>
 .sp -1n
 .IP "" 4
 Wrote Mafft.
index 0d057b8..8f1a46e 100644 (file)
Binary files a/binaries/linuxIA32/mafft/mccaskillwrap and b/binaries/linuxIA32/mafft/mccaskillwrap differ
index 6f7b9a1..96b8a96 100644 (file)
Binary files a/binaries/linuxIA32/mafft/multi2hat3s and b/binaries/linuxIA32/mafft/multi2hat3s differ
index c1a6697..c873d31 100644 (file)
Binary files a/binaries/linuxIA32/mafft/mxscarnamod and b/binaries/linuxIA32/mafft/mxscarnamod differ
index 14c636b..654defa 100644 (file)
Binary files a/binaries/linuxIA32/mafft/pair2hat3s and b/binaries/linuxIA32/mafft/pair2hat3s differ
index 2daeb5c..abb91cc 100644 (file)
Binary files a/binaries/linuxIA32/mafft/pairash and b/binaries/linuxIA32/mafft/pairash differ
index c9d35dd..fb7ad4b 100644 (file)
Binary files a/binaries/linuxIA32/mafft/pairlocalalign and b/binaries/linuxIA32/mafft/pairlocalalign differ
index 5da3ec0..b6ecafb 100644 (file)
Binary files a/binaries/linuxIA32/mafft/regtable2seq and b/binaries/linuxIA32/mafft/regtable2seq differ
diff --git a/binaries/linuxIA32/mafft/replaceu b/binaries/linuxIA32/mafft/replaceu
new file mode 100644 (file)
index 0000000..6e1bdb2
Binary files /dev/null and b/binaries/linuxIA32/mafft/replaceu differ
diff --git a/binaries/linuxIA32/mafft/restoreu b/binaries/linuxIA32/mafft/restoreu
new file mode 100644 (file)
index 0000000..f57e783
Binary files /dev/null and b/binaries/linuxIA32/mafft/restoreu differ
index 8d84deb..b0c9b18 100644 (file)
Binary files a/binaries/linuxIA32/mafft/rnatest and b/binaries/linuxIA32/mafft/rnatest differ
index 9368a76..f5a362e 100644 (file)
Binary files a/binaries/linuxIA32/mafft/score and b/binaries/linuxIA32/mafft/score differ
index 5b0dd16..2fb8589 100644 (file)
Binary files a/binaries/linuxIA32/mafft/seq2regtable and b/binaries/linuxIA32/mafft/seq2regtable differ
index 0b37b97..8d17ec6 100644 (file)
Binary files a/binaries/linuxIA32/mafft/setcore and b/binaries/linuxIA32/mafft/setcore differ
index d5263c3..4991fd3 100644 (file)
Binary files a/binaries/linuxIA32/mafft/sextet5 and b/binaries/linuxIA32/mafft/sextet5 differ
index e315fe5..cb91ebb 100644 (file)
Binary files a/binaries/linuxIA32/mafft/splittbfast and b/binaries/linuxIA32/mafft/splittbfast differ
index 733b1ef..c9b9167 100644 (file)
Binary files a/binaries/linuxIA32/mafft/tbfast and b/binaries/linuxIA32/mafft/tbfast differ