X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=binaries%2Fsrc%2Fmafft%2Fbinaries%2Fmafft;h=16b666019ede41ddeb2b66acda671b2cc276bd4e;hb=8ce6db56df6c0a1c2baca2fc2d33bcb10067c6cd;hp=93578e733e5463596d304fdff0ecfa6fffea136d;hpb=535359a3d592ee41bda72e7356f0181f6cee9d07;p=jabaws.git diff --git a/binaries/src/mafft/binaries/mafft b/binaries/src/mafft/binaries/mafft index 93578e7..16b6660 100644 --- a/binaries/src/mafft/binaries/mafft +++ b/binaries/src/mafft/binaries/mafft @@ -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"; }