| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified January 21, 2015 |
| 7 | |
| 8 | Description: Counts GC content of reads or scaffolds. |
| 9 | |
| 10 | Usage: countgc in=<input> out=<output> format=<format> |
| 11 | |
| 12 | Input may be stdin or a fasta or fastq file, compressed or uncompressed. |
| 13 | Output (which is optional) is tab-delimited. |
| 14 | format=1: name length A C G T N |
| 15 | format=2: name GC |
| 16 | format=4: name length GC |
| 17 | Note that in format 1, A+C+G+T=1 even when N is nonzero. |
| 18 | |
| 19 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 20 | " |
| 21 | } |
| 22 | |
| 23 | #This block allows symlinked shellscripts to correctly set classpath. |
| 24 | pushd . > /dev/null |
| 25 | DIR="${BASH_SOURCE[0]}" |
| 26 | while [ -h "$DIR" ]; do |
| 27 | cd "$(dirname "$DIR")" |
| 28 | DIR="$(readlink "$(basename "$DIR")")" |
| 29 | done |
| 30 | cd "$(dirname "$DIR")" |
| 31 | DIR="$(pwd)/" |
| 32 | popd > /dev/null |
| 33 | |
| 34 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 35 | CP="$DIR""current/" |
| 36 | |
| 37 | z="-Xmx120m" |
| 38 | set=0 |
| 39 | |
| 40 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 41 | usage |
| 42 | exit |
| 43 | fi |
| 44 | |
| 45 | calcXmx () { |
| 46 | source "$DIR""/calcmem.sh" |
| 47 | setEnvironment |
| 48 | parseXmx "$@" |
| 49 | } |
| 50 | calcXmx "$@" |
| 51 | |
| 52 | countgc() { |
| 53 | local CMD="java $EA $EOOM $z -cp $CP jgi.CountGC $@" |
| 54 | echo $CMD >&2 |
| 55 | eval $CMD |
| 56 | } |
| 57 | |
| 58 | countgc "$@" |