jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified December 19, 2018 jpayne@69: jpayne@69: Description: Calls peaks from a 2-column (x, y) tab-delimited histogram. jpayne@69: jpayne@69: Usage: callpeaks.sh in= out= jpayne@69: jpayne@69: Peak-calling parameters: jpayne@69: in= 'in=stdin.fq' will pipe from standard in. jpayne@69: out= Write the peaks to this file. Default is stdout. jpayne@69: minHeight=2 (h) Ignore peaks shorter than this. jpayne@69: minVolume=5 (v) Ignore peaks with less area than this. jpayne@69: minWidth=3 (w) Ignore peaks narrower than this. jpayne@69: minPeak=2 (minp) Ignore peaks with an X-value below this. jpayne@69: Useful when low-count kmers are filtered). jpayne@69: maxPeak=BIG (maxp) Ignore peaks with an X-value above this. jpayne@69: maxPeakCount=10 (maxpc) Print up to this many peaks (prioritizing height). jpayne@69: countColumn=1 (col) For multi-column input, this column, zero-based, jpayne@69: contains the counts. jpayne@69: ploidy=-1 Specify ploidy; otherwise it will be autodetected. jpayne@69: logscale=f Transform to log-scale prior to peak-calling. Useful jpayne@69: for kmer-frequency histograms. jpayne@69: jpayne@69: Smoothing parameters: jpayne@69: smoothradius=0 Integer radius of triangle filter. Set above zero to jpayne@69: smooth data prior to peak-calling. Higher values are jpayne@69: smoother. jpayne@69: smoothprogressive=f Set to true to widen the filter as the x-coordinate jpayne@69: increases. Useful for kmer-frequency histograms. jpayne@69: maxradius=10 Maximum radius of progressive smoothing function. jpayne@69: progressivemult=2 Increment radius each time depth increases by this factor. jpayne@69: jpayne@69: Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. jpayne@69: " jpayne@69: } jpayne@69: jpayne@69: #This block allows symlinked shellscripts to correctly set classpath. jpayne@69: pushd . > /dev/null jpayne@69: DIR="${BASH_SOURCE[0]}" jpayne@69: while [ -h "$DIR" ]; do jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(readlink "$(basename "$DIR")")" jpayne@69: done jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(pwd)/" jpayne@69: popd > /dev/null jpayne@69: jpayne@69: #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" jpayne@69: CP="$DIR""current/" jpayne@69: jpayne@69: z="-Xmx200m" jpayne@69: set=0 jpayne@69: jpayne@69: if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then jpayne@69: usage jpayne@69: exit jpayne@69: fi jpayne@69: jpayne@69: calcXmx () { jpayne@69: source "$DIR""/calcmem.sh" jpayne@69: setEnvironment jpayne@69: parseXmx "$@" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: stats() { jpayne@69: local CMD="java $EA $EOOM -Xmx120m -cp $CP jgi.CallPeaks $@" jpayne@69: # echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: stats "$@"