| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified July 1, 2016 |
| 7 | |
| 8 | Description: Makes a Newick tree from an identity matrix. |
| 9 | Intended for use with matrices created by idmatrix.sh. |
| 10 | |
| 11 | Usage: idtree.sh in=<input file> out=<output file> |
| 12 | |
| 13 | Standard parameters: |
| 14 | in=<file> Identity matrix in TSV format. |
| 15 | out=<file> Newick tree output. |
| 16 | overwrite=f (ow) Set to false to force the program to abort rather than |
| 17 | overwrite an existing file. |
| 18 | |
| 19 | Processing parameters: |
| 20 | None yet! |
| 21 | |
| 22 | Java Parameters: |
| 23 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 24 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will |
| 25 | specify 200 megs. The max is typically 85% of physical memory. |
| 26 | -eoom This flag will cause the process to exit if an out-of-memory |
| 27 | exception occurs. Requires Java 8u92+. |
| 28 | -da Disable assertions. |
| 29 | |
| 30 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 31 | " |
| 32 | } |
| 33 | |
| 34 | #This block allows symlinked shellscripts to correctly set classpath. |
| 35 | pushd . > /dev/null |
| 36 | DIR="${BASH_SOURCE[0]}" |
| 37 | while [ -h "$DIR" ]; do |
| 38 | cd "$(dirname "$DIR")" |
| 39 | DIR="$(readlink "$(basename "$DIR")")" |
| 40 | done |
| 41 | cd "$(dirname "$DIR")" |
| 42 | DIR="$(pwd)/" |
| 43 | popd > /dev/null |
| 44 | |
| 45 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 46 | CP="$DIR""current/" |
| 47 | |
| 48 | z="-Xmx800m" |
| 49 | z2="-Xms800m" |
| 50 | set=0 |
| 51 | |
| 52 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 53 | usage |
| 54 | exit |
| 55 | fi |
| 56 | |
| 57 | calcXmx () { |
| 58 | source "$DIR""/calcmem.sh" |
| 59 | setEnvironment |
| 60 | parseXmx "$@" |
| 61 | if [[ $set == 1 ]]; then |
| 62 | return |
| 63 | fi |
| 64 | freeRam 800m 84 |
| 65 | z="-Xmx${RAM}m" |
| 66 | z2="-Xms${RAM}m" |
| 67 | } |
| 68 | calcXmx "$@" |
| 69 | |
| 70 | idtree() { |
| 71 | local CMD="java $EA $EOOM $z -cp $CP tax.IDTree $@" |
| 72 | echo $CMD >&2 |
| 73 | eval $CMD |
| 74 | } |
| 75 | |
| 76 | idtree "$@" |