| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified January 21, 2015 |
| 7 | |
| 8 | Description: Merges coverage stats lines (from pileup) for the same OTU, |
| 9 | according to some custom naming scheme. |
| 10 | |
| 11 | Usage: mergeOTUs.sh in=<file> out=<file> |
| 12 | |
| 13 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 14 | " |
| 15 | } |
| 16 | |
| 17 | #This block allows symlinked shellscripts to correctly set classpath. |
| 18 | pushd . > /dev/null |
| 19 | DIR="${BASH_SOURCE[0]}" |
| 20 | while [ -h "$DIR" ]; do |
| 21 | cd "$(dirname "$DIR")" |
| 22 | DIR="$(readlink "$(basename "$DIR")")" |
| 23 | done |
| 24 | cd "$(dirname "$DIR")" |
| 25 | DIR="$(pwd)/" |
| 26 | popd > /dev/null |
| 27 | |
| 28 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 29 | CP="$DIR""current/" |
| 30 | |
| 31 | z="-Xmx1g" |
| 32 | set=0 |
| 33 | |
| 34 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 35 | usage |
| 36 | exit |
| 37 | fi |
| 38 | |
| 39 | calcXmx () { |
| 40 | source "$DIR""/calcmem.sh" |
| 41 | setEnvironment |
| 42 | parseXmx "$@" |
| 43 | } |
| 44 | calcXmx "$@" |
| 45 | |
| 46 | function mergeOTUs() { |
| 47 | local CMD="java $EA $EOOM $z -cp $CP driver.MergeCoverageOTU $@" |
| 48 | echo $CMD >&2 |
| 49 | eval $CMD |
| 50 | } |
| 51 | |
| 52 | mergeOTUs "$@" |