jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified June 22, 2016 jpayne@69: jpayne@69: Description: Summarizes the stats output of Seal for evaluation of jpayne@69: cross-contamination. The intended use is to map multiple libraries or jpayne@69: assemblies, of different multiplexed organisms, to a concatenated reference jpayne@69: containing one fused scaffold per organism. This will convert all of the jpayne@69: resulting stats files (one per library) to a single text file, with multiple jpayne@69: columns, indicating how much of the input hit the primary versus nonprimary jpayne@69: scaffolds. jpayne@69: jpayne@69: If ingoresametaxa or ignoresamebarcode are used, ref names must be jpayne@69: in this format: jpayne@69: barcode,library,tax,location jpayne@69: For example: jpayne@69: 6-G,N0296,gammaproteobacteria_bacterium,deep_ocean jpayne@69: jpayne@69: Usage: summarizeseal.sh in= out= jpayne@69: jpayne@69: You can alternately run 'summarizeseal.sh *.txt out=out.txt' jpayne@69: jpayne@69: Parameters: jpayne@69: in= A list of stats files, or a text file containing one stats file name per line. jpayne@69: out= Destination for summary. jpayne@69: printtotal=t (pt) Print a line summarizing the total contamination rate of all assemblies. jpayne@69: ignoresametaxa=f Ignore secondary hits sharing taxonomy. jpayne@69: ignoresamebarcode=f Ignore secondary hits sharing a barcode. jpayne@69: ignoresamelocation=f Ignore secondary hits sharing a sampling site. jpayne@69: totaldenominator=f (td) Use all bases as denominator rather than mapped bases. 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="-Xmx120m" 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: summarizeseal() { jpayne@69: local CMD="java $EA $EOOM $z -cp $CP driver.SummarizeSealStats $@" jpayne@69: # echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: summarizeseal "$@"