| 1 | #! /bin/sh |
|---|
| 2 | |
|---|
| 3 | er=0; |
|---|
| 4 | myself=`dirname "$0"`/`basename "$0"`; export myself |
|---|
| 5 | version="v7.055b (2013/07/25)"; export version |
|---|
| 6 | LANG=C; export LANG |
|---|
| 7 | os=`uname` |
|---|
| 8 | progname=`basename "$0"` |
|---|
| 9 | if [ `echo $os | grep -i cygwin` ]; then |
|---|
| 10 | os="cygwin" |
|---|
| 11 | elif [ `echo $os | grep -i mingw` ]; then |
|---|
| 12 | os="mingw" |
|---|
| 13 | elif [ `echo $os | grep -i darwin` ]; then |
|---|
| 14 | os="darwin" |
|---|
| 15 | elif [ `echo $os | grep -i sunos` ]; then |
|---|
| 16 | os="sunos" |
|---|
| 17 | elif [ `echo $os | grep -i linux` ]; then |
|---|
| 18 | os="linux" |
|---|
| 19 | else |
|---|
| 20 | os="unix" |
|---|
| 21 | fi |
|---|
| 22 | export os |
|---|
| 23 | |
|---|
| 24 | if [ "$MAFFT_BINARIES" ]; then |
|---|
| 25 | prefix="$MAFFT_BINARIES" |
|---|
| 26 | else |
|---|
| 27 | prefix=_LIBDIR |
|---|
| 28 | fi |
|---|
| 29 | export prefix |
|---|
| 30 | |
|---|
| 31 | if [ $# -gt 0 ]; then |
|---|
| 32 | if [ "$1" = "--man" ]; then |
|---|
| 33 | man "$prefix/mafft.1" |
|---|
| 34 | exit 0; |
|---|
| 35 | fi |
|---|
| 36 | fi |
|---|
| 37 | |
|---|
| 38 | if [ -x "$prefix/version" ]; then |
|---|
| 39 | versionbin=`"$prefix/version" | awk '{print $1}'` # for cygwin |
|---|
| 40 | else |
|---|
| 41 | versionbin="0.000" |
|---|
| 42 | fi |
|---|
| 43 | |
|---|
| 44 | if ! expr "$version" : v"$versionbin" > /dev/null ; then |
|---|
| 45 | echo "" 1>&2 |
|---|
| 46 | echo "v$versionbin != $version" 1>&2 |
|---|
| 47 | echo "" 1>&2 |
|---|
| 48 | echo "There is a problem in the configuration of your shell." 1>&2 |
|---|
| 49 | echo "Check the MAFFT_BINARIES environmental variable by" 1>&2 |
|---|
| 50 | echo "$ echo \$MAFFT_BINARIES" 1>&2 |
|---|
| 51 | echo "" 1>&2 |
|---|
| 52 | echo "This variable must be *unset*, unless you have installed MAFFT" 1>&2 |
|---|
| 53 | echo "with a special configuration. To unset this variable, type" 1>&2 |
|---|
| 54 | echo "$ unset MAFFT_BINARIES" 1>&2 |
|---|
| 55 | echo "or" 1>&2 |
|---|
| 56 | echo "% unsetenv MAFFT_BINARIES" 1>&2 |
|---|
| 57 | echo "Then retry" 1>&2 |
|---|
| 58 | echo "$ mafft input > output" 1>&2 |
|---|
| 59 | echo "" 1>&2 |
|---|
| 60 | echo "To keep this change permanently, edit setting files" 1>&2 |
|---|
| 61 | echo "(.bash_profile, .profile, .cshrc, etc) in your home directory" 1>&2 |
|---|
| 62 | echo "to delete the MAFFT_BINARIES line." 1>&2 |
|---|
| 63 | echo "On MacOSX, also edit or remove the .MacOSX/environment.plist file" 1>&2 |
|---|
| 64 | echo "and then re-login (MacOSX 10.6) or reboot (MacOSX 10.7)." 1>&2 |
|---|
| 65 | echo "" 1>&2 |
|---|
| 66 | echo "Please send a problem report to kazutaka.katoh@aist.go.jp," 1>&2 |
|---|
| 67 | echo "if this problem remains." 1>&2 |
|---|
| 68 | echo "" 1>&2 |
|---|
| 69 | exit 1 |
|---|
| 70 | er=1 |
|---|
| 71 | fi |
|---|
| 72 | |
|---|
| 73 | defaultiterate=0 |
|---|
| 74 | defaultcycle=2 |
|---|
| 75 | defaultgop="1.53" |
|---|
| 76 | #defaultaof="0.123" |
|---|
| 77 | defaultaof="0.000" |
|---|
| 78 | defaultlaof="0.100" |
|---|
| 79 | defaultlgop="-2.00" |
|---|
| 80 | defaultfft=1 |
|---|
| 81 | defaultrough=0 |
|---|
| 82 | defaultdistance="ktuples" |
|---|
| 83 | #defaultdistance="local" |
|---|
| 84 | defaultweighti="2.7" |
|---|
| 85 | defaultweightr="0.0" |
|---|
| 86 | defaultweightm="1.0" |
|---|
| 87 | defaultdafs=0 |
|---|
| 88 | defaultmccaskill=0 |
|---|
| 89 | defaultcontrafold=0 |
|---|
| 90 | defaultalgopt=" " |
|---|
| 91 | defaultalgoptit=" " |
|---|
| 92 | defaultsbstmodel=" -b 62 " |
|---|
| 93 | defaultfmodel=" " |
|---|
| 94 | defaultkappa=" " |
|---|
| 95 | if [ $progname = "xinsi" -o $progname = "mafft-xinsi" ]; then |
|---|
| 96 | defaultfft=1 |
|---|
| 97 | defaultcycle=1 |
|---|
| 98 | defaultiterate=1000 |
|---|
| 99 | defaultdistance="scarna" |
|---|
| 100 | defaultweighti="3.2" |
|---|
| 101 | defaultweightr="8.0" |
|---|
| 102 | defaultweightm="2.0" |
|---|
| 103 | defaultmccaskill=1 |
|---|
| 104 | defaultcontrafold=0 |
|---|
| 105 | defaultdafs=0 |
|---|
| 106 | defaultalgopt=" -A " |
|---|
| 107 | defaultalgoptit=" -AB " ## chui |
|---|
| 108 | defaultaof="0.0" |
|---|
| 109 | defaultsbstmodel=" -b 62 " |
|---|
| 110 | defaultkappa=" " |
|---|
| 111 | defaultfmodel=" " # 2013/06/18 |
|---|
| 112 | elif [ $progname = "qinsi" -o $progname = "mafft-qinsi" ]; then |
|---|
| 113 | defaultfft=1 |
|---|
| 114 | defaultcycle=1 |
|---|
| 115 | defaultiterate=1000 |
|---|
| 116 | defaultdistance="global" |
|---|
| 117 | defaultweighti="3.2" |
|---|
| 118 | defaultweightr="8.0" |
|---|
| 119 | defaultweightm="2.0" |
|---|
| 120 | defaultmccaskill=1 |
|---|
| 121 | defaultcontrafold=0 |
|---|
| 122 | defaultdafs=0 |
|---|
| 123 | defaultalgopt=" -A " |
|---|
| 124 | defaultalgoptit=" -AB " ## chui |
|---|
| 125 | defaultaof="0.0" |
|---|
| 126 | defaultsbstmodel=" -b 62 " |
|---|
| 127 | defaultkappa=" " |
|---|
| 128 | defaultfmodel=" " # 2013/06/18 |
|---|
| 129 | elif [ $progname = "linsi" -o $progname = "mafft-linsi" ]; then |
|---|
| 130 | defaultfft=0 |
|---|
| 131 | defaultcycle=1 |
|---|
| 132 | defaultiterate=1000 |
|---|
| 133 | defaultdistance="local" |
|---|
| 134 | elif [ $progname = "ginsi" -o $progname = "mafft-ginsi" ]; then |
|---|
| 135 | defaultfft=1 |
|---|
| 136 | defaultcycle=1 |
|---|
| 137 | defaultiterate=1000 |
|---|
| 138 | defaultdistance="global" |
|---|
| 139 | elif [ $progname = "einsi" -o $progname = "mafft-einsi" ]; then |
|---|
| 140 | defaultfft=0 |
|---|
| 141 | defaultcycle=1 |
|---|
| 142 | defaultiterate=1000 |
|---|
| 143 | defaultdistance="localgenaf" |
|---|
| 144 | elif [ $progname = "fftns" -o $progname = "mafft-fftns" ]; then |
|---|
| 145 | defaultfft=1 |
|---|
| 146 | defaultcycle=2 |
|---|
| 147 | defaultdistance="ktuples" |
|---|
| 148 | elif [ $progname = "fftnsi" -o $progname = "mafft-fftnsi" ]; then |
|---|
| 149 | defaultfft=1 |
|---|
| 150 | defaultcycle=2 |
|---|
| 151 | defaultiterate=2 |
|---|
| 152 | defaultdistance="ktuples" |
|---|
| 153 | elif [ $progname = "nwns" -o $progname = "mafft-nwns" ]; then |
|---|
| 154 | defaultfft=0 |
|---|
| 155 | defaultcycle=2 |
|---|
| 156 | defaultdistance="ktuples" |
|---|
| 157 | elif [ $progname = "nwnsi" -o $progname = "mafft-nwnsi" ]; then |
|---|
| 158 | defaultfft=0 |
|---|
| 159 | defaultcycle=2 |
|---|
| 160 | defaultiterate=2 |
|---|
| 161 | defaultdistance="ktuples" |
|---|
| 162 | fi |
|---|
| 163 | outputfile="" |
|---|
| 164 | namelength=-1 |
|---|
| 165 | anysymbol=0 |
|---|
| 166 | parallelizationstrategy="BAATARI2" |
|---|
| 167 | kappa=$defaultkappa |
|---|
| 168 | sbstmodel=$defaultsbstmodel |
|---|
| 169 | fmodel=$defaultfmodel |
|---|
| 170 | gop=$defaultgop |
|---|
| 171 | aof=$defaultaof |
|---|
| 172 | cycle=$defaultcycle |
|---|
| 173 | iterate=$defaultiterate |
|---|
| 174 | fft=$defaultfft |
|---|
| 175 | rough=$defaultrough |
|---|
| 176 | distance=$defaultdistance |
|---|
| 177 | forcefft=0 |
|---|
| 178 | memopt=" " |
|---|
| 179 | weightopt=" " |
|---|
| 180 | GGOP="-6.00" |
|---|
| 181 | LGOP="-6.00" |
|---|
| 182 | LEXP="-0.000" |
|---|
| 183 | GEXP="-0.000" |
|---|
| 184 | lgop=$defaultlgop |
|---|
| 185 | lexp="-0.100" |
|---|
| 186 | laof=$defaultlaof |
|---|
| 187 | pggop="-2.00" |
|---|
| 188 | pgexp="-0.10" |
|---|
| 189 | pgaof="0.10" |
|---|
| 190 | rgop="-1.530" |
|---|
| 191 | rgep="-0.000" |
|---|
| 192 | seqtype=" " |
|---|
| 193 | weighti=$defaultweighti |
|---|
| 194 | weightr=$defaultweightr |
|---|
| 195 | weightm=$defaultweightm |
|---|
| 196 | rnaalifold=0 |
|---|
| 197 | dafs=$defaultdafs |
|---|
| 198 | mccaskill=$defaultmccaskill |
|---|
| 199 | contrafold=$defaultcontrafold |
|---|
| 200 | progressfile="/dev/stderr" |
|---|
| 201 | debug=0 |
|---|
| 202 | sw=0 |
|---|
| 203 | algopt=$defaultalgopt |
|---|
| 204 | algoptit=$defaultalgoptit |
|---|
| 205 | algspecified=0 |
|---|
| 206 | pairspecified=0 |
|---|
| 207 | scorecalcopt=" " |
|---|
| 208 | coreout=0 |
|---|
| 209 | corethr="0.5" |
|---|
| 210 | corewin="100" |
|---|
| 211 | coreext=" " |
|---|
| 212 | outputformat="pir" |
|---|
| 213 | outorder="input" |
|---|
| 214 | seed="x" |
|---|
| 215 | seedtable="x" |
|---|
| 216 | auto=0 |
|---|
| 217 | groupsize=-1 |
|---|
| 218 | partsize=50 |
|---|
| 219 | partdist="ktuples" |
|---|
| 220 | partorderopt=" -x " |
|---|
| 221 | treeout=0 |
|---|
| 222 | distout=0 |
|---|
| 223 | treein=0 |
|---|
| 224 | topin=0 |
|---|
| 225 | treeinopt=" " |
|---|
| 226 | seedfiles="/dev/null" |
|---|
| 227 | seedtablefile="/dev/null" |
|---|
| 228 | aamatrix="/dev/null" |
|---|
| 229 | treeinfile="/dev/null" |
|---|
| 230 | rnascoremtx=" " |
|---|
| 231 | laraparams="/dev/null" |
|---|
| 232 | foldalignopt=" " |
|---|
| 233 | treealg=" -X " |
|---|
| 234 | scoreoutarg=" " |
|---|
| 235 | numthreads=0 |
|---|
| 236 | numthreadsit=-1 |
|---|
| 237 | randomseed=0 |
|---|
| 238 | addfile="/dev/null" |
|---|
| 239 | addarg0=" " |
|---|
| 240 | fragment=0 |
|---|
| 241 | mergetable="/dev/null" |
|---|
| 242 | mergearg=" " |
|---|
| 243 | seedoffset=0 |
|---|
| 244 | outnum=" " |
|---|
| 245 | last_e=5000 |
|---|
| 246 | last_m=3 |
|---|
| 247 | last_subopt=" " |
|---|
| 248 | last_once=" " |
|---|
| 249 | adjustdirection=0 |
|---|
| 250 | tuplesize=6 |
|---|
| 251 | if [ $# -gt 0 ]; then |
|---|
| 252 | while [ $# -gt 1 ]; |
|---|
| 253 | do |
|---|
| 254 | if [ "$1" = "--auto" ]; then |
|---|
| 255 | auto=1 |
|---|
| 256 | elif [ "$1" = "--anysymbol" ]; then |
|---|
| 257 | anysymbol=1 |
|---|
| 258 | elif [ "$1" = "--preservecase" ]; then |
|---|
| 259 | anysymbol=1 |
|---|
| 260 | elif [ "$1" = "--clustalout" ]; then |
|---|
| 261 | outputformat="clustal" |
|---|
| 262 | elif [ "$1" = "--phylipout" ]; then |
|---|
| 263 | outputformat="phylip" |
|---|
| 264 | elif [ "$1" = "--reorder" ]; then |
|---|
| 265 | outorder="aligned" |
|---|
| 266 | partorderopt=" " |
|---|
| 267 | elif [ "$1" = "--inputorder" ]; then |
|---|
| 268 | outorder="input" |
|---|
| 269 | partorderopt=" -x " |
|---|
| 270 | elif [ "$1" = "--unweight" ]; then |
|---|
| 271 | weightopt=" -u " |
|---|
| 272 | elif [ "$1" = "--alga" ]; then |
|---|
| 273 | algopt=" " |
|---|
| 274 | algoptit=" " |
|---|
| 275 | algspecified=1 |
|---|
| 276 | elif [ "$1" = "--algq" ]; then |
|---|
| 277 | algopt=" -Q " |
|---|
| 278 | algoptit=" " |
|---|
| 279 | algspecified=1 |
|---|
| 280 | elif [ "$1" = "--namelength" ]; then |
|---|
| 281 | shift |
|---|
| 282 | namelength=`expr "$1" - 0` |
|---|
| 283 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 284 | echo "Specify the length of name in clustal format output!" 1>&2 |
|---|
| 285 | exit |
|---|
| 286 | fi |
|---|
| 287 | elif [ "$1" = "--groupsize" ]; then |
|---|
| 288 | shift |
|---|
| 289 | groupsize=`expr "$1" - 0` |
|---|
| 290 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 291 | echo "Specify groupsize!" 1>&2 |
|---|
| 292 | exit |
|---|
| 293 | fi |
|---|
| 294 | elif [ "$1" = "--partsize" ]; then |
|---|
| 295 | shift |
|---|
| 296 | partsize=`expr "$1" - 0` |
|---|
| 297 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 298 | echo "Specify partsize!" 1>&2 |
|---|
| 299 | exit |
|---|
| 300 | fi |
|---|
| 301 | elif [ "$1" = "--parttree" ]; then |
|---|
| 302 | distance="parttree" |
|---|
| 303 | partdist="ktuples" |
|---|
| 304 | elif [ "$1" = "--dpparttree" ]; then |
|---|
| 305 | distance="parttree" |
|---|
| 306 | partdist="localalign" |
|---|
| 307 | elif [ "$1" = "--fastaparttree" ]; then |
|---|
| 308 | distance="parttree" |
|---|
| 309 | partdist="fasta" |
|---|
| 310 | elif [ "$1" = "--treeout" ]; then |
|---|
| 311 | treeout=1 |
|---|
| 312 | elif [ "$1" = "--distout" ]; then |
|---|
| 313 | distout=1 |
|---|
| 314 | elif [ "$1" = "--fastswpair" ]; then |
|---|
| 315 | distance="fasta" |
|---|
| 316 | pairspecified=1 |
|---|
| 317 | sw=1 |
|---|
| 318 | elif [ "$1" = "--fastapair" ]; then |
|---|
| 319 | distance="fasta" |
|---|
| 320 | pairspecified=1 |
|---|
| 321 | sw=0 |
|---|
| 322 | elif [ "$1" = "--averagelinkage" ]; then |
|---|
| 323 | treealg=" -E " |
|---|
| 324 | elif [ "$1" = "--minimumlinkage" ]; then |
|---|
| 325 | treealg=" -q " |
|---|
| 326 | elif [ "$1" = "--noscore" ]; then |
|---|
| 327 | scorecalcopt=" -Z " |
|---|
| 328 | elif [ "$1" = "--6mermultipair" ]; then |
|---|
| 329 | distance="ktuplesmulti" |
|---|
| 330 | tuplesize=6 |
|---|
| 331 | pairspecified=1 |
|---|
| 332 | elif [ "$1" = "--10mermultipair" ]; then |
|---|
| 333 | distance="ktuplesmulti" |
|---|
| 334 | tuplesize=10 |
|---|
| 335 | pairspecified=1 |
|---|
| 336 | elif [ "$1" = "--6merpair" ]; then |
|---|
| 337 | distance="ktuples" |
|---|
| 338 | tuplesize=6 |
|---|
| 339 | pairspecified=1 |
|---|
| 340 | elif [ "$1" = "--10merpair" ]; then |
|---|
| 341 | distance="ktuples" |
|---|
| 342 | tuplesize=10 |
|---|
| 343 | pairspecified=1 |
|---|
| 344 | elif [ "$1" = "--blastpair" ]; then |
|---|
| 345 | distance="blast" |
|---|
| 346 | pairspecified=1 |
|---|
| 347 | elif [ "$1" = "--lastmultipair" ]; then |
|---|
| 348 | distance="lastmulti" |
|---|
| 349 | pairspecified=1 |
|---|
| 350 | elif [ "$1" = "--globalpair" ]; then |
|---|
| 351 | distance="global" |
|---|
| 352 | pairspecified=1 |
|---|
| 353 | elif [ "$1" = "--localpair" ]; then |
|---|
| 354 | distance="local" |
|---|
| 355 | pairspecified=1 |
|---|
| 356 | elif [ "$1" = "--lastpair" ]; then |
|---|
| 357 | distance="last" |
|---|
| 358 | pairspecified=1 |
|---|
| 359 | elif [ "$1" = "--multipair" ]; then |
|---|
| 360 | distance="multi" |
|---|
| 361 | pairspecified=1 |
|---|
| 362 | elif [ "$1" = "--hybridpair" ]; then |
|---|
| 363 | distance="hybrid" |
|---|
| 364 | pairspecified=1 |
|---|
| 365 | elif [ "$1" = "--scarnapair" ]; then |
|---|
| 366 | distance="scarna" |
|---|
| 367 | pairspecified=1 |
|---|
| 368 | elif [ "$1" = "--dafspair" ]; then |
|---|
| 369 | distance="dafs" |
|---|
| 370 | pairspecified=1 |
|---|
| 371 | elif [ "$1" = "--larapair" ]; then |
|---|
| 372 | distance="lara" |
|---|
| 373 | pairspecified=1 |
|---|
| 374 | elif [ "$1" = "--slarapair" ]; then |
|---|
| 375 | distance="slara" |
|---|
| 376 | pairspecified=1 |
|---|
| 377 | elif [ "$1" = "--foldalignpair" ]; then |
|---|
| 378 | distance="foldalignlocal" |
|---|
| 379 | pairspecified=1 |
|---|
| 380 | elif [ "$1" = "--foldalignlocalpair" ]; then |
|---|
| 381 | distance="foldalignlocal" |
|---|
| 382 | pairspecified=1 |
|---|
| 383 | elif [ "$1" = "--foldalignglobalpair" ]; then |
|---|
| 384 | distance="foldalignglobal" |
|---|
| 385 | pairspecified=1 |
|---|
| 386 | elif [ "$1" = "--globalgenafpair" ]; then |
|---|
| 387 | distance="globalgenaf" |
|---|
| 388 | pairspecified=1 |
|---|
| 389 | elif [ "$1" = "--localgenafpair" ]; then |
|---|
| 390 | distance="localgenaf" |
|---|
| 391 | pairspecified=1 |
|---|
| 392 | elif [ "$1" = "--genafpair" ]; then |
|---|
| 393 | distance="localgenaf" |
|---|
| 394 | pairspecified=1 |
|---|
| 395 | elif [ "$1" = "--memsave" ]; then |
|---|
| 396 | memopt=" -M -B " # -B (bunkatsunashi no riyu ga omoidasenai) |
|---|
| 397 | elif [ "$1" = "--nomemsave" ]; then |
|---|
| 398 | memopt=" -N " |
|---|
| 399 | elif [ "$1" = "--nuc" ]; then |
|---|
| 400 | seqtype=" -D " |
|---|
| 401 | elif [ "$1" = "--amino" ]; then |
|---|
| 402 | seqtype=" -P " |
|---|
| 403 | elif [ "$1" = "--fft" ]; then |
|---|
| 404 | fft=1 |
|---|
| 405 | forcefft=1 |
|---|
| 406 | elif [ "$1" = "--nofft" ]; then |
|---|
| 407 | fft=0 |
|---|
| 408 | elif [ "$1" = "--quiet" ]; then |
|---|
| 409 | if [ $os = "mingw" ]; then |
|---|
| 410 | progressfile="nul" |
|---|
| 411 | else |
|---|
| 412 | progressfile="/dev/null" |
|---|
| 413 | fi |
|---|
| 414 | elif [ "$1" = "--debug" ]; then |
|---|
| 415 | debug=1 |
|---|
| 416 | elif [ "$1" = "--coreext" ]; then |
|---|
| 417 | coreext=" -c " |
|---|
| 418 | elif [ "$1" = "--core" ]; then |
|---|
| 419 | coreout=1 |
|---|
| 420 | elif [ "$1" = "--adjustdirection" ]; then |
|---|
| 421 | adjustdirection=1 |
|---|
| 422 | elif [ "$1" = "--adjustdirectionaccurately" ]; then |
|---|
| 423 | adjustdirection=2 |
|---|
| 424 | elif [ "$1" = "--progress" ]; then |
|---|
| 425 | shift |
|---|
| 426 | progressfile="$1" |
|---|
| 427 | if ! ( expr "$progressfile" : "/" > /dev/null || expr "$progressfile" : "[A-Za-z]\:" > /dev/null ) ; then |
|---|
| 428 | echo "Specify a progress file name with the absolute path!" 1>&2 |
|---|
| 429 | exit |
|---|
| 430 | fi |
|---|
| 431 | elif [ "$1" = "--out" ]; then |
|---|
| 432 | shift |
|---|
| 433 | outputfile="$1" |
|---|
| 434 | elif [ "$1" = "--thread" ]; then |
|---|
| 435 | shift |
|---|
| 436 | if ! expr "$1" : "[0-9\-]" > /dev/null ; then |
|---|
| 437 | echo "Specify the number of threads!" 1>&2 |
|---|
| 438 | exit |
|---|
| 439 | fi |
|---|
| 440 | numthreads=`expr "$1" - 0` |
|---|
| 441 | elif [ "$1" = "--threadit" ]; then |
|---|
| 442 | shift |
|---|
| 443 | if ! expr "$1" : "[0-9\-]" > /dev/null ; then |
|---|
| 444 | echo "Specify the number of threads for the iterative step!" 1>&2 |
|---|
| 445 | exit |
|---|
| 446 | fi |
|---|
| 447 | numthreadsit=`expr "$1" - 0` |
|---|
| 448 | elif [ "$1" = "--last_subopt" ]; then |
|---|
| 449 | last_subopt="-S" |
|---|
| 450 | elif [ "$1" = "--last_once" ]; then |
|---|
| 451 | last_once="-Q" |
|---|
| 452 | elif [ "$1" = "--last_m" ]; then |
|---|
| 453 | shift |
|---|
| 454 | last_m=`expr "$1" - 0` |
|---|
| 455 | elif [ "$1" = "--last_e" ]; then |
|---|
| 456 | shift |
|---|
| 457 | last_e=`expr "$1" - 0` |
|---|
| 458 | elif [ "$1" = "--randomseed" ]; then |
|---|
| 459 | shift |
|---|
| 460 | randomseed=`expr "$1" - 0` |
|---|
| 461 | elif [ "$1" = "--bestfirst" ]; then |
|---|
| 462 | parallelizationstrategy="BESTFIRST" |
|---|
| 463 | elif [ "$1" = "--adhoc0" ]; then |
|---|
| 464 | parallelizationstrategy="BAATARI0" |
|---|
| 465 | elif [ "$1" = "--adhoc1" ]; then |
|---|
| 466 | parallelizationstrategy="BAATARI1" |
|---|
| 467 | elif [ "$1" = "--adhoc2" ]; then |
|---|
| 468 | parallelizationstrategy="BAATARI2" |
|---|
| 469 | elif [ "$1" = "--simplehillclimbing" ]; then |
|---|
| 470 | parallelizationstrategy="BAATARI2" |
|---|
| 471 | elif [ "$1" = "--scoreout" ]; then |
|---|
| 472 | scoreoutarg="-S -B" |
|---|
| 473 | elif [ "$1" = "--outnum" ]; then |
|---|
| 474 | scoreoutarg="-n" |
|---|
| 475 | elif [ "$1" = "--merge" ]; then |
|---|
| 476 | shift |
|---|
| 477 | mergetable="$1" |
|---|
| 478 | if [ ! -e "$mergetable" ]; then |
|---|
| 479 | echo "Cannot open $mergetable" 1>&2 |
|---|
| 480 | exit |
|---|
| 481 | fi |
|---|
| 482 | elif [ "$1" = "--addprofile" ]; then |
|---|
| 483 | shift |
|---|
| 484 | addarg0="-I" |
|---|
| 485 | addfile="$1" |
|---|
| 486 | elif [ "$1" = "--add" ]; then |
|---|
| 487 | shift |
|---|
| 488 | addarg0="-K -I" |
|---|
| 489 | addfile="$1" |
|---|
| 490 | elif [ "$1" = "--addfragments" ]; then |
|---|
| 491 | shift |
|---|
| 492 | addarg0="-K -I" |
|---|
| 493 | addfile="$1" |
|---|
| 494 | fragment=1 |
|---|
| 495 | elif [ "$1" = "--addfull" ]; then |
|---|
| 496 | shift |
|---|
| 497 | addarg0="-K -I" |
|---|
| 498 | addfile="$1" |
|---|
| 499 | fragment=-1 |
|---|
| 500 | elif [ "$1" = "--maxiterate" ]; then |
|---|
| 501 | shift |
|---|
| 502 | iterate=`expr "$1" - 0` |
|---|
| 503 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 504 | echo "Specify the number of iterations!" 1>&2 |
|---|
| 505 | exit |
|---|
| 506 | fi |
|---|
| 507 | elif [ "$1" = "--retree" ]; then |
|---|
| 508 | shift |
|---|
| 509 | cycle=`expr "$1" - 0` |
|---|
| 510 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 511 | echo "Specify the number of tree rebuilding!" 1>&2 |
|---|
| 512 | exit |
|---|
| 513 | fi |
|---|
| 514 | elif [ "$1" = "--aamatrix" ]; then |
|---|
| 515 | shift |
|---|
| 516 | sbstmodel=" -b -1 " |
|---|
| 517 | aamatrix="$1" |
|---|
| 518 | if [ ! -e "$aamatrix" ]; then |
|---|
| 519 | echo "Cannot open $aamatrix" 1>&2 |
|---|
| 520 | exit |
|---|
| 521 | fi |
|---|
| 522 | elif [ "$1" = "--treein" ]; then |
|---|
| 523 | shift |
|---|
| 524 | treeinopt=" -U " |
|---|
| 525 | treein=1 |
|---|
| 526 | treeinfile="$1" |
|---|
| 527 | if [ ! -e "$treeinfile" ]; then |
|---|
| 528 | echo "Cannot open $treeinfile" 1>&2 |
|---|
| 529 | exit |
|---|
| 530 | fi |
|---|
| 531 | elif [ "$1" = "--topin" ]; then |
|---|
| 532 | shift |
|---|
| 533 | treeinopt=" -V " |
|---|
| 534 | treein=1 |
|---|
| 535 | treeinfile="$1" |
|---|
| 536 | echo "The --topin option has been disabled." 1>&2 |
|---|
| 537 | echo "There was a bug in version < 6.530." 1>&2 |
|---|
| 538 | echo "This bug has not yet been fixed." 1>&2 |
|---|
| 539 | exit 1 |
|---|
| 540 | elif [ "$1" = "--kappa" ]; then |
|---|
| 541 | shift |
|---|
| 542 | kappa=" -k $1 " |
|---|
| 543 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 544 | echo "Specify kappa value!" 1>&2 |
|---|
| 545 | exit |
|---|
| 546 | fi |
|---|
| 547 | elif [ "$1" = "--fmodel" ]; then |
|---|
| 548 | fmodel=" -a " |
|---|
| 549 | elif [ "$1" = "--jtt" ]; then |
|---|
| 550 | shift |
|---|
| 551 | sbstmodel=" -j $1" |
|---|
| 552 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 553 | echo "Specify pam value!" 1>&2 |
|---|
| 554 | exit |
|---|
| 555 | fi |
|---|
| 556 | elif [ "$1" = "--kimura" ]; then |
|---|
| 557 | shift |
|---|
| 558 | sbstmodel=" -j $1" |
|---|
| 559 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 560 | echo "Specify pam value!" 1>&2 |
|---|
| 561 | exit |
|---|
| 562 | fi |
|---|
| 563 | elif [ "$1" = "--tm" ]; then |
|---|
| 564 | shift |
|---|
| 565 | sbstmodel=" -m $1" |
|---|
| 566 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 567 | echo "Specify pam value!" 1>&2 |
|---|
| 568 | exit |
|---|
| 569 | fi |
|---|
| 570 | elif [ "$1" = "--bl" ]; then |
|---|
| 571 | shift |
|---|
| 572 | sbstmodel=" -b $1" |
|---|
| 573 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 574 | echo "blosum $1?" 1>&2 |
|---|
| 575 | exit |
|---|
| 576 | fi |
|---|
| 577 | elif [ "$1" = "--weighti" ]; then |
|---|
| 578 | shift |
|---|
| 579 | weighti="$1" |
|---|
| 580 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 581 | echo "Specify weighti value!" 1>&2 |
|---|
| 582 | exit |
|---|
| 583 | fi |
|---|
| 584 | elif [ "$1" = "--weightr" ]; then |
|---|
| 585 | shift |
|---|
| 586 | weightr="$1" |
|---|
| 587 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 588 | echo "Specify weightr value!" 1>&2 |
|---|
| 589 | exit |
|---|
| 590 | fi |
|---|
| 591 | elif [ "$1" = "--weightm" ]; then |
|---|
| 592 | shift |
|---|
| 593 | weightm="$1" |
|---|
| 594 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 595 | echo "Specify weightm value!" 1>&2 |
|---|
| 596 | exit |
|---|
| 597 | fi |
|---|
| 598 | elif [ "$1" = "--rnaalifold" ]; then |
|---|
| 599 | rnaalifold=1 |
|---|
| 600 | elif [ "$1" = "--mccaskill" ]; then |
|---|
| 601 | mccaskill=1 |
|---|
| 602 | contrafold=0 |
|---|
| 603 | dafs=0 |
|---|
| 604 | elif [ "$1" = "--contrafold" ]; then |
|---|
| 605 | mccaskill=0 |
|---|
| 606 | contrafold=1 |
|---|
| 607 | dafs=0 |
|---|
| 608 | elif [ "$1" = "--dafs" ]; then |
|---|
| 609 | mccaskill=0 |
|---|
| 610 | contrafold=0 |
|---|
| 611 | dafs=1 |
|---|
| 612 | elif [ "$1" = "--ribosum" ]; then |
|---|
| 613 | rnascoremtx=" -s " |
|---|
| 614 | elif [ "$1" = "--op" ]; then |
|---|
| 615 | shift |
|---|
| 616 | gop="$1" |
|---|
| 617 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 618 | echo "Specify op!" 1>&2 |
|---|
| 619 | exit |
|---|
| 620 | fi |
|---|
| 621 | elif [ "$1" = "--ep" ]; then |
|---|
| 622 | shift |
|---|
| 623 | aof="$1" |
|---|
| 624 | if ! expr "$1" : "[0-9]" > /dev/null ; then |
|---|
| 625 | echo "Specify ep!" 1>&2 |
|---|
| 626 | exit |
|---|
| 627 | fi |
|---|
| 628 | elif [ "$1" = "--rop" ]; then |
|---|
| 629 | shift |
|---|
| 630 | rgop="$1" |
|---|
| 631 | # Atode check |
|---|
| 632 | elif [ "$1" = "--rep" ]; then |
|---|
| 633 | shift |
|---|
| 634 | rgep="$1" |
|---|
| 635 | elif [ "$1" = "--lop" ]; then |
|---|
| 636 | shift |
|---|
| 637 | lgop="$1" |
|---|
| 638 | elif [ "$1" = "--LOP" ]; then |
|---|
| 639 | shift |
|---|
| 640 | LGOP="$1" |
|---|
| 641 | elif [ "$1" = "--lep" ]; then |
|---|
| 642 | shift |
|---|
| 643 | laof="$1" |
|---|
| 644 | elif [ "$1" = "--lexp" ]; then |
|---|
| 645 | shift |
|---|
| 646 | lexp="$1" |
|---|
| 647 | elif [ "$1" = "--LEXP" ]; then |
|---|
| 648 | shift |
|---|
| 649 | LEXP="$1" |
|---|
| 650 | elif [ "$1" = "--GEXP" ]; then |
|---|
| 651 | shift |
|---|
| 652 | GEXP="$1" |
|---|
| 653 | elif [ "$1" = "--GOP" ]; then |
|---|
| 654 | shift |
|---|
| 655 | GGOP="$1" |
|---|
| 656 | elif [ "$1" = "--gop" ]; then |
|---|
| 657 | shift |
|---|
| 658 | pggop="$1" |
|---|
| 659 | elif [ "$1" = "--gep" ]; then |
|---|
| 660 | shift |
|---|
| 661 | pgaof="$1" |
|---|
| 662 | elif [ "$1" = "--gexp" ]; then |
|---|
| 663 | shift |
|---|
| 664 | pgexp="$1" |
|---|
| 665 | elif [ "$1" = "--laraparams" ]; then |
|---|
| 666 | shift |
|---|
| 667 | laraparams="$1" |
|---|
| 668 | elif [ "$1" = "--corethr" ]; then |
|---|
| 669 | shift |
|---|
| 670 | corethr="$1" |
|---|
| 671 | elif [ "$1" = "--corewin" ]; then |
|---|
| 672 | shift |
|---|
| 673 | corewin="$1" |
|---|
| 674 | elif [ "$1" = "--seedtable" ]; then |
|---|
| 675 | shift |
|---|
| 676 | seedtable="y" |
|---|
| 677 | seedtablefile="$1" |
|---|
| 678 | elif [ "$1" = "--seed" ]; then |
|---|
| 679 | shift |
|---|
| 680 | seed="m" |
|---|
| 681 | seedfiles="$seedfiles $1" |
|---|
| 682 | elif [ $progname = "fftns" -o $progname = "nwns" ]; then |
|---|
| 683 | if [ "$1" -gt 0 ]; then |
|---|
| 684 | cycle=`expr "$1" - 0` |
|---|
| 685 | fi |
|---|
| 686 | else |
|---|
| 687 | echo "Unknown option: $1" 1>&2 |
|---|
| 688 | er=1; |
|---|
| 689 | fi |
|---|
| 690 | shift |
|---|
| 691 | done; |
|---|
| 692 | |
|---|
| 693 | echo "" 1>"$progressfile" |
|---|
| 694 | |
|---|
| 695 | # TMPFILE=/tmp/$progname.$$ |
|---|
| 696 | TMPFILE=`mktemp -dt $progname.XXXXXXXXXX` |
|---|
| 697 | if [ $? -ne 0 ]; then |
|---|
| 698 | echo "mktemp seems to be obsolete. Re-trying without -t" 1>&2 |
|---|
| 699 | TMPFILE=`mktemp -d /tmp/$progname.XXXXXXXXXX` |
|---|
| 700 | fi |
|---|
| 701 | umask 077 |
|---|
| 702 | # mkdir $TMPFILE || er=1 |
|---|
| 703 | if [ $debug -eq 1 ]; then |
|---|
| 704 | trap "tar cfvz debuginfo.tgz $TMPFILE; rm -rf $TMPFILE " 0 |
|---|
| 705 | else |
|---|
| 706 | trap "rm -rf $TMPFILE" 0 |
|---|
| 707 | fi |
|---|
| 708 | if [ $# -eq 1 ]; then |
|---|
| 709 | if [ -r "$1" -o "$1" = - ]; then |
|---|
| 710 | |
|---|
| 711 | if [ -r "$addfile" ]; then |
|---|
| 712 | printf ''; |
|---|
| 713 | else |
|---|
| 714 | echo "$0": Cannot open "$addfile". 1>&2 |
|---|
| 715 | exit 1; |
|---|
| 716 | fi |
|---|
| 717 | |
|---|
| 718 | cat "$1" | tr "\r" "\n" > $TMPFILE/infile |
|---|
| 719 | echo "" >> $TMPFILE/infile |
|---|
| 720 | cat "$addfile" | tr "\r" "\n" | grep -v "^$" >> $TMPFILE/infile |
|---|
| 721 | cat "$addfile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_addfile |
|---|
| 722 | cat "$aamatrix" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_aamtx |
|---|
| 723 | cat "$mergetable" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_subalignmentstable |
|---|
| 724 | cat "$treeinfile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_guidetree |
|---|
| 725 | cat "$seedtablefile" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_seedtablefile |
|---|
| 726 | cat "$laraparams" | tr "\r" "\n" | grep -v "^$" > $TMPFILE/_lara.params |
|---|
| 727 | |
|---|
| 728 | # echo $seedfiles |
|---|
| 729 | infilename="$1" |
|---|
| 730 | seedfilesintmp="/dev/null" |
|---|
| 731 | seednseq="0" |
|---|
| 732 | set $seedfiles > /dev/null |
|---|
| 733 | while [ $# -gt 1 ]; |
|---|
| 734 | do |
|---|
| 735 | shift |
|---|
| 736 | if [ -r "$1" ]; then |
|---|
| 737 | cat "$1" | tr "\r" "\n" > $TMPFILE/seed$# |
|---|
| 738 | else |
|---|
| 739 | echo "$0": Cannot open "$1". 1>&2 |
|---|
| 740 | exit 1; |
|---|
| 741 | fi |
|---|
| 742 | seednseq=$seednseq" "`grep -c '^[>|=]' $TMPFILE/seed$#` |
|---|
| 743 | seedfilesintmp=$seedfilesintmp" "seed$# |
|---|
| 744 | done |
|---|
| 745 | # ls $TMPFILE |
|---|
| 746 | # echo $seedfilesintmp |
|---|
| 747 | # echo $seednseq |
|---|
| 748 | |
|---|
| 749 | |
|---|
| 750 | else |
|---|
| 751 | echo "$0": Cannot open "$1". 1>&2 |
|---|
| 752 | er=1 |
|---|
| 753 | # exit 1; |
|---|
| 754 | fi |
|---|
| 755 | else |
|---|
| 756 | echo '$#'"=$#" 1>&2 |
|---|
| 757 | er=1 |
|---|
| 758 | fi |
|---|
| 759 | |
|---|
| 760 | |
|---|
| 761 | |
|---|
| 762 | if [ $numthreads -lt 0 ]; then |
|---|
| 763 | if [ $os = "linux" ]; then |
|---|
| 764 | nlogicalcore=`cat /proc/cpuinfo | grep "^processor" | uniq | wc -l` |
|---|
| 765 | ncoresinacpu=`cat /proc/cpuinfo | grep 'cpu cores' | uniq | awk '{print $4}'` |
|---|
| 766 | nphysicalcpu=`cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l` |
|---|
| 767 | if [ $nlogicalcore -eq 0 ]; then |
|---|
| 768 | echo "Cannot get the number of processors from /proc/cpuinfo" 1>>"$progressfile" |
|---|
| 769 | exit 1 |
|---|
| 770 | fi |
|---|
| 771 | if [ ${#ncoresinacpu} -gt 0 -a $nphysicalcpu -gt 0 ]; then |
|---|
| 772 | numthreads=`expr $ncoresinacpu '*' $nphysicalcpu` |
|---|
| 773 | # if [ $nlogicalcore -gt $numthreads ]; then # Hyperthreading |
|---|
| 774 | # numthreads=`expr $numthreads '+' 1` |
|---|
| 775 | # fi |
|---|
| 776 | else |
|---|
| 777 | numthreads=$nlogicalcore |
|---|
| 778 | fi |
|---|
| 779 | elif [ $os = "darwin" ]; then |
|---|
| 780 | numthreads=`sysctl -n hw.physicalcpu` |
|---|
| 781 | if [ -z $numthreads ]; then |
|---|
| 782 | echo "Cannot get the number of physical cores from sysctl" 1>>"$progressfile" |
|---|
| 783 | exit 1 |
|---|
| 784 | fi |
|---|
| 785 | # nlogicalcore=`sysctl -n hw.logicalcpu` |
|---|
| 786 | # if [ $nlogicalcore -gt $numthreads ]; then # Hyperthreading |
|---|
| 787 | # numthreads=`expr $numthreads '+' 1` |
|---|
| 788 | # fi |
|---|
| 789 | elif [ $os = "mingw" -o $os = "cygwin" ]; then |
|---|
| 790 | numthreads=0 |
|---|
| 791 | else |
|---|
| 792 | echo "Cannot count the number of physical cores." 1>>"$progressfile" |
|---|
| 793 | exit 1 |
|---|
| 794 | fi |
|---|
| 795 | echo $os 1>>"$progressfile" |
|---|
| 796 | echo $numthreads 1>>"$progressfile" |
|---|
| 797 | fi |
|---|
| 798 | |
|---|
| 799 | if [ $numthreadsit -lt 0 ]; then |
|---|
| 800 | if [ $numthreads -lt 7 ]; then |
|---|
| 801 | numthreadsit=$numthreads |
|---|
| 802 | else |
|---|
| 803 | numthreadsit=6 |
|---|
| 804 | fi |
|---|
| 805 | fi |
|---|
| 806 | |
|---|
| 807 | if [ $numthreadsit -eq 0 -a $parallelizationstrategy = "BESTFIRST" ]; then |
|---|
| 808 | echo 'Impossible' 1>&2; |
|---|
| 809 | exit 1; |
|---|
| 810 | fi |
|---|
| 811 | |
|---|
| 812 | if [ "$addarg0" != " " ]; then |
|---|
| 813 | iterate=0 # 2013/03/23 |
|---|
| 814 | "$prefix/countlen" < $TMPFILE/_addfile > $TMPFILE/addsize 2>>"$progressfile" |
|---|
| 815 | nadd=`awk '{print $1}' $TMPFILE/addsize` |
|---|
| 816 | if [ $nadd -eq "0" ]; then |
|---|
| 817 | echo Check $addfile 1>&2 |
|---|
| 818 | exit 1; |
|---|
| 819 | fi |
|---|
| 820 | if [ $seed != "x" -o $seedtable != "x" ]; then |
|---|
| 821 | echo 'Impossible' 1>&2; |
|---|
| 822 | echo 'Use either ONE of --seed, --seedtable, --addprofile and --add.' 1>&2 |
|---|
| 823 | exit 1; |
|---|
| 824 | fi |
|---|
| 825 | else |
|---|
| 826 | nadd="0" |
|---|
| 827 | fi |
|---|
| 828 | |
|---|
| 829 | if [ $auto -eq 1 ]; then |
|---|
| 830 | "$prefix/countlen" < $TMPFILE/infile > $TMPFILE/size 2>>"$progressfile" |
|---|
| 831 | nseq=`awk '{print $1}' $TMPFILE/size` |
|---|
| 832 | nlen=`awk '{print $3}' $TMPFILE/size` |
|---|
| 833 | if [ $nlen -lt 2000 -a $nseq -lt 100 ]; then |
|---|
| 834 | distance="local" |
|---|
| 835 | iterate=1000 |
|---|
| 836 | elif [ $nlen -lt 10000 -a $nseq -lt 500 ]; then |
|---|
| 837 | distance="ktuples" |
|---|
| 838 | iterate=2 |
|---|
| 839 | cycle=2 |
|---|
| 840 | elif [ $nseq -lt 10000 ]; then |
|---|
| 841 | distance="ktuples" |
|---|
| 842 | iterate=0 |
|---|
| 843 | cycle=2 |
|---|
| 844 | elif [ $nseq -lt 30000 ]; then |
|---|
| 845 | distance="ktuples" |
|---|
| 846 | iterate=0 |
|---|
| 847 | cycle=1 |
|---|
| 848 | elif [ $nlen -lt 10000 ]; then |
|---|
| 849 | distance="parttree" |
|---|
| 850 | partdist="localalign" |
|---|
| 851 | algopt=" " |
|---|
| 852 | algoptit=" " |
|---|
| 853 | algspecified=1 |
|---|
| 854 | cycle=1 |
|---|
| 855 | else |
|---|
| 856 | distance="parttree" |
|---|
| 857 | partdist="ktuples" |
|---|
| 858 | algopt=" " |
|---|
| 859 | algoptit=" " |
|---|
| 860 | algspecified=1 |
|---|
| 861 | cycle=1 |
|---|
| 862 | fi |
|---|
| 863 | if [ $fragment -ne 0 ]; then |
|---|
| 864 | norg=`expr $nseq '-' $nadd` |
|---|
| 865 | npair=`expr $norg '*' $nadd` |
|---|
| 866 | echo "nadd = " $nadd 1>>"$progressfile" |
|---|
| 867 | echo "npair = " $npair 1>>"$progressfile" |
|---|
| 868 | # nagasa check! |
|---|
| 869 | # |
|---|
| 870 | if [ $npair -gt 10000000 ]; then # ato de kentou |
|---|
| 871 | distance="ktuples" |
|---|
| 872 | echo "use ktuples! size=$tuplesize" 1>>"$progressfile" |
|---|
| 873 | elif [ $npair -gt 3000000 ]; then # ato de kentou |
|---|
| 874 | distance="multi" |
|---|
| 875 | weighti="0.0" |
|---|
| 876 | echo "use multipair, weighti=0.0!" 1>>"$progressfile" |
|---|
| 877 | else |
|---|
| 878 | distance="multi" |
|---|
| 879 | echo "use multipair, weighti=$weighti!" 1>>"$progressfile" |
|---|
| 880 | fi |
|---|
| 881 | pairspecified=1 |
|---|
| 882 | fi |
|---|
| 883 | fi |
|---|
| 884 | |
|---|
| 885 | if [ $parallelizationstrategy = "BESTFIRST" -o $parallelizationstrategy = "BAATARI0" ]; then |
|---|
| 886 | iteratelimit=254 |
|---|
| 887 | else |
|---|
| 888 | iteratelimit=16 |
|---|
| 889 | fi |
|---|
| 890 | if [ $iterate -gt $iteratelimit ]; then #?? |
|---|
| 891 | iterate=$iteratelimit |
|---|
| 892 | fi |
|---|
| 893 | |
|---|
| 894 | if [ $rnaalifold -eq 1 ]; then |
|---|
| 895 | rnaopt=" -e $rgep -o $rgop -c $weightm -r $weightr -R $rnascoremtx " |
|---|
| 896 | # rnaoptit=" -o $rgop -BT -c $weightm -r $weightr -R " |
|---|
| 897 | rnaoptit=" -o $rgop -F -c $weightm -r $weightr -R " |
|---|
| 898 | elif [ $mccaskill -eq 1 -o $dafs -eq 1 -o $contrafold -eq 1 ]; then |
|---|
| 899 | rnaopt=" -o $rgop -c $weightm -r $weightr " |
|---|
| 900 | # rnaoptit=" -e $rgep -o $rgop -BT -c $weightm -r $weightr $rnascoremtx " |
|---|
| 901 | rnaoptit=" -e $rgep -o $rgop -F -c $weightm -r $weightr $rnascoremtx " |
|---|
| 902 | else |
|---|
| 903 | rnaopt=" " |
|---|
| 904 | rnaoptit=" -F " |
|---|
| 905 | fi |
|---|
| 906 | |
|---|
| 907 | if [ $algspecified -eq 0 ]; then |
|---|
| 908 | if [ $distance = "parttree" ]; then |
|---|
| 909 | algopt=" -Q " |
|---|
| 910 | algoptit=" " |
|---|
| 911 | else |
|---|
| 912 | algopt=" " |
|---|
| 913 | algoptit=" " |
|---|
| 914 | fi |
|---|
| 915 | fi |
|---|
| 916 | |
|---|
| 917 | model="$sbstmodel $kappa $fmodel" |
|---|
| 918 | |
|---|
| 919 | if [ $er -eq 1 ]; then |
|---|
| 920 | echo "------------------------------------------------------------------------------" 1>&2 |
|---|
| 921 | echo " MAFFT" $version 1>&2 |
|---|
| 922 | # echo "" 1>&2 |
|---|
| 923 | # echo " Input format: fasta" 1>&2 |
|---|
| 924 | # echo "" 1>&2 |
|---|
| 925 | # echo " Usage: `basename $0` [options] inputfile > outputfile" 1>&2 |
|---|
| 926 | echo " http://mafft.cbrc.jp/alignment/software/" 1>&2 |
|---|
| 927 | echo " MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)" 1>&2 |
|---|
| 928 | # echo "------------------------------------------------------------------------------" 1>&2 |
|---|
| 929 | # echo " % mafft in > out" 1>&2 |
|---|
| 930 | echo "------------------------------------------------------------------------------" 1>&2 |
|---|
| 931 | # echo "" 1>&2 |
|---|
| 932 | echo "High speed:" 1>&2 |
|---|
| 933 | echo " % mafft in > out" 1>&2 |
|---|
| 934 | echo " % mafft --retree 1 in > out (fast)" 1>&2 |
|---|
| 935 | echo "" 1>&2 |
|---|
| 936 | echo "High accuracy (for <~200 sequences x <~2,000 aa/nt):" 1>&2 |
|---|
| 937 | echo " % mafft --maxiterate 1000 --localpair in > out (% linsi in > out is also ok)" 1>&2 |
|---|
| 938 | echo " % mafft --maxiterate 1000 --genafpair in > out (% einsi in > out)" 1>&2 |
|---|
| 939 | echo " % mafft --maxiterate 1000 --globalpair in > out (% ginsi in > out)" 1>&2 |
|---|
| 940 | echo "" 1>&2 |
|---|
| 941 | echo "If unsure which option to use:" 1>&2 |
|---|
| 942 | echo " % mafft --auto in > out" 1>&2 |
|---|
| 943 | echo "" 1>&2 |
|---|
| 944 | # echo "Other options:" 1>&2 |
|---|
| 945 | echo "--op # : Gap opening penalty, default: 1.53" 1>&2 |
|---|
| 946 | echo "--ep # : Offset (works like gap extension penalty), default: 0.0" 1>&2 |
|---|
| 947 | echo "--maxiterate # : Maximum number of iterative refinement, default: 0" 1>&2 |
|---|
| 948 | echo "--clustalout : Output: clustal format, default: fasta" 1>&2 |
|---|
| 949 | echo "--reorder : Outorder: aligned, default: input order" 1>&2 |
|---|
| 950 | echo "--quiet : Do not report progress" 1>&2 |
|---|
| 951 | echo "--thread # : Number of threads (if unsure, --thread -1)" 1>&2 |
|---|
| 952 | # echo "" 1>&2 |
|---|
| 953 | # echo " % mafft --maxiterate 1000 --localpair in > out (L-INS-i)" 1>&2 |
|---|
| 954 | # echo " most accurate in many cases, assumes only one alignable domain" 1>&2 |
|---|
| 955 | # echo "" 1>&2 |
|---|
| 956 | # echo " % mafft --maxiterate 1000 --genafpair in > out (E-INS-i)" 1>&2 |
|---|
| 957 | # echo " works well if many unalignable residues exist between alignable domains" 1>&2 |
|---|
| 958 | # echo "" 1>&2 |
|---|
| 959 | # echo " % mafft --maxiterate 1000 --globalpair in > out (G-INS-i)" 1>&2 |
|---|
| 960 | # echo " suitable for globally alignable sequences " 1>&2 |
|---|
| 961 | # echo "" 1>&2 |
|---|
| 962 | # echo " % mafft --maxiterate 1000 in > out (FFT-NS-i)" 1>&2 |
|---|
| 963 | # echo " accurate and slow, iterative refinement method " 1>&2 |
|---|
| 964 | # echo "" 1>&2 |
|---|
| 965 | # echo "If the input sequences are long (~1,000,000nt)," 1>&2 |
|---|
| 966 | # echo " % mafft --retree 1 --memsave --fft in > out (FFT-NS-1-memsave, new in v5.8)" 1>&2 |
|---|
| 967 | # echo "" 1>&2 |
|---|
| 968 | # echo "If many (~5,000) sequences are to be aligned," 1>&2 |
|---|
| 969 | # echo "" 1>&2 |
|---|
| 970 | # echo " % mafft --retree 1 [--memsave] --nofft in > out (NW-NS-1, new in v5.8)" 1>&2 |
|---|
| 971 | # echo "" 1>&2 |
|---|
| 972 | # echo " --localpair : All pairwise local alignment information is included" 1>&2 |
|---|
| 973 | # echo " to the objective function, default: off" 1>&2 |
|---|
| 974 | # echo " --globalpair : All pairwise global alignment information is included" 1>&2 |
|---|
| 975 | # echo " to the objective function, default: off" 1>&2 |
|---|
| 976 | # echo " --op # : Gap opening penalty, default: $defaultgop " 1>&2 |
|---|
| 977 | # echo " --ep # : Offset (works like gap extension penalty), default: $defaultaof " 1>&2 |
|---|
| 978 | # echo " --bl #, --jtt # : Scoring matrix, default: BLOSUM62" 1>&2 |
|---|
| 979 | # echo " Alternatives are BLOSUM (--bl) 30, 45, 62, 80, " 1>&2 |
|---|
| 980 | # echo " or JTT (--jtt) # PAM. " 1>&2 |
|---|
| 981 | # echo " --nuc or --amino : Sequence type, default: auto" 1>&2 |
|---|
| 982 | # echo " --retree # : The number of tree building in progressive method " 1>&2 |
|---|
| 983 | # echo " (see the paper for detail), default: $defaultcycle " 1>&2 |
|---|
| 984 | # echo " --maxiterate # : Maximum number of iterative refinement, default: $defaultiterate " 1>&2 |
|---|
| 985 | # if [ $defaultfft -eq 1 ]; then |
|---|
| 986 | # echo " --fft or --nofft: FFT is enabled or disabled, default: enabled" 1>&2 |
|---|
| 987 | # else |
|---|
| 988 | # echo " --fft or --nofft: FFT is enabled or disabled, default: disabled" 1>&2 |
|---|
| 989 | # fi |
|---|
| 990 | # echo " --memsave: Memory saving mode" 1>&2 |
|---|
| 991 | # echo " (for long genomic sequences), default: off" 1>&2 |
|---|
| 992 | # echo " --clustalout : Output: clustal format, default: fasta" 1>&2 |
|---|
| 993 | # echo " --reorder : Outorder: aligned, default: input order" 1>&2 |
|---|
| 994 | # echo " --quiet : Do not report progress" 1>&2 |
|---|
| 995 | # echo "-----------------------------------------------------------------------------" 1>&2 |
|---|
| 996 | exit 1; |
|---|
| 997 | fi |
|---|
| 998 | if [ $sw -eq 1 ]; then |
|---|
| 999 | swopt=" -A " |
|---|
| 1000 | else |
|---|
| 1001 | swopt=" " |
|---|
| 1002 | fi |
|---|
| 1003 | |
|---|
| 1004 | if [ $distance = "fasta" -o $partdist = "fasta" ]; then |
|---|
| 1005 | if [ ! "$FASTA_4_MAFFT" ]; then |
|---|
| 1006 | FASTA_4_MAFFT=`which fasta34` |
|---|
| 1007 | fi |
|---|
| 1008 | |
|---|
| 1009 | if [ ! -x "$FASTA_4_MAFFT" ]; then |
|---|
| 1010 | echo "" 1>&2 |
|---|
| 1011 | echo "== Install FASTA ========================================================" 1>&2 |
|---|
| 1012 | echo "This option requires the fasta34 program (FASTA version x.xx or higher)" 1>&2 |
|---|
| 1013 | echo "installed in your PATH. If you have the fasta34 program but have renamed" 1>&2 |
|---|
| 1014 | echo "(like /usr/local/bin/myfasta), set the FASTA_4_MAFFT environment variable" 1>&2 |
|---|
| 1015 | echo "to point your fasta34 (like setenv FASTA_4_MAFFT /usr/local/bin/myfasta)." 1>&2 |
|---|
| 1016 | echo "=========================================================================" 1>&2 |
|---|
| 1017 | echo "" 1>&2 |
|---|
| 1018 | exit 1 |
|---|
| 1019 | fi |
|---|
| 1020 | fi |
|---|
| 1021 | if [ $distance = "last" -o $distance = "lastmulti" ]; then |
|---|
| 1022 | if [ ! -x "$prefix/lastal" -o ! -x "$prefix/lastdb" ]; then |
|---|
| 1023 | echo "" 1>&2 |
|---|
| 1024 | echo "== Install LAST ============================================================" 1>&2 |
|---|
| 1025 | echo "LAST (Kielbasa, Wan, Sato, Horton, Frith 2011 Genome Res. 21:487) is required." 1>&2 |
|---|
| 1026 | echo "http://last.cbrc.jp/" 1>&2 |
|---|
| 1027 | echo "http://mafft.cbrc.jp/alignment/software/xxxxxxx.html " 1>&2 |
|---|
| 1028 | echo "============================================================================" 1>&2 |
|---|
| 1029 | echo "" 1>&2 |
|---|
| 1030 | exit 1 |
|---|
| 1031 | fi |
|---|
| 1032 | fi |
|---|
| 1033 | if [ $distance = "lara" -o $distance = "slara" ]; then |
|---|
| 1034 | if [ ! -x "$prefix/mafft_lara" ]; then |
|---|
| 1035 | echo "" 1>&2 |
|---|
| 1036 | echo "== Install LaRA =========================================================" 1>&2 |
|---|
| 1037 | echo "This option requires LaRA (Bauer et al. http://www.planet-lisa.net/)." 1>&2 |
|---|
| 1038 | echo "The executable have to be renamed to 'mafft_lara' and installed into " 1>&2 |
|---|
| 1039 | echo "the $prefix directory. " 1>&2 |
|---|
| 1040 | echo "A configuration file of LaRA also have to be given" 1>&2 |
|---|
| 1041 | echo "mafft-xinsi --larapair --laraparams parameter_file" 1>&2 |
|---|
| 1042 | echo "mafft-xinsi --slarapair --laraparams parameter_file" 1>&2 |
|---|
| 1043 | echo "=========================================================================" 1>&2 |
|---|
| 1044 | echo "" 1>&2 |
|---|
| 1045 | exit 1 |
|---|
| 1046 | fi |
|---|
| 1047 | if [ ! -s "$laraparams" ]; then |
|---|
| 1048 | echo "" 1>&2 |
|---|
| 1049 | echo "== Configure LaRA =======================================================" 1>&2 |
|---|
| 1050 | echo "A configuration file of LaRA have to be given" 1>&2 |
|---|
| 1051 | echo "mafft-xinsi --larapair --laraparams parameter_file" 1>&2 |
|---|
| 1052 | echo "mafft-xinsi --slarapair --laraparams parameter_file" 1>&2 |
|---|
| 1053 | echo "=========================================================================" 1>&2 |
|---|
| 1054 | echo "" 1>&2 |
|---|
| 1055 | exit 1 |
|---|
| 1056 | fi |
|---|
| 1057 | fi |
|---|
| 1058 | if [ $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then |
|---|
| 1059 | if [ ! -x "$prefix/foldalign210" ]; then |
|---|
| 1060 | echo "" 1>&2 |
|---|
| 1061 | echo "== Install FOLDALIGN ====================================================" 1>&2 |
|---|
| 1062 | echo "This option requires FOLDALIGN (Havgaard et al. http://foldalign.ku.dk/)." 1>&2 |
|---|
| 1063 | echo "The executable have to be renamed to 'foldalign210' and installed into " 1>&2 |
|---|
| 1064 | echo "the $prefix directory. " 1>&2 |
|---|
| 1065 | echo "=========================================================================" 1>&2 |
|---|
| 1066 | echo "" 1>&2 |
|---|
| 1067 | exit 1 |
|---|
| 1068 | fi |
|---|
| 1069 | fi |
|---|
| 1070 | if [ $distance = "scarna" -o $mccaskill -eq 1 ]; then |
|---|
| 1071 | if [ ! -x "$prefix/mxscarnamod" ]; then |
|---|
| 1072 | echo "" 1>&2 |
|---|
| 1073 | echo "== Install MXSCARNA ======================================================" 1>&2 |
|---|
| 1074 | echo "MXSCARNA (Tabei et al. BMC Bioinformatics 2008 9:33) is required." 1>&2 |
|---|
| 1075 | echo "Please 'make' at the 'extensions' directory of the MAFFT source package," 1>&2 |
|---|
| 1076 | echo "which contains the modified version of MXSCARNA." 1>&2 |
|---|
| 1077 | echo "http://mafft.cbrc.jp/alignment/software/source.html " 1>&2 |
|---|
| 1078 | echo "==========================================================================" 1>&2 |
|---|
| 1079 | echo "" 1>&2 |
|---|
| 1080 | exit 1 |
|---|
| 1081 | fi |
|---|
| 1082 | fi |
|---|
| 1083 | if [ $distance = "dafs" -o $dafs -eq 1 ]; then |
|---|
| 1084 | if [ ! -x "$prefix/dafs" ]; then |
|---|
| 1085 | echo "" 1>&2 |
|---|
| 1086 | echo "== Install DAFS===========================================================" 1>&2 |
|---|
| 1087 | echo "DAFS (Sato et al. Journal 2012 issue:page) is required." 1>&2 |
|---|
| 1088 | echo "http://www.ncrna.org/ " 1>&2 |
|---|
| 1089 | echo "==========================================================================" 1>&2 |
|---|
| 1090 | echo "" 1>&2 |
|---|
| 1091 | exit 1 |
|---|
| 1092 | fi |
|---|
| 1093 | fi |
|---|
| 1094 | if [ $contrafold -eq 1 ]; then |
|---|
| 1095 | if [ ! -x "$prefix/contrafold" ]; then |
|---|
| 1096 | echo "" 1>&2 |
|---|
| 1097 | echo "== Install CONTRAfold ===================================================" 1>&2 |
|---|
| 1098 | echo "This option requires CONTRAfold" 1>&2 |
|---|
| 1099 | echo "(Do et al. http://contra.stanford.edu/contrafold/)." 1>&2 |
|---|
| 1100 | echo "The executable 'contrafold' have to be installed into " 1>&2 |
|---|
| 1101 | echo "the $prefix directory. " 1>&2 |
|---|
| 1102 | echo "=========================================================================" 1>&2 |
|---|
| 1103 | echo "" 1>&2 |
|---|
| 1104 | exit 1 |
|---|
| 1105 | fi |
|---|
| 1106 | fi |
|---|
| 1107 | |
|---|
| 1108 | #old |
|---|
| 1109 | # if [ $treeout -eq 1 ]; then |
|---|
| 1110 | # parttreeoutopt="-t" |
|---|
| 1111 | # if [ $cycle -eq 0 ]; then |
|---|
| 1112 | # treeoutopt="-t -T" |
|---|
| 1113 | # groupsize=1 |
|---|
| 1114 | # iterate=0 |
|---|
| 1115 | # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then |
|---|
| 1116 | # distance="distonly" |
|---|
| 1117 | # fi |
|---|
| 1118 | # else |
|---|
| 1119 | # treeoutopt="-t" |
|---|
| 1120 | # fi |
|---|
| 1121 | # else |
|---|
| 1122 | # parttreeoutopt=" " |
|---|
| 1123 | # if [ $cycle -eq 0 ]; then |
|---|
| 1124 | # treeoutopt="-t -T" |
|---|
| 1125 | # iterate=0 |
|---|
| 1126 | # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then |
|---|
| 1127 | # distance="distonly" |
|---|
| 1128 | # fi |
|---|
| 1129 | # else |
|---|
| 1130 | # treeoutopt=" " |
|---|
| 1131 | # fi |
|---|
| 1132 | # fi |
|---|
| 1133 | |
|---|
| 1134 | #new |
|---|
| 1135 | if [ $cycle -eq 0 ]; then |
|---|
| 1136 | treeoutopt="-t -T" |
|---|
| 1137 | iterate=0 |
|---|
| 1138 | # if [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o $distance = "globalgenaf" ]; then # 2012/04, localpair --> local alignment distance |
|---|
| 1139 | if [ $distance = "global" ]; then |
|---|
| 1140 | distance="distonly" |
|---|
| 1141 | fi |
|---|
| 1142 | if [ $treeout -eq 1 ]; then |
|---|
| 1143 | parttreeoutopt="-t" |
|---|
| 1144 | groupsize=1 |
|---|
| 1145 | else |
|---|
| 1146 | parttreeoutopt=" " |
|---|
| 1147 | fi |
|---|
| 1148 | if [ $distout -eq 1 ]; then |
|---|
| 1149 | distoutopt="-y -T" |
|---|
| 1150 | fi |
|---|
| 1151 | else |
|---|
| 1152 | if [ $treeout -eq 1 ]; then |
|---|
| 1153 | parttreeoutopt="-t" |
|---|
| 1154 | treeoutopt="-t" |
|---|
| 1155 | else |
|---|
| 1156 | parttreeoutopt=" " |
|---|
| 1157 | treeoutopt=" " |
|---|
| 1158 | fi |
|---|
| 1159 | if [ $distout -eq 1 ]; then |
|---|
| 1160 | distoutopt="-y" |
|---|
| 1161 | fi |
|---|
| 1162 | fi |
|---|
| 1163 | # |
|---|
| 1164 | |
|---|
| 1165 | formatcheck=`grep -c '^[[:blank:]]\+>' $TMPFILE/infile | head -1 ` |
|---|
| 1166 | if [ $formatcheck -gt 0 ]; then |
|---|
| 1167 | echo "The first character of a description line must be " 1>&2 |
|---|
| 1168 | echo "the greater-than (>) symbol, not a blank." 1>&2 |
|---|
| 1169 | echo "Please check the format around the following line(s):" 1>&2 |
|---|
| 1170 | grep -n '^[[:blank:]]\+>' $TMPFILE/infile 1>&2 |
|---|
| 1171 | exit 1 |
|---|
| 1172 | fi |
|---|
| 1173 | |
|---|
| 1174 | nseq=`grep -c '^[>|=]' $TMPFILE/infile | head -1 ` |
|---|
| 1175 | if [ $nseq -eq 2 ]; then |
|---|
| 1176 | cycle=1 |
|---|
| 1177 | fi |
|---|
| 1178 | if [ $cycle -gt 3 ]; then |
|---|
| 1179 | cycle=3 |
|---|
| 1180 | fi |
|---|
| 1181 | |
|---|
| 1182 | if [ $nseq -gt 6000 -a $iterate -gt 1 ]; then |
|---|
| 1183 | echo "Too many sequences to perform iterative refinement!" 1>&2 |
|---|
| 1184 | echo "Please use a progressive method." 1>&2 |
|---|
| 1185 | exit 1 |
|---|
| 1186 | fi |
|---|
| 1187 | if [ $distance = "lastmulti" -o $distance = "multi" ]; then |
|---|
| 1188 | if [ $fragment -eq 0 ]; then |
|---|
| 1189 | echo 'Specify --addfragments too' 1>&2 |
|---|
| 1190 | exit 1 |
|---|
| 1191 | fi |
|---|
| 1192 | fi |
|---|
| 1193 | |
|---|
| 1194 | if [ $fragment -ne 0 ]; then |
|---|
| 1195 | if [ $pairspecified -eq 0 ]; then |
|---|
| 1196 | distance="multi" |
|---|
| 1197 | fi |
|---|
| 1198 | if [ $distance != "multi" -a $distance != "hybrid" -a $distance != "lastmulti" -a $distance != "local" -a $distance != "last" -a $distance != "ktuples" -a $distance != "ktuplesmulti" ]; then |
|---|
| 1199 | echo 'Specify --multipair, --lastmultipair, --lastpair, --localpair, --6merpair, --6mermultipair or --hybridpair' 1>&2 |
|---|
| 1200 | exit 1 |
|---|
| 1201 | fi |
|---|
| 1202 | fi |
|---|
| 1203 | |
|---|
| 1204 | if [ "$memopt" = " -M -B " -a "$distance" != "ktuples" ]; then |
|---|
| 1205 | echo "Impossible" 1>&2 |
|---|
| 1206 | exit 1 |
|---|
| 1207 | fi |
|---|
| 1208 | |
|---|
| 1209 | if [ $distance = "parttree" ]; then |
|---|
| 1210 | if [ $seed != "x" -o $seedtable != "x" ]; then |
|---|
| 1211 | echo "Impossible" 1>&2 |
|---|
| 1212 | exit 1 |
|---|
| 1213 | fi |
|---|
| 1214 | if [ $iterate -gt 1 ]; then |
|---|
| 1215 | echo "Impossible" 1>&2 |
|---|
| 1216 | exit 1 |
|---|
| 1217 | fi |
|---|
| 1218 | if [ $outorder = "aligned" ]; then |
|---|
| 1219 | outorder="input" |
|---|
| 1220 | fi |
|---|
| 1221 | outorder="input" # partorder ga kiku |
|---|
| 1222 | if [ $partdist = "localalign" ]; then |
|---|
| 1223 | splitopt=" -L " # -L -l -> fast |
|---|
| 1224 | cycle=1 |
|---|
| 1225 | elif [ $partdist = "fasta" ]; then |
|---|
| 1226 | splitopt=" -S " |
|---|
| 1227 | cycle=1 |
|---|
| 1228 | else |
|---|
| 1229 | splitopt=" " |
|---|
| 1230 | fi |
|---|
| 1231 | fi |
|---|
| 1232 | |
|---|
| 1233 | |
|---|
| 1234 | |
|---|
| 1235 | if [ \( $distance = "ktuples" -o $distance = "ktuplesmulti" \) -a \( $seed = "x" -a $seedtable = "x" \) ]; then |
|---|
| 1236 | localparam=" " |
|---|
| 1237 | weighti="0.0" |
|---|
| 1238 | elif [ \( $distance = "ktuples" -o $distance = "ktuplesmulti" \) -a \( $seed != "x" -o $seedtable != "x" \) ]; then |
|---|
| 1239 | if [ $cycle -lt 2 ]; then |
|---|
| 1240 | cycle=2 # disttbfast ha seed hi-taiou |
|---|
| 1241 | fi |
|---|
| 1242 | if [ $iterate -lt 2 ]; then |
|---|
| 1243 | echo "############################################################################" 1>&2 |
|---|
| 1244 | echo "# Warning:" 1>&2 |
|---|
| 1245 | echo "# Progressive alignment method is incompatible with the --seed option." 1>&2 |
|---|
| 1246 | echo "# Automatically switched to the iterative refinement method." 1>&2 |
|---|
| 1247 | echo "# " 1>&2 |
|---|
| 1248 | echo "# Also consider using the '--add' option, which is compatible with" 1>&2 |
|---|
| 1249 | echo "# the progressive method and FASTER than the '--seed' option." 1>&2 |
|---|
| 1250 | echo "# Usage is:" 1>&2 |
|---|
| 1251 | echo "# % mafft --add newSequences existingAlignment > output" 1>&2 |
|---|
| 1252 | echo "############################################################################" 1>&2 |
|---|
| 1253 | iterate=2 |
|---|
| 1254 | fi |
|---|
| 1255 | localparam="-l "$weighti |
|---|
| 1256 | elif [ $distance = "parttree" ]; then |
|---|
| 1257 | localparam=" " |
|---|
| 1258 | weighti="0.0" |
|---|
| 1259 | if [ $groupsize -gt -1 ]; then |
|---|
| 1260 | cycle=1 |
|---|
| 1261 | fi |
|---|
| 1262 | else |
|---|
| 1263 | localparam=" -l "$weighti |
|---|
| 1264 | if [ $cycle -gt 1 ]; then # 09/01/08 |
|---|
| 1265 | cycle=1 |
|---|
| 1266 | fi |
|---|
| 1267 | fi |
|---|
| 1268 | |
|---|
| 1269 | |
|---|
| 1270 | if [ $distance = "localgenaf" -o $distance = "globalgenaf" ]; then |
|---|
| 1271 | aof="0.000" |
|---|
| 1272 | fi |
|---|
| 1273 | |
|---|
| 1274 | |
|---|
| 1275 | # if [ $nseq -gt 5000 ]; then |
|---|
| 1276 | # fft=0 |
|---|
| 1277 | # fi |
|---|
| 1278 | if [ $forcefft -eq 1 ]; then |
|---|
| 1279 | param_fft=" -G " |
|---|
| 1280 | fft=1 |
|---|
| 1281 | elif [ $fft -eq 1 ]; then |
|---|
| 1282 | param_fft=" -F " |
|---|
| 1283 | else |
|---|
| 1284 | param_fft=" " |
|---|
| 1285 | fi |
|---|
| 1286 | |
|---|
| 1287 | if [ $seed != "x" -a $seedtable != "x" ]; then |
|---|
| 1288 | echo 'Use either one of seedtable and seed. Not both.' 1>&2 |
|---|
| 1289 | exit 1 |
|---|
| 1290 | fi |
|---|
| 1291 | # if [ $seedtable != "x" -a $anysymbol -gt 0 ]; then |
|---|
| 1292 | # echo 'The combination of --seedtable and --anysymbol is not supported.' 1>&2 |
|---|
| 1293 | # exit 1 |
|---|
| 1294 | # fi |
|---|
| 1295 | |
|---|
| 1296 | if [ $treein -eq 1 ]; then |
|---|
| 1297 | # if [ $iterate -gt 0 ]; then |
|---|
| 1298 | # echo 'Not supported yet.' 1>&2 |
|---|
| 1299 | # exit 1 |
|---|
| 1300 | # fi |
|---|
| 1301 | cycle=1 |
|---|
| 1302 | fi |
|---|
| 1303 | |
|---|
| 1304 | if [ $nadd -gt "0" ]; then |
|---|
| 1305 | if [ $fragment -eq 1 ]; then |
|---|
| 1306 | addarg="$addarg0 $nadd -g -0.01" |
|---|
| 1307 | else |
|---|
| 1308 | addarg="$addarg0 $nadd" |
|---|
| 1309 | fi |
|---|
| 1310 | cycle=1 |
|---|
| 1311 | iterate=0 |
|---|
| 1312 | # treealg=" -q " ## 2012/01/24 ## removed 2012/02/06 |
|---|
| 1313 | fi |
|---|
| 1314 | |
|---|
| 1315 | |
|---|
| 1316 | if [ $adjustdirection -gt 0 -a $seed != "x" ]; then |
|---|
| 1317 | echo '' 1>&2 |
|---|
| 1318 | echo 'The combination of --adjustdirection(accurately) and --seed is not supported.' 1>&2 |
|---|
| 1319 | echo '' 1>&2 |
|---|
| 1320 | exit 1 |
|---|
| 1321 | fi |
|---|
| 1322 | |
|---|
| 1323 | |
|---|
| 1324 | if [ $mccaskill -eq 1 -o $dafs -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then |
|---|
| 1325 | if [ $distance = "ktuples" ]; then |
|---|
| 1326 | echo 'Not supported.' 1>&2 |
|---|
| 1327 | echo 'Please add --globalpair, --localpair, --scarnapair, --dafspair' 1>&2 |
|---|
| 1328 | echo '--larapair, --slarapair, --foldalignlocalpair or --foldalignglobalpair' 1>&2 |
|---|
| 1329 | exit 1 |
|---|
| 1330 | fi |
|---|
| 1331 | fi |
|---|
| 1332 | |
|---|
| 1333 | |
|---|
| 1334 | # cycle ga atode henkou sareru node koko de strategy no namae wo kimeru. |
|---|
| 1335 | # kokokara |
|---|
| 1336 | if [ $mccaskill -eq 1 -o $dafs -eq 1 -o $rnaalifold -eq 1 -o $contrafold -eq 1 ]; then |
|---|
| 1337 | if [ $distance = "scarna" -o $distance = "dafs" -o $distance = "lara" -o $distance = "slara" -o $distance = "foldalignlocal" -o $distance = "foldalignglobal" ]; then |
|---|
| 1338 | strategy="X-" |
|---|
| 1339 | elif [ $distance = "global" -o $distance = "local" -o $distance = "localgenaf" -o "globalgenaf" ]; then |
|---|
| 1340 | strategy="Q-" |
|---|
| 1341 | fi |
|---|
| 1342 | elif [ $distance = "fasta" -a $sw -eq 0 ]; then |
|---|
| 1343 | strategy="F-" |
|---|
| 1344 | elif [ $distance = "fasta" -a $sw -eq 1 ]; then |
|---|
| 1345 | strategy="H-" |
|---|
| 1346 | elif [ $distance = "blast" ]; then |
|---|
| 1347 | strategy="B-" |
|---|
| 1348 | elif [ $distance = "global" -o $distance = "distonly" ]; then |
|---|
| 1349 | strategy="G-" |
|---|
| 1350 | elif [ $distance = "local" ]; then |
|---|
| 1351 | strategy="L-" |
|---|
| 1352 | elif [ $distance = "last" ]; then |
|---|
| 1353 | strategy="Last-" |
|---|
| 1354 | elif [ $distance = "hybrid" ]; then |
|---|
| 1355 | strategy="Hybrid-" |
|---|
| 1356 | elif [ $distance = "multi" ]; then |
|---|
| 1357 | strategy="Multi-" |
|---|
| 1358 | elif [ $distance = "lastmulti" ]; then |
|---|
| 1359 | strategy="LastMulti-" |
|---|
| 1360 | elif [ $distance = "localgenaf" ]; then |
|---|
| 1361 | strategy="E-" |
|---|
| 1362 | elif [ $distance = "globalgenaf" ]; then |
|---|
| 1363 | strategy="K-" |
|---|
| 1364 | elif [ $fft -eq 1 ]; then |
|---|
| 1365 | strategy="FFT-" |
|---|
| 1366 | else |
|---|
| 1367 | strategy="NW-" |
|---|
| 1368 | fi |
|---|
| 1369 | # if [ `echo "$weighti>0.0" | bc` -gt 0 ]; then |
|---|
| 1370 | if [ `awk "BEGIN {print($weighti>0.0)}"` -gt 0 ]; then |
|---|
| 1371 | strategy=$strategy"I" |
|---|
| 1372 | fi |
|---|
| 1373 | strategy=$strategy"NS-" |
|---|
| 1374 | if [ $iterate -gt 0 ]; then |
|---|
| 1375 | strategy=$strategy"i" |
|---|
| 1376 | elif [ $distance = "parttree" ]; then |
|---|
| 1377 | if [ $partdist = "fasta" ]; then |
|---|
| 1378 | strategy=$strategy"FastaPartTree-"$cycle |
|---|
| 1379 | elif [ $partdist = "localalign" ]; then |
|---|
| 1380 | strategy=$strategy"DPPartTree-"$cycle |
|---|
| 1381 | else |
|---|
| 1382 | strategy=$strategy"PartTree-"$cycle |
|---|
| 1383 | fi |
|---|
| 1384 | elif [ $fragment -eq 1 ]; then |
|---|
| 1385 | strategy=$strategy"fragment" |
|---|
| 1386 | elif [ $fragment -eq -1 ]; then |
|---|
| 1387 | strategy=$strategy"full" |
|---|
| 1388 | else |
|---|
| 1389 | strategy=$strategy$cycle |
|---|
| 1390 | fi |
|---|
| 1391 | |
|---|
| 1392 | explanation='?' |
|---|
| 1393 | performance='Not tested.' |
|---|
| 1394 | if [ $strategy = "F-INS-i" ]; then |
|---|
| 1395 | explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information' |
|---|
| 1396 | performance='Most accurate, but very slow' |
|---|
| 1397 | elif [ $strategy = "L-INS-i" ]; then |
|---|
| 1398 | explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment information' |
|---|
| 1399 | performance='Probably most accurate, very slow' |
|---|
| 1400 | elif [ $strategy = "E-INS-i" ]; then |
|---|
| 1401 | explanation='Iterative refinement method (<'$iterate') with LOCAL pairwise alignment with generalized affine gap costs (Altschul 1998)' |
|---|
| 1402 | performance='Suitable for sequences with long unalignable regions, very slow' |
|---|
| 1403 | elif [ $strategy = "G-INS-i" ]; then |
|---|
| 1404 | explanation='Iterative refinement method (<'$iterate') with GLOBAL pairwise alignment information' |
|---|
| 1405 | performance='Suitable for sequences of similar lengths, very slow' |
|---|
| 1406 | elif [ $strategy = "X-INS-i" ]; then |
|---|
| 1407 | explanation='RNA secondary structure information is taken into account.' |
|---|
| 1408 | performance='For short RNA sequences only, extremely slow' |
|---|
| 1409 | elif [ $strategy = "F-INS-1" ]; then |
|---|
| 1410 | explanation='Progressive method incorporating LOCAL pairwise alignment information' |
|---|
| 1411 | elif [ $strategy = "L-INS-1" ]; then |
|---|
| 1412 | explanation='Progressive method incorporating LOCAL pairwise alignment information' |
|---|
| 1413 | elif [ $strategy = "G-INS-1" ]; then |
|---|
| 1414 | explanation='Progressive method incorporating GLOBAL pairwise alignment information' |
|---|
| 1415 | elif [ $strategy = "FFT-NS-i" -o $strategy = "NW-NS-i" ]; then |
|---|
| 1416 | explanation='Iterative refinement method (max. '$iterate' iterations)' |
|---|
| 1417 | if [ $iterate -gt 2 ]; then |
|---|
| 1418 | performance='Accurate but slow' |
|---|
| 1419 | else |
|---|
| 1420 | performance='Standard' |
|---|
| 1421 | fi |
|---|
| 1422 | elif [ $strategy = "FFT-NS-2" -o $strategy = "NW-NS-2" ]; then |
|---|
| 1423 | explanation='Progressive method (guide trees were built '$cycle' times.)' |
|---|
| 1424 | performance='Fast but rough' |
|---|
| 1425 | elif [ $strategy = "FFT-NS-1" -o $strategy = "NW-NS-1" ]; then |
|---|
| 1426 | explanation='Progressive method (rough guide tree was used.)' |
|---|
| 1427 | performance='Very fast but very rough' |
|---|
| 1428 | fi |
|---|
| 1429 | |
|---|
| 1430 | if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then |
|---|
| 1431 | outputopt=" -c $strategy -r $TMPFILE/order " |
|---|
| 1432 | elif [ $outputformat = "clustal" -a $outorder = "input" ]; then |
|---|
| 1433 | outputopt=" -c $strategy " |
|---|
| 1434 | elif [ $outputformat = "phylip" -a $outorder = "aligned" ]; then |
|---|
| 1435 | outputopt=" -y -r $TMPFILE/order " |
|---|
| 1436 | elif [ $outputformat = "phylip" -a $outorder = "input" ]; then |
|---|
| 1437 | outputopt=" -y " |
|---|
| 1438 | elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then |
|---|
| 1439 | outputopt=" -f -r $TMPFILE/order " |
|---|
| 1440 | else |
|---|
| 1441 | outputopt="null" |
|---|
| 1442 | fi |
|---|
| 1443 | # kokomade |
|---|
| 1444 | |
|---|
| 1445 | |
|---|
| 1446 | |
|---|
| 1447 | ( |
|---|
| 1448 | cd $TMPFILE; |
|---|
| 1449 | |
|---|
| 1450 | cat /dev/null > pre |
|---|
| 1451 | |
|---|
| 1452 | echo "nseq = " $nseq 1>>"$progressfile" |
|---|
| 1453 | echo "distance = " $distance 1>>"$progressfile" |
|---|
| 1454 | echo "iterate = " $iterate 1>>"$progressfile" |
|---|
| 1455 | echo "cycle = " $cycle 1>>"$progressfile" |
|---|
| 1456 | |
|---|
| 1457 | if [ $anysymbol -eq 1 ]; then |
|---|
| 1458 | mv infile orig |
|---|
| 1459 | "$prefix/replaceu" -i orig > infile 2>>"$progressfile" || exit 1 |
|---|
| 1460 | fi |
|---|
| 1461 | |
|---|
| 1462 | if [ $adjustdirection -gt 0 ]; then |
|---|
| 1463 | if [ $fragment -ne 0 ]; then |
|---|
| 1464 | fragarg="-F" |
|---|
| 1465 | else |
|---|
| 1466 | fragarg=" " |
|---|
| 1467 | fi |
|---|
| 1468 | if [ $adjustdirection -eq 1 ]; then |
|---|
| 1469 | "$prefix/makedirectionlist" $fragarg -C $numthreads -m -I $nadd -i infile -t 0.01 > _direction |
|---|
| 1470 | elif [ $adjustdirection -eq 2 ]; then |
|---|
| 1471 | "$prefix/makedirectionlist" $fragarg -C $numthreads -m -I $nadd -i infile -t 0.01 -d > _direction |
|---|
| 1472 | fi |
|---|
| 1473 | "$prefix/setdirection" -d _direction -i infile > infiled |
|---|
| 1474 | mv infiled infile |
|---|
| 1475 | if [ $anysymbol -eq 1 ]; then |
|---|
| 1476 | "$prefix/setdirection" -d _direction -i orig > origd |
|---|
| 1477 | mv origd orig |
|---|
| 1478 | fi |
|---|
| 1479 | fi |
|---|
| 1480 | |
|---|
| 1481 | if [ $seed != "x" ]; then |
|---|
| 1482 | mv infile infile2 |
|---|
| 1483 | if [ $anysymbol -eq 1 ]; then |
|---|
| 1484 | mv orig orig2 |
|---|
| 1485 | cat /dev/null > orig |
|---|
| 1486 | fi |
|---|
| 1487 | cat /dev/null > infile |
|---|
| 1488 | cat /dev/null > hat3.seed |
|---|
| 1489 | seedoffset=0 |
|---|
| 1490 | # echo "seednseq="$seednseq |
|---|
| 1491 | # echo "seedoffset="$seedoffset |
|---|
| 1492 | set $seednseq >> "$progressfile" |
|---|
| 1493 | # echo $# |
|---|
| 1494 | while [ $# -gt 1 ] |
|---|
| 1495 | do |
|---|
| 1496 | shift |
|---|
| 1497 | # echo "num="$# |
|---|
| 1498 | |
|---|
| 1499 | if [ $anysymbol -eq 1 ]; then |
|---|
| 1500 | cat seed$# >> orig |
|---|
| 1501 | "$prefix/replaceu" -i seed$# -o $seedoffset > clean 2>>"$progressfile" || exit 1 |
|---|
| 1502 | mv clean seed$# |
|---|
| 1503 | fi |
|---|
| 1504 | "$prefix/multi2hat3s" -t $nseq -o $seedoffset -i seed$# >> infile 2>>"$progressfile" || exit 1 |
|---|
| 1505 | cat hat3 >> hat3.seed |
|---|
| 1506 | # echo "$1" |
|---|
| 1507 | seedoffset=`expr $seedoffset + $1` |
|---|
| 1508 | # echo "$1" |
|---|
| 1509 | # echo "seedoffset="$seedoffset |
|---|
| 1510 | done; |
|---|
| 1511 | # echo "seedoffset="$seedoffset |
|---|
| 1512 | if [ $anysymbol -eq 1 ]; then |
|---|
| 1513 | "$prefix/replaceu" -i orig2 -o $seedoffset >> infile 2>>"$progressfile" || exit 1 # yarinaoshi |
|---|
| 1514 | cat orig2 >> orig |
|---|
| 1515 | else |
|---|
| 1516 | cat infile2 >> infile |
|---|
| 1517 | fi |
|---|
| 1518 | elif [ $seedtable != "x" ]; then |
|---|
| 1519 | cat _seedtablefile > hat3.seed |
|---|
| 1520 | else |
|---|
| 1521 | cat /dev/null > hat3.seed |
|---|
| 1522 | fi |
|---|
| 1523 | # cat hat3.seed |
|---|
| 1524 | |
|---|
| 1525 | if [ $mergetable != "/dev/null" ]; then |
|---|
| 1526 | if [ $nadd -gt "0" ]; then |
|---|
| 1527 | echo "Impossible" 1>&2 |
|---|
| 1528 | exit 1 |
|---|
| 1529 | fi |
|---|
| 1530 | # if [ $seed != "x" -o $seedtable != "x" ]; then |
|---|
| 1531 | # echo "This version does not support the combination of merge and seed." 1>&2 |
|---|
| 1532 | # exit 1 |
|---|
| 1533 | # fi |
|---|
| 1534 | # iterate=0 # 2013/04/16 |
|---|
| 1535 | mergearg="-H $seedoffset" |
|---|
| 1536 | fi |
|---|
| 1537 | |
|---|
| 1538 | |
|---|
| 1539 | if [ $mccaskill -eq 1 ]; then |
|---|
| 1540 | "$prefix/mccaskillwrap" -s -C $numthreads -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1 |
|---|
| 1541 | elif [ $dafs -eq 1 ]; then |
|---|
| 1542 | "$prefix/mccaskillwrap" -G -C $numthreads -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1 |
|---|
| 1543 | elif [ $contrafold -eq 1 ]; then |
|---|
| 1544 | "$prefix/contrafoldwrap" -d "$prefix" -i infile > hat4 2>>"$progressfile" || exit 1 |
|---|
| 1545 | fi |
|---|
| 1546 | if [ $distance = "fasta" ]; then |
|---|
| 1547 | "$prefix/dndfast7" $swopt < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1548 | cat hat3.seed hat3 > hatx |
|---|
| 1549 | mv hatx hat3 |
|---|
| 1550 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1551 | elif [ $distance = "blast" ]; then |
|---|
| 1552 | "$prefix/dndblast" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1553 | cat hat3.seed hat3 > hatx |
|---|
| 1554 | mv hatx hat3 |
|---|
| 1555 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1556 | elif [ $distance = "foldalignlocal" ]; then |
|---|
| 1557 | "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $lexp -f $lgop -h $laof -H -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1558 | cat hat3.seed hat3 > hatx |
|---|
| 1559 | mv hatx hat3 |
|---|
| 1560 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1561 | elif [ $distance = "foldalignglobal" ]; then |
|---|
| 1562 | "$prefix/pairlocalalign" -C $numthreads $seqtype $foldalignopt $model -g $pgexp -f $pggop -h $pgaof -H -o -global -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1563 | cat hat3.seed hat3 > hatx |
|---|
| 1564 | mv hatx hat3 |
|---|
| 1565 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1566 | elif [ $distance = "slara" ]; then |
|---|
| 1567 | "$prefix/pairlocalalign" -C $numthreads -p $laraparams $seqtype $model -f $lgop -T -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1568 | cat hat3.seed hat3 > hatx |
|---|
| 1569 | mv hatx hat3 |
|---|
| 1570 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1571 | elif [ $distance = "lara" ]; then |
|---|
| 1572 | "$prefix/pairlocalalign" -C $numthreads -p $laraparams $seqtype $model -f $lgop -B -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1573 | cat hat3.seed hat3 > hatx |
|---|
| 1574 | mv hatx hat3 |
|---|
| 1575 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1576 | elif [ $distance = "scarna" ]; then |
|---|
| 1577 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -f $pggop -s -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1578 | cat hat3.seed hat3 > hatx |
|---|
| 1579 | mv hatx hat3 |
|---|
| 1580 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1581 | elif [ $distance = "dafs" ]; then |
|---|
| 1582 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -f $pggop -G -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1583 | cat hat3.seed hat3 > hatx |
|---|
| 1584 | mv hatx hat3 |
|---|
| 1585 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1586 | elif [ $distance = "global" ]; then |
|---|
| 1587 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -g $pgexp -f $pggop -h $pgaof -A < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1588 | cat hat3.seed hat3 > hatx |
|---|
| 1589 | mv hatx hat3 |
|---|
| 1590 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1591 | elif [ $distance = "local" ]; then |
|---|
| 1592 | if [ $fragment -ne 0 ]; then |
|---|
| 1593 | "$prefix/pairlocalalign" $localparam $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof -L < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1594 | cat hat3.seed hat3 > hatx |
|---|
| 1595 | mv hatx hat3 |
|---|
| 1596 | "$prefix/addsingle" -O $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>>"$progressfile" || exit 1 |
|---|
| 1597 | else |
|---|
| 1598 | "$prefix/pairlocalalign" $localparam -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof -L < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1599 | # addarg wo watasanai |
|---|
| 1600 | cat hat3.seed hat3 > hatx |
|---|
| 1601 | mv hatx hat3 |
|---|
| 1602 | "$prefix/tbfast" $mergearg -O $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>>"$progressfile" || exit 1 |
|---|
| 1603 | fi |
|---|
| 1604 | elif [ $distance = "globalgenaf" ]; then |
|---|
| 1605 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -g $pgexp -f $pggop -h $pgaof -O $GGOP -E $GEXP -K < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1606 | cat hat3.seed hat3 > hatx |
|---|
| 1607 | mv hatx hat3 |
|---|
| 1608 | "$prefix/tbfast" $mergearg $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>>"$progressfile" || exit 1 |
|---|
| 1609 | elif [ $distance = "localgenaf" ]; then |
|---|
| 1610 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof -O $LGOP -E $LEXP -N < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1611 | cat hat3.seed hat3 > hatx |
|---|
| 1612 | mv hatx hat3 |
|---|
| 1613 | "$prefix/tbfast" $mergearg -O $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>>"$progressfile" || exit 1 |
|---|
| 1614 | elif [ $distance = "last" ]; then |
|---|
| 1615 | if [ $fragment -ne 0 ]; then |
|---|
| 1616 | "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -h $laof -R $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1617 | cat hat3.seed hat3 > hatx |
|---|
| 1618 | mv hatx hat3 |
|---|
| 1619 | "$prefix/addsingle" -O $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>>"$progressfile" || exit 1 |
|---|
| 1620 | else |
|---|
| 1621 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -h $laof -R $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1622 | # addarg wo watasanai |
|---|
| 1623 | cat hat3.seed hat3 > hatx |
|---|
| 1624 | mv hatx hat3 |
|---|
| 1625 | "$prefix/tbfast" $mergearg -O $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>>"$progressfile" || exit 1 |
|---|
| 1626 | fi |
|---|
| 1627 | elif [ $distance = "lastmulti" ]; then |
|---|
| 1628 | "$prefix/dndpre" -M 2 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1629 | mv hat2 hat2i |
|---|
| 1630 | "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -e $last_e -w $last_m -g $lexp -f $lgop -h $laof -r $last_subopt $last_once -d "$prefix" < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1631 | cat hat3.seed hat3 > hatx |
|---|
| 1632 | mv hat2 hat2n |
|---|
| 1633 | mv hatx hat3 |
|---|
| 1634 | if [ $fragment -ne 0 ]; then |
|---|
| 1635 | "$prefix/addsingle" -d -O $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>>"$progressfile" || exit 1 |
|---|
| 1636 | else |
|---|
| 1637 | echo "Impossible" 1>&2 |
|---|
| 1638 | exit 1 |
|---|
| 1639 | fi |
|---|
| 1640 | elif [ $distance = "multi" ]; then |
|---|
| 1641 | "$prefix/dndpre" -M 2 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1642 | mv hat2 hat2i |
|---|
| 1643 | "$prefix/pairlocalalign" $localparam $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof -Y < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1644 | cat hat3.seed hat3 > hatx |
|---|
| 1645 | mv hat2 hat2n |
|---|
| 1646 | mv hatx hat3 |
|---|
| 1647 | if [ $fragment -ne 0 ]; then |
|---|
| 1648 | "$prefix/addsingle" -d -O $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>>"$progressfile" || exit 1 |
|---|
| 1649 | else |
|---|
| 1650 | echo "Impossible" 1>&2 |
|---|
| 1651 | exit 1 |
|---|
| 1652 | fi |
|---|
| 1653 | elif [ $distance = "hybrid" ]; then |
|---|
| 1654 | "$prefix/pairlocalalign" $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof -Y < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1655 | cat hat3.seed hat3 > hatx |
|---|
| 1656 | mv hatx hat3 |
|---|
| 1657 | "$prefix/disttbfast" -W $tuplesize -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt -T -y $seqtype $model -f "-"$gop -h "-"$aof $param_fft $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1658 | if [ $fragment -ne 0 ]; then |
|---|
| 1659 | "$prefix/addsingle" -O $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>>"$progressfile" || exit 1 |
|---|
| 1660 | else |
|---|
| 1661 | "$prefix/tbfast" $mergearg -O $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>>"$progressfile" || exit 1 |
|---|
| 1662 | fi |
|---|
| 1663 | elif [ $distance = "distonly" ]; then |
|---|
| 1664 | "$prefix/pairlocalalign" -C $numthreads $seqtype $model -g $pgexp -f $pggop -h $pgaof -t < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1665 | "$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>>"$progressfile" || exit 1 |
|---|
| 1666 | elif [ $distance = "parttree" ]; then |
|---|
| 1667 | "$prefix/splittbfast" $algopt $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop -h "-"$aof $param_fft -p $partsize -s $groupsize $treealg -i infile > pre 2>>"$progressfile" || exit 1 |
|---|
| 1668 | mv hat3.seed hat3 |
|---|
| 1669 | elif [ $distance = "ktuplesmulti" ]; then |
|---|
| 1670 | # "$prefix/dndpre" -M 1 $addarg -C $numthreads $seqtype $model -g $lexp -f $lgop -h $laof < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1671 | # mv hat2 hat2i |
|---|
| 1672 | # "$prefix/disttbfast" -W $tuplesize -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt -T -y $seqtype $model -f "-"$gop -h "-"$aof $param_fft $algopt $treealg $scoreoutarg < infile > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1673 | # mv hat2 hat2n |
|---|
| 1674 | if [ $fragment -ne 0 ]; then |
|---|
| 1675 | "$prefix/addsingle" -d -W $tuplesize -O $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>>"$progressfile" || exit 1 |
|---|
| 1676 | # "$prefix/addsingle" -d -O $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>>"$progressfile" || exit 1 |
|---|
| 1677 | else |
|---|
| 1678 | echo "Impossible" 1>&2 |
|---|
| 1679 | exit 1 |
|---|
| 1680 | fi |
|---|
| 1681 | else |
|---|
| 1682 | if [ $fragment -ne 0 ]; then |
|---|
| 1683 | "$prefix/addsingle" -W $tuplesize -O $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>>"$progressfile" || exit 1 |
|---|
| 1684 | else |
|---|
| 1685 | "$prefix/disttbfast" $mergearg -W $tuplesize -O $outnum $addarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop -h "-"$aof $param_fft $algopt $treealg $scoreoutarg < infile > pre 2>>"$progressfile" || exit 1 |
|---|
| 1686 | mv hat3.seed hat3 |
|---|
| 1687 | fi |
|---|
| 1688 | fi |
|---|
| 1689 | while [ $cycle -gt 1 ] |
|---|
| 1690 | do |
|---|
| 1691 | if [ $distance = "parttree" ]; then |
|---|
| 1692 | mv pre infile |
|---|
| 1693 | "$prefix/splittbfast" -Z $algopt $splitopt $partorderopt $parttreeoutopt $memopt $seqtype $model -f "-"$gop -h "-"$aof $param_fft -p $partsize -s $groupsize $treealg -i infile > pre 2>>"$progressfile" || exit 1 |
|---|
| 1694 | else |
|---|
| 1695 | "$prefix/tbfast" $mergearg -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>>"$progressfile" || exit 1 |
|---|
| 1696 | fi |
|---|
| 1697 | cycle=`expr $cycle - 1` |
|---|
| 1698 | done |
|---|
| 1699 | if [ $iterate -gt 0 ]; then |
|---|
| 1700 | if [ $distance = "ktuples" ]; then |
|---|
| 1701 | "$prefix/dndpre" -C $numthreads < pre > /dev/null 2>>"$progressfile" || exit 1 |
|---|
| 1702 | fi |
|---|
| 1703 | "$prefix/dvtditr" $mergearg -C $numthreadsit -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>>"$progressfile" || exit 1 |
|---|
| 1704 | fi |
|---|
| 1705 | if [ $coreout -eq 1 ]; then |
|---|
| 1706 | "$prefix/setcore" -w $corewin -i $corethr $coreext < pre > pre2 |
|---|
| 1707 | mv pre2 pre |
|---|
| 1708 | elif [ $anysymbol -eq 1 ]; then |
|---|
| 1709 | "$prefix/restoreu" -a pre -i orig > restored || exit 1 |
|---|
| 1710 | mv restored pre |
|---|
| 1711 | fi |
|---|
| 1712 | |
|---|
| 1713 | |
|---|
| 1714 | |
|---|
| 1715 | |
|---|
| 1716 | echo '' 1>>"$progressfile" |
|---|
| 1717 | if [ $mccaskill -eq 1 ]; then |
|---|
| 1718 | echo "RNA base pairing probaility was calculated by the McCaskill algorithm (1)" 1>>"$progressfile" |
|---|
| 1719 | echo "implemented in Vienna RNA package (2) and MXSCARNA (3), and then" 1>>"$progressfile" |
|---|
| 1720 | echo "incorporated in the iterative alignment process (4)." 1>>"$progressfile" |
|---|
| 1721 | echo "(1) McCaskill, 1990, Biopolymers 29:1105-1119" 1>>"$progressfile" |
|---|
| 1722 | echo "(2) Hofacker et al., 2002, J. Mol. Biol. 319:3724-3732" 1>>"$progressfile" |
|---|
| 1723 | echo "(3) Tabei et al., 2008, BMC Bioinformatics 9:33" 1>>"$progressfile" |
|---|
| 1724 | echo "(4) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>>"$progressfile" |
|---|
| 1725 | echo "" 1>>"$progressfile" |
|---|
| 1726 | elif [ $contrafold -eq 1 ]; then |
|---|
| 1727 | echo "RNA base pairing probaility was calculated by the CONTRAfold algorithm (1)" 1>>"$progressfile" |
|---|
| 1728 | echo "and then incorporated in the iterative alignment process (4)." 1>>"$progressfile" |
|---|
| 1729 | echo "(1) Do et al., 2006, Bioinformatics 22:e90-98" 1>>"$progressfile" |
|---|
| 1730 | echo "(2) Katoh and Toh, 2008, BMC Bioinformatics 9:212" 1>>"$progressfile" |
|---|
| 1731 | echo "" 1>>"$progressfile" |
|---|
| 1732 | fi |
|---|
| 1733 | if [ $distance = "fasta" -o $partdist = "fasta" ]; then |
|---|
| 1734 | echo "Pairwise alignments were computed by FASTA" 1>>"$progressfile" |
|---|
| 1735 | echo "(Pearson & Lipman, 1988, PNAS 85:2444-2448)" 1>>"$progressfile" |
|---|
| 1736 | fi |
|---|
| 1737 | if [ $distance = "blast" ]; then |
|---|
| 1738 | echo "Pairwise alignments were computed by BLAST" 1>>"$progressfile" |
|---|
| 1739 | echo "(Altschul et al., 1997, NAR 25:3389-3402)" 1>>"$progressfile" |
|---|
| 1740 | fi |
|---|
| 1741 | if [ $distance = "last" -o $distance = "lastmulti" ]; then |
|---|
| 1742 | echo "Pairwise alignments were computed by LAST" 1>>"$progressfile" |
|---|
| 1743 | echo "http://last.cbrc.jp/" 1>>"$progressfile" |
|---|
| 1744 | echo "Kielbasa, Wan, Sato, Horton, Frith 2011 Genome Res. 21:487" 1>>"$progressfile" |
|---|
| 1745 | fi |
|---|
| 1746 | if [ $distance = "scarna" ]; then |
|---|
| 1747 | echo "Pairwise alignments were computed by MXSCARNA" 1>>"$progressfile" |
|---|
| 1748 | echo "(Tabei et al., 2008, BMC Bioinformatics 9:33)." 1>>"$progressfile" |
|---|
| 1749 | fi |
|---|
| 1750 | if [ $distance = "dafs" ]; then |
|---|
| 1751 | echo "Pairwise alignments were computed by DAFS" 1>>"$progressfile" |
|---|
| 1752 | echo "(Sato et al., 2012,,,,)." 1>>"$progressfile" |
|---|
| 1753 | fi |
|---|
| 1754 | if [ $distance = "lara" -o $distance = "slara" ]; then |
|---|
| 1755 | echo "Pairwise alignments were computed by LaRA" 1>>"$progressfile" |
|---|
| 1756 | echo "(Bauer et al., 2007, BMC Bioinformatics 8:271)." 1>>"$progressfile" |
|---|
| 1757 | fi |
|---|
| 1758 | if [ $distance = "foldalignlocal" ]; then |
|---|
| 1759 | echo "Pairwise alignments were computed by FOLDALIGN (local)" 1>>"$progressfile" |
|---|
| 1760 | echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>>"$progressfile" |
|---|
| 1761 | fi |
|---|
| 1762 | if [ $distance = "foldalignglobal" ]; then |
|---|
| 1763 | echo "Pairwise alignments were computed by FOLDALIGN (global)" 1>>"$progressfile" |
|---|
| 1764 | echo "(Havgaard et al., 2007, PLoS Computational Biology 3:e193)." 1>>"$progressfile" |
|---|
| 1765 | fi |
|---|
| 1766 | printf "\n" 1>>"$progressfile" |
|---|
| 1767 | echo 'Strategy:' 1>>"$progressfile" |
|---|
| 1768 | printf ' '$strategy 1>>"$progressfile" |
|---|
| 1769 | echo ' ('$performance')' 1>>"$progressfile" |
|---|
| 1770 | echo ' '$explanation 1>>"$progressfile" |
|---|
| 1771 | echo '' 1>>"$progressfile" |
|---|
| 1772 | echo "If unsure which option to use, try 'mafft --auto input > output'." 1>>"$progressfile" |
|---|
| 1773 | # echo "If long gaps are expected, try 'mafft --ep 0.0 --auto input > output'." 1>>"$progressfile" |
|---|
| 1774 | # echo "If the possibility of long gaps can be excluded, add '--ep 0.123'." 1>>"$progressfile" |
|---|
| 1775 | echo "For more information, see 'mafft --help', 'mafft --man' and the mafft page." 1>>"$progressfile" |
|---|
| 1776 | echo '' 1>>"$progressfile" |
|---|
| 1777 | |
|---|
| 1778 | ) |
|---|
| 1779 | |
|---|
| 1780 | |
|---|
| 1781 | if [ "$outputfile" = "" ]; then |
|---|
| 1782 | if [ "$outputopt" = "null" ]; then |
|---|
| 1783 | cat < $TMPFILE/pre || exit 1 |
|---|
| 1784 | else |
|---|
| 1785 | "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre 2>>/dev/null || exit 1 |
|---|
| 1786 | fi |
|---|
| 1787 | else |
|---|
| 1788 | if [ "$outputopt" = "null" ]; then |
|---|
| 1789 | cat < $TMPFILE/pre > "$outputfile" || exit 1 |
|---|
| 1790 | else |
|---|
| 1791 | "$prefix/f2cl" -n $namelength $outputopt < $TMPFILE/pre > "$outputfile" 2>>/dev/null || exit 1 |
|---|
| 1792 | fi |
|---|
| 1793 | fi |
|---|
| 1794 | |
|---|
| 1795 | if [ $treeout -eq 1 ]; then |
|---|
| 1796 | cp $TMPFILE/infile.tree "$infilename.tree" |
|---|
| 1797 | fi |
|---|
| 1798 | |
|---|
| 1799 | if [ -s $TMPFILE/GuideTree ]; then # --merge no toki dake |
|---|
| 1800 | cp $TMPFILE/GuideTree . |
|---|
| 1801 | fi |
|---|
| 1802 | |
|---|
| 1803 | if [ $distout -eq 1 ]; then |
|---|
| 1804 | cp $TMPFILE/hat2 "$infilename.hat2" |
|---|
| 1805 | fi |
|---|
| 1806 | |
|---|
| 1807 | exit 0; |
|---|
| 1808 | fi |
|---|
| 1809 | |
|---|
| 1810 | prog="awk" |
|---|
| 1811 | |
|---|
| 1812 | tmpawk=`which nawk 2>/dev/null | awk '{print $1}'` |
|---|
| 1813 | if [ -x "$tmpawk" ]; then |
|---|
| 1814 | prog="$tmpawk" |
|---|
| 1815 | fi |
|---|
| 1816 | |
|---|
| 1817 | tmpawk=`which gawk 2>/dev/null | awk '{print $1}'` |
|---|
| 1818 | if [ -x "$tmpawk" ]; then |
|---|
| 1819 | prog="$tmpawk" |
|---|
| 1820 | fi |
|---|
| 1821 | |
|---|
| 1822 | #echo "prog="$prog 1>&2 |
|---|
| 1823 | |
|---|
| 1824 | umask 077 |
|---|
| 1825 | ( |
|---|
| 1826 | $prog ' |
|---|
| 1827 | BEGIN { |
|---|
| 1828 | prefix = ENVIRON["prefix"]; |
|---|
| 1829 | version = ENVIRON["version"]; |
|---|
| 1830 | myself = ENVIRON["myself"]; |
|---|
| 1831 | while( 1 ) |
|---|
| 1832 | { |
|---|
| 1833 | options = "" |
|---|
| 1834 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1835 | printf( "---------------------------------------------------------------------\n" ) > "/dev/tty"; |
|---|
| 1836 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1837 | printf( " MAFFT %s\n", version ) > "/dev/tty"; |
|---|
| 1838 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1839 | printf( " Copyright (c) 2013 Kazutaka Katoh\n" ) > "/dev/tty"; |
|---|
| 1840 | printf( " MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)\n" ) > "/dev/tty"; |
|---|
| 1841 | printf( " http://mafft.cbrc.jp/alignment/software/\n" ) > "/dev/tty"; |
|---|
| 1842 | printf( "---------------------------------------------------------------------\n" ) > "/dev/tty"; |
|---|
| 1843 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1844 | |
|---|
| 1845 | while( 1 ) |
|---|
| 1846 | { |
|---|
| 1847 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1848 | printf( "Input file? (fasta format)\n@ " ) > "/dev/tty"; |
|---|
| 1849 | res = getline < "/dev/tty"; |
|---|
| 1850 | close( "/dev/tty" ) |
|---|
| 1851 | if( res == 0 || NF == 0 ) |
|---|
| 1852 | continue; |
|---|
| 1853 | infile = sprintf( "%s", $0 ); |
|---|
| 1854 | |
|---|
| 1855 | res = getline < infile; |
|---|
| 1856 | close( infile ); |
|---|
| 1857 | if( res == -1 ) |
|---|
| 1858 | { |
|---|
| 1859 | printf( "%s: No such file.\n\n", infile ) > "/dev/tty"; |
|---|
| 1860 | printf( "Filename extension (eg., .txt) must be typed, if any.\n\n" ) > "/dev/tty"; |
|---|
| 1861 | } |
|---|
| 1862 | else if( res == 0 ) |
|---|
| 1863 | printf( "%s: Empty.\n", infile ) > "/dev/tty"; |
|---|
| 1864 | else |
|---|
| 1865 | { |
|---|
| 1866 | printf( "OK. infile = %s\n\n", infile ) > "/dev/tty"; |
|---|
| 1867 | break; |
|---|
| 1868 | } |
|---|
| 1869 | } |
|---|
| 1870 | nseq = 0; |
|---|
| 1871 | |
|---|
| 1872 | while( 1 ) |
|---|
| 1873 | { |
|---|
| 1874 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1875 | printf( "Output file?\n" ) > "/dev/tty"; |
|---|
| 1876 | printf( "@ " ) > "/dev/tty"; |
|---|
| 1877 | res = getline < "/dev/tty"; |
|---|
| 1878 | close( "/dev/tty" ); |
|---|
| 1879 | if( res == 0 || NF == 0 ) |
|---|
| 1880 | continue; |
|---|
| 1881 | else |
|---|
| 1882 | { |
|---|
| 1883 | outfile = sprintf( "%s", $0 ); |
|---|
| 1884 | printf( "OK. outfile = %s\n\n", outfile ) > "/dev/tty"; |
|---|
| 1885 | break; |
|---|
| 1886 | } |
|---|
| 1887 | } |
|---|
| 1888 | |
|---|
| 1889 | while( 1 ) |
|---|
| 1890 | { |
|---|
| 1891 | outargs = ""; |
|---|
| 1892 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1893 | printf( "Output format?\n" ) > "/dev/tty"; |
|---|
| 1894 | printf( " 1. Clustal format / Sorted\n" ) > "/dev/tty"; |
|---|
| 1895 | printf( " 2. Clustal format / Input order\n" ) > "/dev/tty"; |
|---|
| 1896 | printf( " 3. Fasta format / Sorted\n" ) > "/dev/tty"; |
|---|
| 1897 | printf( " 4. Fasta format / Input order\n" ) > "/dev/tty"; |
|---|
| 1898 | printf( " 5. Phylip format / Sorted\n" ) > "/dev/tty"; |
|---|
| 1899 | printf( " 6. Phylip format / Input order\n" ) > "/dev/tty"; |
|---|
| 1900 | printf( "@ " ) > "/dev/tty"; |
|---|
| 1901 | res = getline < "/dev/tty"; |
|---|
| 1902 | close( "/dev/tty" ); |
|---|
| 1903 | # printf( "res=%d, NF=%d\n", res, NF ); |
|---|
| 1904 | |
|---|
| 1905 | resnum = 0 + $1; |
|---|
| 1906 | # printf( "resnum=%d\n", resnum ); |
|---|
| 1907 | |
|---|
| 1908 | if( resnum < 1 || 6 < resnum ) |
|---|
| 1909 | continue; |
|---|
| 1910 | else |
|---|
| 1911 | { |
|---|
| 1912 | if( resnum == 1 ) |
|---|
| 1913 | outargs = "--clustalout --reorder"; |
|---|
| 1914 | else if( resnum == 2 ) |
|---|
| 1915 | outargs = "--clustalout --inputorder"; |
|---|
| 1916 | else if( resnum == 3 ) |
|---|
| 1917 | outargs = "--reorder"; |
|---|
| 1918 | else if( resnum == 4 ) |
|---|
| 1919 | outargs = "--inputorder"; |
|---|
| 1920 | else if( resnum == 5 ) |
|---|
| 1921 | outargs = "--phylipout --reorder"; |
|---|
| 1922 | else if( resnum == 6 ) |
|---|
| 1923 | outargs = "--phylipout --inputorder"; |
|---|
| 1924 | else |
|---|
| 1925 | continue; |
|---|
| 1926 | printf( "OK. arguments = %s\n\n", outargs ) > "/dev/tty"; |
|---|
| 1927 | break; |
|---|
| 1928 | } |
|---|
| 1929 | } |
|---|
| 1930 | |
|---|
| 1931 | while( 1 ) |
|---|
| 1932 | { |
|---|
| 1933 | arguments = ""; |
|---|
| 1934 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1935 | printf( "Strategy?\n" ) > "/dev/tty"; |
|---|
| 1936 | printf( " 1. --auto\n" ) > "/dev/tty"; |
|---|
| 1937 | printf( " 2. FFT-NS-1 (fast)\n" ) > "/dev/tty"; |
|---|
| 1938 | printf( " 3. FFT-NS-2 (default)\n" ) > "/dev/tty"; |
|---|
| 1939 | printf( " 4. G-INS-i (accurate)\n" ) > "/dev/tty"; |
|---|
| 1940 | printf( " 5. L-INS-i (accurate)\n" ) > "/dev/tty"; |
|---|
| 1941 | printf( " 6. E-INS-i (accurate)\n" ) > "/dev/tty"; |
|---|
| 1942 | printf( "@ " ) > "/dev/tty"; |
|---|
| 1943 | res = getline < "/dev/tty"; |
|---|
| 1944 | close( "/dev/tty" ); |
|---|
| 1945 | # printf( "res=%d, NF=%d\n", res, NF ); |
|---|
| 1946 | |
|---|
| 1947 | resnum = 0 + $1; |
|---|
| 1948 | # printf( "resnum=%d\n", resnum ); |
|---|
| 1949 | |
|---|
| 1950 | if( resnum < 1 || 6 < resnum ) |
|---|
| 1951 | continue; |
|---|
| 1952 | else |
|---|
| 1953 | { |
|---|
| 1954 | if( resnum == 1 ) |
|---|
| 1955 | arguments = "--auto"; |
|---|
| 1956 | else if( resnum == 2 ) |
|---|
| 1957 | arguments = "--retree 1"; |
|---|
| 1958 | else if( resnum == 3 ) |
|---|
| 1959 | arguments = "--retree 2"; |
|---|
| 1960 | else if( resnum == 4 ) |
|---|
| 1961 | arguments = "--globalpair --maxiterate 16"; |
|---|
| 1962 | else if( resnum == 5 ) |
|---|
| 1963 | arguments = "--localpair --maxiterate 16"; |
|---|
| 1964 | else if( resnum == 6 ) |
|---|
| 1965 | arguments = "--genafpair --maxiterate 16"; |
|---|
| 1966 | else |
|---|
| 1967 | arguments = sprintf( "%s", $0 ); |
|---|
| 1968 | printf( "OK. arguments = %s %s\n\n", arguments, outargs ) > "/dev/tty"; |
|---|
| 1969 | break; |
|---|
| 1970 | } |
|---|
| 1971 | } |
|---|
| 1972 | |
|---|
| 1973 | |
|---|
| 1974 | while( 1 ) |
|---|
| 1975 | { |
|---|
| 1976 | printf( "\n" ) > "/dev/tty"; |
|---|
| 1977 | printf( "Additional arguments? (--ep #, --op #, --kappa #, etc)\n" ) > "/dev/tty"; |
|---|
| 1978 | printf( "@ " ) > "/dev/tty"; |
|---|
| 1979 | res = getline < "/dev/tty"; |
|---|
| 1980 | close( "/dev/tty" ); |
|---|
| 1981 | if( res == 0 || NF == 0 ) |
|---|
| 1982 | { |
|---|
| 1983 | break; |
|---|
| 1984 | } |
|---|
| 1985 | else |
|---|
| 1986 | { |
|---|
| 1987 | addargs = sprintf( "%s", $0 ); |
|---|
| 1988 | printf( "OK. arguments = %s %s %s\n\n", addargs, arguments, outargs ) > "/dev/tty"; |
|---|
| 1989 | break; |
|---|
| 1990 | } |
|---|
| 1991 | } |
|---|
| 1992 | |
|---|
| 1993 | arguments = sprintf( "%s %s %s", addargs, arguments, outargs ); |
|---|
| 1994 | |
|---|
| 1995 | print "" |
|---|
| 1996 | command = sprintf( "\"%s\" %s \"%s\" > \"%s\"", myself, arguments, infile, outfile ); |
|---|
| 1997 | gsub( /\\/, "/", command ); |
|---|
| 1998 | |
|---|
| 1999 | |
|---|
| 2000 | printf( "command=\n%s\n", command ) > "/dev/tty"; |
|---|
| 2001 | |
|---|
| 2002 | |
|---|
| 2003 | while( 1 ) |
|---|
| 2004 | { |
|---|
| 2005 | go = 0; |
|---|
| 2006 | printf( "OK?\n" ) > "/dev/tty"; |
|---|
| 2007 | printf( "@ [Y] " ) > "/dev/tty"; |
|---|
| 2008 | res = getline < "/dev/tty"; |
|---|
| 2009 | close( "/dev/tty" ); |
|---|
| 2010 | if( res == 0 ) |
|---|
| 2011 | continue; |
|---|
| 2012 | else if( NF == 0 || $0 ~ /^[Yy]/ ) |
|---|
| 2013 | { |
|---|
| 2014 | go=1; |
|---|
| 2015 | break; |
|---|
| 2016 | } |
|---|
| 2017 | else |
|---|
| 2018 | break; |
|---|
| 2019 | } |
|---|
| 2020 | if( go ) break; |
|---|
| 2021 | printf( "\n" ) > "/dev/tty"; |
|---|
| 2022 | printf( "\n" ) > "/dev/tty"; |
|---|
| 2023 | } |
|---|
| 2024 | system( command ); |
|---|
| 2025 | command = sprintf( "less \"%s\"", outfile ); |
|---|
| 2026 | system( command ); |
|---|
| 2027 | printf( "Press Enter to exit." ) > "/dev/tty"; |
|---|
| 2028 | res = getline < "/dev/tty"; |
|---|
| 2029 | } |
|---|
| 2030 | ' |
|---|
| 2031 | ) |
|---|
| 2032 | exit 0; |
|---|