1#!/usr/local/bin/bash 2 3usage(){ 4echo " 5Written by Brian Bushnell 6Last modified February 27, 2017 7 8Description: Prints sequence gc content once per interval. 9 10Usage: plotgc.sh in=<input file> out=<output file> 11 12Parameters: 13in=<file> Input file. in=stdin.fa will pipe from stdin. 14out=<file> Output file. out=stdout will pipe to stdout. 15interval=1000 Interval length. 16offset=0 Position offset. For 1-based indexing use offset=1. 17psb=t (printshortbins) Print gc content for the last bin of a contig 18 even when shorter than interval. 19 20Java Parameters: 21 22-Xmx This will set Java's memory usage, overriding automatic 23 memory detection. -Xmx20g will 24 specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. 25 The max is typically 85% of physical memory. 26-eoom This flag will cause the process to exit if an out-of-memory 27 exception occurs. Requires Java 8u92+. 28-da Disable assertions. 29 30Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. 31" 32} 33 34#This block allows symlinked shellscripts to correctly set classpath. 35pushd . > /dev/null 36DIR="${BASH_SOURCE[0]}" 37while [ -h "$DIR" ]; do 38 cd "$(dirname "$DIR")" 39 DIR="$(readlink "$(basename "$DIR")")" 40done 41cd "$(dirname "$DIR")" 42DIR="$(pwd)/" 43popd > /dev/null 44 45#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 46CP="$DIR""current/" 47JNI="-Djava.library.path=""$DIR""jni/" 48JNI="" 49 50z="-Xmx1g" 51z2="-Xms1g" 52set=0 53 54if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then 55 usage 56 exit 57fi 58 59calcXmx () { 60 source "$DIR""/calcmem.sh" 61 setEnvironment 62 parseXmx "$@" 63 if [[ $set == 1 ]]; then 64 return 65 fi 66 freeRam 1400m 42 67 z="-Xmx${RAM}m" 68 z2="-Xms${RAM}m" 69} 70calcXmx "$@" 71 72plotgc() { 73 local CMD="java $EA $EOOM $z $z2 -cp $CP driver.PlotGC $@" 74 echo $CMD >&2 75 eval $CMD 76} 77 78plotgc "$@" 79