jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified Jan 7, 2020 jpayne@69: jpayne@69: Description: Prints the full taxonomy of a string. jpayne@69: String may be a gi number, NCBI taxID, or Latin name. jpayne@69: An NCBI identifier should just be a number or ncbi|number. jpayne@69: A gi number should be gi|number. jpayne@69: Please read bbmap/docs/guides/TaxonomyGuide.txt for more information. jpayne@69: Not: It is more convenient to use taxonomy.jgi-psf.org. jpayne@69: jpayne@69: Usage: taxonomy.sh tree= jpayne@69: Alternate usage: taxonomy.sh tree= in= jpayne@69: jpayne@69: Usage examples: jpayne@69: taxonomy.sh tree=tree.taxtree.gz homo_sapiens canis_lupus 9606 jpayne@69: taxonomy.sh tree=tree.taxtree.gz gi=gitable.int1.d.gz in=refseq.fasta jpayne@69: jpayne@69: Processing parameters: jpayne@69: in= A file containing named sequences, or just the names. jpayne@69: out= Output file. If blank, use stdout. jpayne@69: tree= Specify a TaxTree file like tree.taxtree.gz. jpayne@69: On Genepool, use 'auto'. jpayne@69: gi= Specify a gitable file like gitable.int1d.gz. Only needed jpayne@69: if gi numbers will be used. On Genepool, use 'auto'. jpayne@69: accession= Specify one or more comma-delimited NCBI accession to taxid jpayne@69: files. Only needed if accesions will be used; requires ~45GB jpayne@69: of memory. On Genepool, use 'auto'. jpayne@69: level=null Set to a taxonomic level like phylum to just print that level. jpayne@69: minlevel=-1 For multi-level printing, do not print levels below this. jpayne@69: maxlevel=life For multi-level printing, do not print levels above this. jpayne@69: silva=f Parse headers using Silva or semicolon-delimited syntax. jpayne@69: taxpath=auto Set the path to taxonomy files; auto only works at NERSC. jpayne@69: jpayne@69: Parameters without an '=' symbol will be considered organism identifiers. jpayne@69: jpayne@69: * Note * jpayne@69: Tree and table files are in /global/projectb/sandbox/gaag/bbtools/tax jpayne@69: For non-Genepool users, or to make new ones, use taxtree.sh and gitable.sh jpayne@69: jpayne@69: Java Parameters: jpayne@69: -Xmx This will set Java's memory usage, jpayne@69: overriding autodetection. jpayne@69: -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify jpayne@69: 200 megs. The max is typically 85% of physical memory. jpayne@69: -eoom This flag will cause the process to exit if an out-of-memory jpayne@69: exception occurs. Requires Java 8u92+. jpayne@69: -da Disable assertions. jpayne@69: jpayne@69: Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. jpayne@69: " jpayne@69: } jpayne@69: jpayne@69: #This block allows symlinked shellscripts to correctly set classpath. jpayne@69: pushd . > /dev/null jpayne@69: DIR="${BASH_SOURCE[0]}" jpayne@69: while [ -h "$DIR" ]; do jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(readlink "$(basename "$DIR")")" jpayne@69: done jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(pwd)/" jpayne@69: popd > /dev/null jpayne@69: jpayne@69: #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" jpayne@69: CP="$DIR""current/" jpayne@69: jpayne@69: z="-Xmx8g" jpayne@69: z2="-Xms8g" jpayne@69: set=0 jpayne@69: jpayne@69: if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then jpayne@69: usage jpayne@69: exit jpayne@69: fi jpayne@69: jpayne@69: calcXmx () { jpayne@69: source "$DIR""/calcmem.sh" jpayne@69: setEnvironment jpayne@69: parseXmx "$@" jpayne@69: if [[ $set == 1 ]]; then jpayne@69: return jpayne@69: fi jpayne@69: freeRam 2000m 84 jpayne@69: z="-Xmx${RAM}m" jpayne@69: z2="-Xms${RAM}m" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: taxonomy() { jpayne@69: local CMD="java $EA $EOOM $z -cp $CP tax.PrintTaxonomy $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: taxonomy "$@"