| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell and Shijie Yao |
| 6 | Last modified Jan 7, 2020 |
| 7 | |
| 8 | Description: Starts a server that translates NCBI taxonomy. |
| 9 | |
| 10 | Usage: taxserver.sh tree=<taxtree file> table=<gitable file> port=<number> |
| 11 | |
| 12 | Usage examples: |
| 13 | taxserver.sh tree=tree.taxtree.gz table=gitable.int1d.gz port=1234 |
| 14 | |
| 15 | On Genepool: |
| 16 | taxserver.sh tree=auto table=auto port=1234 |
| 17 | |
| 18 | For accession number support, add accession=<something> E.g.: |
| 19 | |
| 20 | External: |
| 21 | taxserver.sh -Xmx45g tree=tree.taxtree.gz table=gitable.int1d.gz accession=prot.accession2taxid.gz,nucl_wgs.accession2taxid.gz port=1234 |
| 22 | |
| 23 | On Genepool: |
| 24 | taxserver.sh tree=auto table=auto accession=auto port=1234 |
| 25 | |
| 26 | If all expected files are in some specific location, you can also do this: |
| 27 | taxserver.sh -Xmx45g tree=auto table=auto accession=auto port=1234 taxpath=/path/to/files |
| 28 | |
| 29 | To kill remotely, launch with the flag kill=password, then access /kill/password |
| 30 | |
| 31 | Parameters: |
| 32 | |
| 33 | tree=auto taxtree path. Always necessary. |
| 34 | table=auto gitable path. Necessary for gi number support. |
| 35 | accession=null Comma-delimited paths of accession files. |
| 36 | Necessary for accession support. |
| 37 | img=null IMG dump file. |
| 38 | pattern=null Pattern file, for storing accessions more efficiently. |
| 39 | port=3068 Port number. |
| 40 | domain= Domain to be displayed in the help message. |
| 41 | Default is taxonomy.jgi-psf.org. |
| 42 | dbname= Set the name of the database in the help message. |
| 43 | sketchcomparethreads=16 Limit compare threads per connection. |
| 44 | sketchloadthreads=4 Limit load threads (for local queries of fastq). |
| 45 | sketchonly=f Don't hash taxa names. |
| 46 | k=31 Kmer length, 1-32. To maximize sensitivity and |
| 47 | specificity, dual kmer lengths may be used: k=31,24 |
| 48 | prealloc=f Preallocate some data structures for faster loading. |
| 49 | |
| 50 | Security parameters: |
| 51 | |
| 52 | killcode= Set a password to allow remote killing. |
| 53 | oldcode= Set the password of a prior instance. |
| 54 | oldaddress= Attempt to kill a prior instance after initialization, |
| 55 | by sending the old code to this address. For example, |
| 56 | taxonomy.jgi-psf.org/kill/ |
| 57 | allowremotefileaccess=f Allow non-internal queries to use internal files |
| 58 | for sketching in local mode. |
| 59 | allowlocalhost=f Consider a query internal if it originates from localhost |
| 60 | without being proxied. |
| 61 | addressprefix=128. Queries originating from this IP address prefix will be |
| 62 | considered internal. |
| 63 | |
| 64 | |
| 65 | Unrecognized parameters with no = symbol will be treated as sketch files. |
| 66 | Other sketch parameters such as index and k are also allowed. |
| 67 | Please consult bbmap/docs/guides/TaxonomyGuide.txt and BBSketchGuide.txt for more information. |
| 68 | |
| 69 | Java Parameters: |
| 70 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 71 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 72 | The max is typically 85% of physical memory. |
| 73 | -eoom This flag will cause the process to exit if an |
| 74 | out-of-memory exception occurs. Requires Java 8u92+. |
| 75 | -da Disable assertions. |
| 76 | |
| 77 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 78 | " |
| 79 | } |
| 80 | |
| 81 | #This block allows symlinked shellscripts to correctly set classpath. |
| 82 | pushd . > /dev/null |
| 83 | DIR="${BASH_SOURCE[0]}" |
| 84 | while [ -h "$DIR" ]; do |
| 85 | cd "$(dirname "$DIR")" |
| 86 | DIR="$(readlink "$(basename "$DIR")")" |
| 87 | done |
| 88 | cd "$(dirname "$DIR")" |
| 89 | DIR="$(pwd)/" |
| 90 | popd > /dev/null |
| 91 | |
| 92 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 93 | CP="$DIR""current/" |
| 94 | |
| 95 | z="-Xmx45g" |
| 96 | z2="-Xms45g" |
| 97 | set=0 |
| 98 | |
| 99 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 100 | usage |
| 101 | exit |
| 102 | fi |
| 103 | |
| 104 | calcXmx () { |
| 105 | source "$DIR""/calcmem.sh" |
| 106 | setEnvironment |
| 107 | parseXmx "$@" |
| 108 | } |
| 109 | calcXmx "$@" |
| 110 | |
| 111 | taxserver() { |
| 112 | local CMD="java $EA $EOOM $z $z2 -cp $CP tax.TaxServer $@" |
| 113 | echo $CMD >&2 |
| 114 | eval $CMD |
| 115 | } |
| 116 | |
| 117 | taxserver "$@" |