| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified July 29, 2019 |
| 7 | |
| 8 | Description: Shrinks accession2taxid tables by removing unneeded columns. |
| 9 | This is not necessary but makes accession2taxid files smaller and load faster. |
| 10 | |
| 11 | Usage: shrinkaccession.sh in=<file> out=<outfile> |
| 12 | |
| 13 | Parameters: |
| 14 | ow=f (overwrite) Overwrites files that already exist. |
| 15 | app=f (append) Append to files that already exist. |
| 16 | zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max). |
| 17 | pigz=t Use pigz for compression, if available. |
| 18 | gi=t Retain gi numbers. |
| 19 | |
| 20 | Java Parameters: |
| 21 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 22 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 23 | The max is typically 85% of physical memory. |
| 24 | -eoom This flag will cause the process to exit if an out-of-memory |
| 25 | exception occurs. Requires Java 8u92+. |
| 26 | -da Disable assertions. |
| 27 | |
| 28 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 29 | " |
| 30 | } |
| 31 | |
| 32 | |
| 33 | #This block allows symlinked shellscripts to correctly set classpath. |
| 34 | pushd . > /dev/null |
| 35 | DIR="${BASH_SOURCE[0]}" |
| 36 | while [ -h "$DIR" ]; do |
| 37 | cd "$(dirname "$DIR")" |
| 38 | DIR="$(readlink "$(basename "$DIR")")" |
| 39 | done |
| 40 | cd "$(dirname "$DIR")" |
| 41 | DIR="$(pwd)/" |
| 42 | popd > /dev/null |
| 43 | |
| 44 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 45 | CP="$DIR""current/" |
| 46 | |
| 47 | z="-Xmx80m" |
| 48 | set=0 |
| 49 | |
| 50 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 51 | usage |
| 52 | exit |
| 53 | fi |
| 54 | |
| 55 | calcXmx () { |
| 56 | source "$DIR""/calcmem.sh" |
| 57 | setEnvironment |
| 58 | parseXmx "$@" |
| 59 | } |
| 60 | calcXmx "$@" |
| 61 | |
| 62 | function shrinkaccession() { |
| 63 | local CMD="java $EA $EOOM $z -cp $CP tax.ShrinkAccession $@" |
| 64 | echo $CMD >&2 |
| 65 | eval $CMD |
| 66 | } |
| 67 | |
| 68 | shrinkaccession "$@" |