| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified December 19, 2019 |
| 7 | |
| 8 | Description: Analyzes sketch results from query, ref, ani format. |
| 9 | |
| 10 | Usage: analyzesketchresults.sh in=<file> out=<outfile> |
| 11 | |
| 12 | |
| 13 | Parameters and their defaults: |
| 14 | |
| 15 | in=<file> Required input file of Sketch results in 3column format. |
| 16 | in2=<file> Optional second input file of Sketch results in amino mode. |
| 17 | out=stdout.txt Output file for summary of per-tax-level averages. |
| 18 | outaccuracy=<file> Output file for accuracy results; requires query taxIDs and printcal. |
| 19 | outmap=<file> Output file for ANI vs AAI. Requires in2. |
| 20 | bbsketch Parse BBSketch output format (default). |
| 21 | mash Parse Mash output format. Files should be named like this: |
| 22 | tid_511145_Escherichia_coli_str._K-12_substr._MG1655.fa.gz |
| 23 | blast Parse Blast output format (TODO). |
| 24 | |
| 25 | ow=f (overwrite) Overwrites files that already exist. |
| 26 | app=f (append) Append to files that already exist. |
| 27 | |
| 28 | Java Parameters: |
| 29 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 30 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 31 | The max is typically 85% of physical memory. |
| 32 | -eoom This flag will cause the process to exit if an out-of-memory exception occurs. Requires Java 8u92+. |
| 33 | -da Disable assertions. |
| 34 | |
| 35 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 36 | " |
| 37 | } |
| 38 | |
| 39 | #This block allows symlinked shellscripts to correctly set classpath. |
| 40 | pushd . > /dev/null |
| 41 | DIR="${BASH_SOURCE[0]}" |
| 42 | while [ -h "$DIR" ]; do |
| 43 | cd "$(dirname "$DIR")" |
| 44 | DIR="$(readlink "$(basename "$DIR")")" |
| 45 | done |
| 46 | cd "$(dirname "$DIR")" |
| 47 | DIR="$(pwd)/" |
| 48 | popd > /dev/null |
| 49 | |
| 50 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 51 | CP="$DIR""current/" |
| 52 | |
| 53 | z="-Xmx300m" |
| 54 | z="-Xms300m" |
| 55 | set=0 |
| 56 | |
| 57 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 58 | usage |
| 59 | exit |
| 60 | fi |
| 61 | |
| 62 | calcXmx () { |
| 63 | source "$DIR""/calcmem.sh" |
| 64 | setEnvironment |
| 65 | parseXmx "$@" |
| 66 | } |
| 67 | calcXmx "$@" |
| 68 | |
| 69 | function analyzesketchresults() { |
| 70 | local CMD="java $EA $EOOM $z $z2 -cp $CP sketch.AnalyzeSketchResults $@" |
| 71 | echo $CMD >&2 |
| 72 | eval $CMD |
| 73 | } |
| 74 | |
| 75 | analyzesketchresults "$@" |