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