| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified August 18, 2016 |
| 7 | |
| 8 | Description: Generates multiple assemblies with Tadpole |
| 9 | to estimate the optimal kmer length. |
| 10 | |
| 11 | Usage: |
| 12 | tadwrapper.sh in=reads.fq out=contigs%.fa k=31,62,93 |
| 13 | |
| 14 | Parameters: |
| 15 | out=<file> Output file name. Must contain a % symbol. |
| 16 | outfinal=<file> Optional. If set, the best assembly file |
| 17 | will be renamed to this. |
| 18 | k=31 Comma-delimited list of kmer lengths. |
| 19 | delete=f Delete assemblies before terminating. |
| 20 | quitearly=f Quit once metrics stop improving with longer kmers. |
| 21 | bisect=f Recursively assemble with the kmer midway between |
| 22 | the two best kmers until improvement halts. |
| 23 | expand=f Recursively assemble with kmers shorter or longer |
| 24 | than the current best until improvement halts. |
| 25 | |
| 26 | All other parameters are passed to Tadpole. |
| 27 | " |
| 28 | } |
| 29 | |
| 30 | #This block allows symlinked shellscripts to correctly set classpath. |
| 31 | pushd . > /dev/null |
| 32 | DIR="${BASH_SOURCE[0]}" |
| 33 | while [ -h "$DIR" ]; do |
| 34 | cd "$(dirname "$DIR")" |
| 35 | DIR="$(readlink "$(basename "$DIR")")" |
| 36 | done |
| 37 | cd "$(dirname "$DIR")" |
| 38 | DIR="$(pwd)/" |
| 39 | popd > /dev/null |
| 40 | |
| 41 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 42 | CP="$DIR""current/" |
| 43 | |
| 44 | z="-Xmx14g" |
| 45 | z2="-Xms14g" |
| 46 | set=0 |
| 47 | |
| 48 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 49 | usage |
| 50 | exit |
| 51 | fi |
| 52 | |
| 53 | calcXmx () { |
| 54 | source "$DIR""/calcmem.sh" |
| 55 | setEnvironment |
| 56 | parseXmx "$@" |
| 57 | if [[ $set == 1 ]]; then |
| 58 | return |
| 59 | fi |
| 60 | freeRam 15000m 84 |
| 61 | z="-Xmx${RAM}m" |
| 62 | z2="-Xms${RAM}m" |
| 63 | } |
| 64 | calcXmx "$@" |
| 65 | |
| 66 | tadwrapper() { |
| 67 | local CMD="java $EA $EOOM $z $z2 -cp $CP assemble.TadpoleWrapper $@" |
| 68 | echo $CMD >&2 |
| 69 | eval $CMD |
| 70 | } |
| 71 | |
| 72 | tadwrapper "$@" |