| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified June 22, 2016 |
| 7 | |
| 8 | Description: Summarizes the stats output of Seal for evaluation of |
| 9 | 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 | If ingoresametaxa or ignoresamebarcode are used, ref names must be |
| 17 | in this format: |
| 18 | barcode,library,tax,location |
| 19 | For example: |
| 20 | 6-G,N0296,gammaproteobacteria_bacterium,deep_ocean |
| 21 | |
| 22 | Usage: summarizeseal.sh in=<file,file...> out=<file> |
| 23 | |
| 24 | You can alternately run 'summarizeseal.sh *.txt out=out.txt' |
| 25 | |
| 26 | Parameters: |
| 27 | in=<file> A list of stats files, or a text file containing one stats file name per line. |
| 28 | out=<file> Destination for summary. |
| 29 | printtotal=t (pt) Print a line summarizing the total contamination rate of all assemblies. |
| 30 | ignoresametaxa=f Ignore secondary hits sharing taxonomy. |
| 31 | ignoresamebarcode=f Ignore secondary hits sharing a barcode. |
| 32 | ignoresamelocation=f Ignore secondary hits sharing a sampling site. |
| 33 | totaldenominator=f (td) Use all bases as denominator rather than mapped bases. |
| 34 | |
| 35 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 36 | " |
| 37 | } |
| 38 | |
| 39 | #This block allows symlinked shellscripts to correctly set classpath. |
| 40 | pushd . > /dev/null |
| 41 | DIR="${BASH_SOURCE[0]}" |
| 42 | while [ -h "$DIR" ]; do |
| 43 | cd "$(dirname "$DIR")" |
| 44 | DIR="$(readlink "$(basename "$DIR")")" |
| 45 | done |
| 46 | cd "$(dirname "$DIR")" |
| 47 | DIR="$(pwd)/" |
| 48 | popd > /dev/null |
| 49 | |
| 50 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 51 | CP="$DIR""current/" |
| 52 | |
| 53 | z="-Xmx120m" |
| 54 | set=0 |
| 55 | |
| 56 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 57 | usage |
| 58 | exit |
| 59 | fi |
| 60 | |
| 61 | calcXmx () { |
| 62 | source "$DIR""/calcmem.sh" |
| 63 | setEnvironment |
| 64 | parseXmx "$@" |
| 65 | } |
| 66 | calcXmx "$@" |
| 67 | |
| 68 | summarizeseal() { |
| 69 | local CMD="java $EA $EOOM $z -cp $CP driver.SummarizeSealStats $@" |
| 70 | # echo $CMD >&2 |
| 71 | eval $CMD |
| 72 | } |
| 73 | |
| 74 | summarizeseal "$@" |