| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell. |
| 6 | Last modified Jan 7, 2020 |
| 7 | |
| 8 | Description: Creates tree.taxtree from names.dmp and nodes.dmp. |
| 9 | These are in taxdmp.zip available at ftp://ftp.ncbi.nih.gov/pub/taxonomy/ |
| 10 | The taxtree file is needed for programs that can deal with taxonomy, |
| 11 | like Seal and SortByTaxa. |
| 12 | |
| 13 | Usage: taxtree.sh names.dmp nodes.dmp merged.dmp tree.taxtree.gz |
| 14 | |
| 15 | Java Parameters: |
| 16 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 17 | -Xmx20g will specify 20 gigs of RAM. The max is typically 85% of physical memory. |
| 18 | -eoom This flag will cause the process to exit if an out-of-memory |
| 19 | exception occurs. Requires Java 8u92+. |
| 20 | -da Disable assertions. |
| 21 | |
| 22 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 23 | " |
| 24 | } |
| 25 | |
| 26 | #This block allows symlinked shellscripts to correctly set classpath. |
| 27 | pushd . > /dev/null |
| 28 | DIR="${BASH_SOURCE[0]}" |
| 29 | while [ -h "$DIR" ]; do |
| 30 | cd "$(dirname "$DIR")" |
| 31 | DIR="$(readlink "$(basename "$DIR")")" |
| 32 | done |
| 33 | cd "$(dirname "$DIR")" |
| 34 | DIR="$(pwd)/" |
| 35 | popd > /dev/null |
| 36 | |
| 37 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 38 | CP="$DIR""current/" |
| 39 | JNI="-Djava.library.path=""$DIR""jni/" |
| 40 | JNI="" |
| 41 | |
| 42 | z="-Xmx2g" |
| 43 | z2="-Xms2g" |
| 44 | set=0 |
| 45 | |
| 46 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 47 | usage |
| 48 | exit |
| 49 | fi |
| 50 | |
| 51 | calcXmx () { |
| 52 | source "$DIR""/calcmem.sh" |
| 53 | setEnvironment |
| 54 | parseXmx "$@" |
| 55 | if [[ $set == 1 ]]; then |
| 56 | return |
| 57 | fi |
| 58 | freeRam 2000m 84 |
| 59 | z="-Xmx${RAM}m" |
| 60 | z2="-Xms${RAM}m" |
| 61 | } |
| 62 | calcXmx "$@" |
| 63 | |
| 64 | |
| 65 | taxtree() { |
| 66 | local CMD="java $EA $EOOM $z $z2 -cp $CP tax.TaxTree $@" |
| 67 | echo $CMD >&2 |
| 68 | eval $CMD |
| 69 | } |
| 70 | |
| 71 | taxtree "$@" |