| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified December 19, 2018 |
| 7 | |
| 8 | Description: Calls peaks from a 2-column (x, y) tab-delimited histogram. |
| 9 | |
| 10 | Usage: callpeaks.sh in=<histogram file> out=<output file> |
| 11 | |
| 12 | Peak-calling parameters: |
| 13 | in=<file> 'in=stdin.fq' will pipe from standard in. |
| 14 | out=<file> Write the peaks to this file. Default is stdout. |
| 15 | minHeight=2 (h) Ignore peaks shorter than this. |
| 16 | minVolume=5 (v) Ignore peaks with less area than this. |
| 17 | minWidth=3 (w) Ignore peaks narrower than this. |
| 18 | minPeak=2 (minp) Ignore peaks with an X-value below this. |
| 19 | Useful when low-count kmers are filtered). |
| 20 | maxPeak=BIG (maxp) Ignore peaks with an X-value above this. |
| 21 | maxPeakCount=10 (maxpc) Print up to this many peaks (prioritizing height). |
| 22 | countColumn=1 (col) For multi-column input, this column, zero-based, |
| 23 | contains the counts. |
| 24 | ploidy=-1 Specify ploidy; otherwise it will be autodetected. |
| 25 | logscale=f Transform to log-scale prior to peak-calling. Useful |
| 26 | for kmer-frequency histograms. |
| 27 | |
| 28 | Smoothing parameters: |
| 29 | smoothradius=0 Integer radius of triangle filter. Set above zero to |
| 30 | smooth data prior to peak-calling. Higher values are |
| 31 | smoother. |
| 32 | smoothprogressive=f Set to true to widen the filter as the x-coordinate |
| 33 | increases. Useful for kmer-frequency histograms. |
| 34 | maxradius=10 Maximum radius of progressive smoothing function. |
| 35 | progressivemult=2 Increment radius each time depth increases by this factor. |
| 36 | |
| 37 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 38 | " |
| 39 | } |
| 40 | |
| 41 | #This block allows symlinked shellscripts to correctly set classpath. |
| 42 | pushd . > /dev/null |
| 43 | DIR="${BASH_SOURCE[0]}" |
| 44 | while [ -h "$DIR" ]; do |
| 45 | cd "$(dirname "$DIR")" |
| 46 | DIR="$(readlink "$(basename "$DIR")")" |
| 47 | done |
| 48 | cd "$(dirname "$DIR")" |
| 49 | DIR="$(pwd)/" |
| 50 | popd > /dev/null |
| 51 | |
| 52 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 53 | CP="$DIR""current/" |
| 54 | |
| 55 | z="-Xmx200m" |
| 56 | set=0 |
| 57 | |
| 58 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 59 | usage |
| 60 | exit |
| 61 | fi |
| 62 | |
| 63 | calcXmx () { |
| 64 | source "$DIR""/calcmem.sh" |
| 65 | setEnvironment |
| 66 | parseXmx "$@" |
| 67 | } |
| 68 | calcXmx "$@" |
| 69 | |
| 70 | stats() { |
| 71 | local CMD="java $EA $EOOM -Xmx120m -cp $CP jgi.CallPeaks $@" |
| 72 | # echo $CMD >&2 |
| 73 | eval $CMD |
| 74 | } |
| 75 | |
| 76 | stats "$@" |