| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified May 26, 2015 |
| 7 | |
| 8 | Description: Summarizes the scafstats output of BBMap for evaluation |
| 9 | of cross-contamination. The intended use is to map multiple libraries or |
| 10 | assemblies, of different multiplexed organisms, to a concatenated reference |
| 11 | containing one fused scaffold per organism. This will convert all of the |
| 12 | resulting stats files (one per library) to a single text file, with multiple |
| 13 | columns, indicating how much of the input hit the primary versus nonprimary |
| 14 | scaffolds. |
| 15 | |
| 16 | Usage: summarizescafstats.sh in=<file,file...> out=<file> |
| 17 | |
| 18 | You can alternatively use a wildcard, like this: |
| 19 | summarizescafstats.sh scafstats_*.txt out=summary.txt |
| 20 | |
| 21 | Parameters: |
| 22 | in=<file> A list of stats files, or a text file containing one stats file name per line. |
| 23 | out=<file> Destination for summary. |
| 24 | |
| 25 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 26 | " |
| 27 | } |
| 28 | |
| 29 | #This block allows symlinked shellscripts to correctly set classpath. |
| 30 | pushd . > /dev/null |
| 31 | DIR="${BASH_SOURCE[0]}" |
| 32 | while [ -h "$DIR" ]; do |
| 33 | cd "$(dirname "$DIR")" |
| 34 | DIR="$(readlink "$(basename "$DIR")")" |
| 35 | done |
| 36 | cd "$(dirname "$DIR")" |
| 37 | DIR="$(pwd)/" |
| 38 | popd > /dev/null |
| 39 | |
| 40 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 41 | CP="$DIR""current/" |
| 42 | |
| 43 | z="-Xmx120m" |
| 44 | set=0 |
| 45 | |
| 46 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 47 | usage |
| 48 | exit |
| 49 | fi |
| 50 | |
| 51 | calcXmx () { |
| 52 | source "$DIR""/calcmem.sh" |
| 53 | setEnvironment |
| 54 | parseXmx "$@" |
| 55 | } |
| 56 | calcXmx "$@" |
| 57 | |
| 58 | summarizescafstats() { |
| 59 | local CMD="java $EA $EOOM $z -cp $CP driver.SummarizeCoverage $@" |
| 60 | # echo $CMD >&2 |
| 61 | eval $CMD |
| 62 | } |
| 63 | |
| 64 | summarizescafstats "$@" |