| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified May 23, 2014 |
| 7 | |
| 8 | Description: Grades mapping correctness of a sam file of synthetic reads with headers generated by RandomReads3.java |
| 9 | |
| 10 | Usage: gradesam.sh in=<sam file> reads=<number of reads> |
| 11 | |
| 12 | Parameters: |
| 13 | in=<file> Specify the input sam file, or stdin. |
| 14 | reads=<int> Number of reads in mapper's input (i.e., the fastq file). |
| 15 | thresh=20 Max deviation from correct location to be considered 'loosely correct'. |
| 16 | blasr=f Set to 't' for BLASR output; fixes extra information added to read names. |
| 17 | ssaha2=f Set to 't' for SSAHA2 or SMALT output; fixes incorrect soft-clipped read locations. |
| 18 | quality=3 Reads with a mapping quality of this or below will be considered ambiguously mapped. |
| 19 | bitset=t Track read ID's to detect secondary alignments. |
| 20 | Necessary for mappers that incorrectly output multiple primary alignments per read. |
| 21 | |
| 22 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 23 | " |
| 24 | } |
| 25 | |
| 26 | #This block allows symlinked shellscripts to correctly set classpath. |
| 27 | pushd . > /dev/null |
| 28 | DIR="${BASH_SOURCE[0]}" |
| 29 | while [ -h "$DIR" ]; do |
| 30 | cd "$(dirname "$DIR")" |
| 31 | DIR="$(readlink "$(basename "$DIR")")" |
| 32 | done |
| 33 | cd "$(dirname "$DIR")" |
| 34 | DIR="$(pwd)/" |
| 35 | popd > /dev/null |
| 36 | |
| 37 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 38 | CP="$DIR""current/" |
| 39 | set=0 |
| 40 | |
| 41 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 42 | usage |
| 43 | exit |
| 44 | fi |
| 45 | |
| 46 | function gradesam() { |
| 47 | local CMD="java $EA $EOOM -Xmx200m -cp $CP align2.GradeSamFile $@" |
| 48 | # echo $CMD >&2 |
| 49 | eval $CMD |
| 50 | } |
| 51 | |
| 52 | gradesam "$@" |