| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified November 4, 2015 |
| 7 | |
| 8 | Description: Calculates EST (expressed sequence tags) capture by an assembly from a sam file. |
| 9 | Designed to use BBMap output generated with these flags: k=13 maxindel=100000 customtag ordered |
| 10 | |
| 11 | Usage: bbest.sh in=<sam file> out=<stats file> |
| 12 | |
| 13 | Parameters: |
| 14 | in=<file> Specify a sam file (or stdin) containing mapped ests. |
| 15 | out=<file> Specify the output stats file (default is stdout). |
| 16 | ref=<file> Specify the reference file (optional). |
| 17 | est=<file> Specify the est fasta file (optional). |
| 18 | fraction=0.98 Min fraction of bases mapped to ref to be |
| 19 | considered 'all mapped'. |
| 20 | |
| 21 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 22 | " |
| 23 | } |
| 24 | |
| 25 | #This block allows symlinked shellscripts to correctly set classpath. |
| 26 | pushd . > /dev/null |
| 27 | DIR="${BASH_SOURCE[0]}" |
| 28 | while [ -h "$DIR" ]; do |
| 29 | cd "$(dirname "$DIR")" |
| 30 | DIR="$(readlink "$(basename "$DIR")")" |
| 31 | done |
| 32 | cd "$(dirname "$DIR")" |
| 33 | DIR="$(pwd)/" |
| 34 | popd > /dev/null |
| 35 | |
| 36 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 37 | CP="$DIR""current/" |
| 38 | |
| 39 | z="-Xmx120m" |
| 40 | z2="-Xms120m" |
| 41 | set=0 |
| 42 | |
| 43 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 44 | usage |
| 45 | exit |
| 46 | fi |
| 47 | |
| 48 | calcXmx () { |
| 49 | source "$DIR""/calcmem.sh" |
| 50 | setEnvironment |
| 51 | parseXmx "$@" |
| 52 | } |
| 53 | calcXmx "$@" |
| 54 | |
| 55 | function bbest() { |
| 56 | local CMD="java $EA $EOOM $z -cp $CP jgi.SamToEst $@" |
| 57 | # echo $CMD >&2 |
| 58 | eval $CMD |
| 59 | } |
| 60 | |
| 61 | bbest "$@" |