| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified January 20, 2017 |
| 7 | |
| 8 | Description: Creates a ROC curve from a sam file of synthetic reads with headers generated by RandomReads3.java |
| 9 | |
| 10 | Usage: samtoroc.sh in=<sam file> reads=<number of reads in input fastq> |
| 11 | |
| 12 | Parameters: |
| 13 | in=<file> Specify the input sam file, or stdin. |
| 14 | thresh=20 Max deviation from correct location to be considered 'loosely correct'. |
| 15 | blasr=f Set to 't' for BLASR output; fixes extra information added to read names. |
| 16 | ssaha2=f Set to 't' for SSAHA2 or SMALT output; fixes incorrect soft-clipped read locations. |
| 17 | bitset=t Track read ID's to detect secondary alignments. |
| 18 | Necessary for mappers that incorrectly output multiple primary alignments per read. |
| 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 | #This block allows symlinked shellscripts to correctly set classpath. |
| 33 | pushd . > /dev/null |
| 34 | DIR="${BASH_SOURCE[0]}" |
| 35 | while [ -h "$DIR" ]; do |
| 36 | cd "$(dirname "$DIR")" |
| 37 | DIR="$(readlink "$(basename "$DIR")")" |
| 38 | done |
| 39 | cd "$(dirname "$DIR")" |
| 40 | DIR="$(pwd)/" |
| 41 | popd > /dev/null |
| 42 | |
| 43 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 44 | CP="$DIR""current/" |
| 45 | |
| 46 | z="-Xmx200m" |
| 47 | set=0 |
| 48 | |
| 49 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 50 | usage |
| 51 | exit |
| 52 | fi |
| 53 | |
| 54 | calcXmx () { |
| 55 | source "$DIR""/calcmem.sh" |
| 56 | setEnvironment |
| 57 | parseXmx "$@" |
| 58 | } |
| 59 | calcXmx "$@" |
| 60 | |
| 61 | samtoroc() { |
| 62 | local CMD="java $EA $EOOM $z -cp $CP align2.MakeRocCurve $@" |
| 63 | # echo $CMD >&2 |
| 64 | eval $CMD |
| 65 | } |
| 66 | |
| 67 | samtoroc "$@" |