annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/taxonomy.sh @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #!/bin/bash
jpayne@69 2
jpayne@69 3 usage(){
jpayne@69 4 echo "
jpayne@69 5 Written by Brian Bushnell
jpayne@69 6 Last modified Jan 7, 2020
jpayne@69 7
jpayne@69 8 Description: Prints the full taxonomy of a string.
jpayne@69 9 String may be a gi number, NCBI taxID, or Latin name.
jpayne@69 10 An NCBI identifier should just be a number or ncbi|number.
jpayne@69 11 A gi number should be gi|number.
jpayne@69 12 Please read bbmap/docs/guides/TaxonomyGuide.txt for more information.
jpayne@69 13 Not: It is more convenient to use taxonomy.jgi-psf.org.
jpayne@69 14
jpayne@69 15 Usage: taxonomy.sh tree=<tree file> <identifier>
jpayne@69 16 Alternate usage: taxonomy.sh tree=<tree file> in=<file>
jpayne@69 17
jpayne@69 18 Usage examples:
jpayne@69 19 taxonomy.sh tree=tree.taxtree.gz homo_sapiens canis_lupus 9606
jpayne@69 20 taxonomy.sh tree=tree.taxtree.gz gi=gitable.int1.d.gz in=refseq.fasta
jpayne@69 21
jpayne@69 22 Processing parameters:
jpayne@69 23 in=<file> A file containing named sequences, or just the names.
jpayne@69 24 out=<file> Output file. If blank, use stdout.
jpayne@69 25 tree=<file> Specify a TaxTree file like tree.taxtree.gz.
jpayne@69 26 On Genepool, use 'auto'.
jpayne@69 27 gi=<file> Specify a gitable file like gitable.int1d.gz. Only needed
jpayne@69 28 if gi numbers will be used. On Genepool, use 'auto'.
jpayne@69 29 accession= Specify one or more comma-delimited NCBI accession to taxid
jpayne@69 30 files. Only needed if accesions will be used; requires ~45GB
jpayne@69 31 of memory. On Genepool, use 'auto'.
jpayne@69 32 level=null Set to a taxonomic level like phylum to just print that level.
jpayne@69 33 minlevel=-1 For multi-level printing, do not print levels below this.
jpayne@69 34 maxlevel=life For multi-level printing, do not print levels above this.
jpayne@69 35 silva=f Parse headers using Silva or semicolon-delimited syntax.
jpayne@69 36 taxpath=auto Set the path to taxonomy files; auto only works at NERSC.
jpayne@69 37
jpayne@69 38 Parameters without an '=' symbol will be considered organism identifiers.
jpayne@69 39
jpayne@69 40 * Note *
jpayne@69 41 Tree and table files are in /global/projectb/sandbox/gaag/bbtools/tax
jpayne@69 42 For non-Genepool users, or to make new ones, use taxtree.sh and gitable.sh
jpayne@69 43
jpayne@69 44 Java Parameters:
jpayne@69 45 -Xmx This will set Java's memory usage,
jpayne@69 46 overriding autodetection.
jpayne@69 47 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify
jpayne@69 48 200 megs. The max is typically 85% of physical memory.
jpayne@69 49 -eoom This flag will cause the process to exit if an out-of-memory
jpayne@69 50 exception occurs. Requires Java 8u92+.
jpayne@69 51 -da Disable assertions.
jpayne@69 52
jpayne@69 53 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
jpayne@69 54 "
jpayne@69 55 }
jpayne@69 56
jpayne@69 57 #This block allows symlinked shellscripts to correctly set classpath.
jpayne@69 58 pushd . > /dev/null
jpayne@69 59 DIR="${BASH_SOURCE[0]}"
jpayne@69 60 while [ -h "$DIR" ]; do
jpayne@69 61 cd "$(dirname "$DIR")"
jpayne@69 62 DIR="$(readlink "$(basename "$DIR")")"
jpayne@69 63 done
jpayne@69 64 cd "$(dirname "$DIR")"
jpayne@69 65 DIR="$(pwd)/"
jpayne@69 66 popd > /dev/null
jpayne@69 67
jpayne@69 68 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
jpayne@69 69 CP="$DIR""current/"
jpayne@69 70
jpayne@69 71 z="-Xmx8g"
jpayne@69 72 z2="-Xms8g"
jpayne@69 73 set=0
jpayne@69 74
jpayne@69 75 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
jpayne@69 76 usage
jpayne@69 77 exit
jpayne@69 78 fi
jpayne@69 79
jpayne@69 80 calcXmx () {
jpayne@69 81 source "$DIR""/calcmem.sh"
jpayne@69 82 setEnvironment
jpayne@69 83 parseXmx "$@"
jpayne@69 84 if [[ $set == 1 ]]; then
jpayne@69 85 return
jpayne@69 86 fi
jpayne@69 87 freeRam 2000m 84
jpayne@69 88 z="-Xmx${RAM}m"
jpayne@69 89 z2="-Xms${RAM}m"
jpayne@69 90 }
jpayne@69 91 calcXmx "$@"
jpayne@69 92
jpayne@69 93 taxonomy() {
jpayne@69 94 local CMD="java $EA $EOOM $z -cp $CP tax.PrintTaxonomy $@"
jpayne@69 95 echo $CMD >&2
jpayne@69 96 eval $CMD
jpayne@69 97 }
jpayne@69 98
jpayne@69 99 taxonomy "$@"