| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell and Jonathan Rood |
| 6 | Last modified September 15, 2015 |
| 7 | |
| 8 | Dedupe2 is identical to Dedupe except it supports hashing unlimited kmer |
| 9 | prefixes and suffixes per sequence. Dedupe supports at most 2 of each, |
| 10 | but uses slightly more memory. You can manually set the number of kmers to |
| 11 | hash per read with the numaffixmaps (nam) flag. Dedupe will automatically |
| 12 | call Dedupe2 if necessary (if nam=3 or higher) so this script is no longer |
| 13 | necessary. |
| 14 | |
| 15 | For documentation, please consult dedupe.sh; syntax is identical. |
| 16 | " |
| 17 | } |
| 18 | |
| 19 | #This block allows symlinked shellscripts to correctly set classpath. |
| 20 | pushd . > /dev/null |
| 21 | DIR="${BASH_SOURCE[0]}" |
| 22 | while [ -h "$DIR" ]; do |
| 23 | cd "$(dirname "$DIR")" |
| 24 | DIR="$(readlink "$(basename "$DIR")")" |
| 25 | done |
| 26 | cd "$(dirname "$DIR")" |
| 27 | DIR="$(pwd)/" |
| 28 | popd > /dev/null |
| 29 | |
| 30 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 31 | CP="$DIR""current/" |
| 32 | JNI="-Djava.library.path=""$DIR""jni/" |
| 33 | JNI="" |
| 34 | |
| 35 | z="-Xmx1g" |
| 36 | z2="-Xms1g" |
| 37 | set=0 |
| 38 | |
| 39 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 40 | usage |
| 41 | exit |
| 42 | fi |
| 43 | |
| 44 | calcXmx () { |
| 45 | source "$DIR""/calcmem.sh" |
| 46 | setEnvironment |
| 47 | parseXmx "$@" |
| 48 | if [[ $set == 1 ]]; then |
| 49 | return |
| 50 | fi |
| 51 | freeRam 3200m 84 |
| 52 | z="-Xmx${RAM}m" |
| 53 | z2="-Xms${RAM}m" |
| 54 | } |
| 55 | calcXmx "$@" |
| 56 | |
| 57 | dedupe() { |
| 58 | local CMD="java $JNI $EA $EOOM $z $z2 -cp $CP jgi.Dedupe2 $@" |
| 59 | echo $CMD >&2 |
| 60 | eval $CMD |
| 61 | } |
| 62 | |
| 63 | dedupe "$@" |