| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified January 25, 2018 |
| 7 | |
| 8 | Description: Summarizes the output of BBSketch. |
| 9 | |
| 10 | Usage: summarizesketch.sh in=<file,file...> out=<file> |
| 11 | |
| 12 | You can alternately run 'summarizesketch.sh *.txt out=out.txt' |
| 13 | |
| 14 | Parameters: |
| 15 | in=<file> A list of stats files, or a text file containing one stats file name per line. |
| 16 | out=<file> Destination for summary. |
| 17 | tree= A TaxTree file. |
| 18 | level=genus Ignore contaminants with the same taxonomy as the primary hit at this level. |
| 19 | unique=f Use the contaminant with the most unique hits rather than highest score. |
| 20 | |
| 21 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 22 | " |
| 23 | } |
| 24 | |
| 25 | #This block allows symlinked shellscripts to correctly set classpath. |
| 26 | pushd . > /dev/null |
| 27 | DIR="${BASH_SOURCE[0]}" |
| 28 | while [ -h "$DIR" ]; do |
| 29 | cd "$(dirname "$DIR")" |
| 30 | DIR="$(readlink "$(basename "$DIR")")" |
| 31 | done |
| 32 | cd "$(dirname "$DIR")" |
| 33 | DIR="$(pwd)/" |
| 34 | popd > /dev/null |
| 35 | |
| 36 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 37 | CP="$DIR""current/" |
| 38 | |
| 39 | z="-Xmx2g" |
| 40 | set=0 |
| 41 | |
| 42 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 43 | usage |
| 44 | exit |
| 45 | fi |
| 46 | |
| 47 | calcXmx () { |
| 48 | source "$DIR""/calcmem.sh" |
| 49 | setEnvironment |
| 50 | parseXmx "$@" |
| 51 | } |
| 52 | calcXmx "$@" |
| 53 | |
| 54 | summarizesketch() { |
| 55 | local CMD="java $EA $EOOM $z -cp $CP sketch.SummarizeSketchStats $@" |
| 56 | # echo $CMD >&2 |
| 57 | eval $CMD |
| 58 | } |
| 59 | |
| 60 | summarizesketch "$@" |