1#!/usr/local/bin/bash 2 3usage(){ 4echo " 5Written by Brian Bushnell. 6Last modified Jan 7, 2020 7 8Description: Creates tree.taxtree from names.dmp and nodes.dmp. 9These are in taxdmp.zip available at ftp://ftp.ncbi.nih.gov/pub/taxonomy/ 10The taxtree file is needed for programs that can deal with taxonomy, 11like Seal and SortByTaxa. 12 13Usage: taxtree.sh names.dmp nodes.dmp merged.dmp tree.taxtree.gz 14 15Java 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 22Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. 23" 24} 25 26#This block allows symlinked shellscripts to correctly set classpath. 27pushd . > /dev/null 28DIR="${BASH_SOURCE[0]}" 29while [ -h "$DIR" ]; do 30 cd "$(dirname "$DIR")" 31 DIR="$(readlink "$(basename "$DIR")")" 32done 33cd "$(dirname "$DIR")" 34DIR="$(pwd)/" 35popd > /dev/null 36 37#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 38CP="$DIR""current/" 39JNI="-Djava.library.path=""$DIR""jni/" 40JNI="" 41 42z="-Xmx2g" 43z2="-Xms2g" 44set=0 45 46if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then 47 usage 48 exit 49fi 50 51calcXmx () { 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} 62calcXmx "$@" 63 64 65taxtree() { 66 local CMD="java $EA $EOOM $z $z2 -cp $CP tax.TaxTree $@" 67 echo $CMD >&2 68 eval $CMD 69} 70 71taxtree "$@" 72