| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified September 18, 2019 |
| 7 | |
| 8 | Description: Runs TadpoleWrapper after some preprocessing, |
| 9 | to allow optimal assemblies using long kmers. |
| 10 | Only paired reads are supported. |
| 11 | |
| 12 | Usage: |
| 13 | tadpipe.sh in=reads.fq out=contigs.fa |
| 14 | |
| 15 | |
| 16 | Parameters: |
| 17 | in=<file> Input reads. |
| 18 | in2=<file> Optional read 2, if reads are in two files. |
| 19 | out=contigs.fa Output file name. |
| 20 | temp=$TMPDIR Path to a directory for temp files. |
| 21 | delete=t Delete intermediate files. |
| 22 | gz=f Gzip intermediate files. |
| 23 | |
| 24 | Other parameters can be passed to individual phases like this: |
| 25 | |
| 26 | assemble_k=200,250 Set kmer lengths for assembly phase. |
| 27 | merge_strict Set the strict flag in merge phase. |
| 28 | extend_el=120 Set the left-extension distance in the extension phase. |
| 29 | |
| 30 | Valid prefixes: |
| 31 | |
| 32 | filter_ PhiX and contaminant filtering. |
| 33 | trim_ Adapter trimmming. |
| 34 | merge_ Paired-read merging. |
| 35 | correct_ Error correction. |
| 36 | extend_ Read extension. |
| 37 | assemble_ Final assembly. |
| 38 | " |
| 39 | } |
| 40 | |
| 41 | #This block allows symlinked shellscripts to correctly set classpath. |
| 42 | pushd . > /dev/null |
| 43 | DIR="${BASH_SOURCE[0]}" |
| 44 | while [ -h "$DIR" ]; do |
| 45 | cd "$(dirname "$DIR")" |
| 46 | DIR="$(readlink "$(basename "$DIR")")" |
| 47 | done |
| 48 | cd "$(dirname "$DIR")" |
| 49 | DIR="$(pwd)/" |
| 50 | popd > /dev/null |
| 51 | |
| 52 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 53 | CP="$DIR""current/" |
| 54 | |
| 55 | z="-Xmx14g" |
| 56 | z2="-Xms14g" |
| 57 | set=0 |
| 58 | |
| 59 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 60 | usage |
| 61 | exit |
| 62 | fi |
| 63 | |
| 64 | calcXmx () { |
| 65 | source "$DIR""/calcmem.sh" |
| 66 | setEnvironment |
| 67 | parseXmx "$@" |
| 68 | if [[ $set == 1 ]]; then |
| 69 | return |
| 70 | fi |
| 71 | freeRam 15000m 84 |
| 72 | z="-Xmx${RAM}m" |
| 73 | z2="-Xms${RAM}m" |
| 74 | } |
| 75 | calcXmx "$@" |
| 76 | |
| 77 | tadpipe() { |
| 78 | local CMD="java $EA $EOOM $z $z2 -cp $CP assemble.TadPipe $@" |
| 79 | echo $CMD >&2 |
| 80 | eval $CMD |
| 81 | } |
| 82 | |
| 83 | tadpipe "$@" |