jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified February 17, 2015 jpayne@69: jpayne@69: Description: Generates synthetic cross-contaminated files from clean files. jpayne@69: Intended for use with synthetic reads generated by SynthMDA or RandomReads. jpayne@69: jpayne@69: Usage: crosscontaminate.sh in= out= jpayne@69: jpayne@69: Input parameters: jpayne@69: in= Clean input reads. jpayne@69: innamefile= A file containing the names of input files, jpayne@69: one name per line. jpayne@69: interleaved=auto (int) t/f overrides interleaved autodetection. jpayne@69: qin=auto Input quality offset: 33 (Sanger), 64, or auto. jpayne@69: reads=-1 If positive, quit after processing X reads or pairs. jpayne@69: jpayne@69: Processing Parameters: jpayne@69: minsinks=1 Min contamination destinations from one source. jpayne@69: maxsinks=8 Max contamination destinations from one source. jpayne@69: minprob=0.000005 Min allowed contamination rate (geometric distribution). jpayne@69: maxprob=0.025 Max allowed contamination rate. jpayne@69: jpayne@69: Output parameters: jpayne@69: out= Contaminated output reads. jpayne@69: outnamefile= A file containing the names of output files, jpayne@69: one name per line. jpayne@69: overwrite=t (ow) Grant permission to overwrite files. jpayne@69: #showspeed=t (ss) 'f' suppresses display of processing speed. jpayne@69: ziplevel=2 (zl) Compression level; 1 (min) through 9 (max). jpayne@69: threads=auto (t) Set number of threads to use; default is number of jpayne@69: logical processors. jpayne@69: qout=auto Output quality offset: 33 (Sanger), 64, or auto. jpayne@69: shuffle=f Shuffle contents of output files. jpayne@69: shufflethreads=3 Use this many threads for shuffling (uses more memory). jpayne@69: jpayne@69: Java Parameters: jpayne@69: -Xmx This will set Java's memory usage, overriding autodetection. jpayne@69: -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. jpayne@69: The max is typically 85% of physical memory. jpayne@69: -eoom This flag will cause the process to exit if an jpayne@69: out-of-memory exception occurs. Requires Java 8u92+. jpayne@69: -da Disable assertions. 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="-Xmx4g" jpayne@69: z2="-Xms4g" 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: if [[ $set == 1 ]]; then jpayne@69: return jpayne@69: fi jpayne@69: freeRam 4000m 42 jpayne@69: z="-Xmx${RAM}m" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: crosscontaminate() { jpayne@69: local CMD="java $EA $EOOM $z -cp $CP jgi.CrossContaminate $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: crosscontaminate "$@"