| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Description: Generates a histogram of kmer counts for the input reads or assemblies. |
| 6 | |
| 7 | Usage: khist.sh in=<input> hist=<histogram output> |
| 8 | |
| 9 | Please see bbnorm.sh for more information. |
| 10 | All the flags are the same, only the parameters (near the bottom of this file) differ. |
| 11 | " |
| 12 | } |
| 13 | |
| 14 | #This block allows symlinked shellscripts to correctly set classpath. |
| 15 | pushd . > /dev/null |
| 16 | DIR="${BASH_SOURCE[0]}" |
| 17 | while [ -h "$DIR" ]; do |
| 18 | cd "$(dirname "$DIR")" |
| 19 | DIR="$(readlink "$(basename "$DIR")")" |
| 20 | done |
| 21 | cd "$(dirname "$DIR")" |
| 22 | DIR="$(pwd)/" |
| 23 | popd > /dev/null |
| 24 | |
| 25 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 26 | CP="$DIR""current/" |
| 27 | |
| 28 | z="-Xmx31g" |
| 29 | z2="-Xms31g" |
| 30 | set=0 |
| 31 | |
| 32 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 33 | usage |
| 34 | exit |
| 35 | fi |
| 36 | |
| 37 | calcXmx () { |
| 38 | source "$DIR""/calcmem.sh" |
| 39 | setEnvironment |
| 40 | parseXmx "$@" |
| 41 | if [[ $set == 1 ]]; then |
| 42 | return |
| 43 | fi |
| 44 | freeRam 31000m 84 |
| 45 | z="-Xmx${RAM}m" |
| 46 | z2="-Xms${RAM}m" |
| 47 | } |
| 48 | calcXmx "$@" |
| 49 | |
| 50 | khist() { |
| 51 | local CMD="java $EA $EOOM $z $z2 -cp $CP jgi.KmerNormalize bits=32 ecc=f passes=1 keepall dr=f prefilter hist=stdout minprob=0 minqual=0 mindepth=0 minkmers=1 hashes=3 $@" |
| 52 | echo $CMD >&2 |
| 53 | eval $CMD |
| 54 | } |
| 55 | |
| 56 | khist "$@" |