| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Jasper Toscani Field |
| 6 | Last modified June 11, 2020 |
| 7 | |
| 8 | Description: Counts positional occurrences of reference kmers in reads. |
| 9 | |
| 10 | Usage: kmerposition.sh in=<input file> out=<output file> ref=<reference file> k=<kmer length> |
| 11 | |
| 12 | Input may be fasta or fastq, compressed or uncompressed. |
| 13 | |
| 14 | Standard parameters: |
| 15 | in=<file> Primary input, or read 1 input. |
| 16 | in2=<file> Read 2 input if reads are in two files. |
| 17 | ref=<file> Reference file. |
| 18 | out=<file> Primary output, statistics on found kmers. |
| 19 | |
| 20 | Processing parameters: |
| 21 | k=19 Kmer length. |
| 22 | rcomp=t If true, also match for reverse-complements. |
| 23 | |
| 24 | Java Parameters: |
| 25 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 26 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will |
| 27 | specify 200 megs. The max is typically 85% of physical memory. |
| 28 | -eoom This flag will cause the process to exit if an out-of-memory |
| 29 | exception occurs. Requires Java 8u92+. |
| 30 | -da Disable assertions. |
| 31 | |
| 32 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 33 | " |
| 34 | } |
| 35 | |
| 36 | #This block allows symlinked shellscripts to correctly set classpath. |
| 37 | pushd . > /dev/null |
| 38 | DIR="${BASH_SOURCE[0]}" |
| 39 | while [ -h "$DIR" ]; do |
| 40 | cd "$(dirname "$DIR")" |
| 41 | DIR="$(readlink "$(basename "$DIR")")" |
| 42 | done |
| 43 | cd "$(dirname "$DIR")" |
| 44 | DIR="$(pwd)/" |
| 45 | popd > /dev/null |
| 46 | |
| 47 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 48 | CP="$DIR""current/" |
| 49 | |
| 50 | z="-Xmx200m" |
| 51 | z2="-Xms200m" |
| 52 | set=0 |
| 53 | |
| 54 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 55 | usage |
| 56 | exit |
| 57 | fi |
| 58 | |
| 59 | calcXmx () { |
| 60 | source "$DIR""/calcmem.sh" |
| 61 | setEnvironment |
| 62 | parseXmx "$@" |
| 63 | } |
| 64 | calcXmx "$@" |
| 65 | |
| 66 | kmerposition3() { |
| 67 | local CMD="java $EA $EOOM $z -cp $CP jasper.KmerPosition3 $@" |
| 68 | echo $CMD >&2 |
| 69 | eval $CMD |
| 70 | } |
| 71 | |
| 72 | kmerposition3 "$@" |