| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified December 13, 2017 |
| 7 | |
| 8 | Description: Calculates the amount of sequence per tax node. |
| 9 | |
| 10 | Usage: taxsize.sh in=<file> out=<file> tree=<file> |
| 11 | |
| 12 | Parameters: |
| 13 | in= A fasta file annotated with taxonomic data in headers, |
| 14 | such as modified RefSeq. |
| 15 | out= Location to write the size data. |
| 16 | tree= Location of taxtree file. |
| 17 | |
| 18 | Java Parameters: |
| 19 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 20 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 21 | The max is typically 85% of physical memory. |
| 22 | -eoom This flag will cause the process to exit if an out-of-memory |
| 23 | exception occurs. Requires Java 8u92+. |
| 24 | -da Disable assertions. |
| 25 | |
| 26 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 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="-Xmx2000m" |
| 45 | set=0 |
| 46 | |
| 47 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 48 | usage |
| 49 | exit |
| 50 | fi |
| 51 | |
| 52 | calcXmx () { |
| 53 | source "$DIR""/calcmem.sh" |
| 54 | setEnvironment |
| 55 | parseXmx "$@" |
| 56 | } |
| 57 | calcXmx "$@" |
| 58 | |
| 59 | function taxsize() { |
| 60 | local CMD="java $EA $EOOM $z -cp $CP tax.TaxSize $@" |
| 61 | echo $CMD >&2 |
| 62 | eval $CMD |
| 63 | } |
| 64 | |
| 65 | taxsize "$@" |