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