jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified July 16, 2018 jpayne@69: jpayne@69: Description: Compresses sequence data into a fasta file containing each kmer jpayne@69: exactly once. Allows arbitrary kmer set operations via multiple passes. jpayne@69: jpayne@69: Usage: kcompress.sh in= out= min=<1> max=<2147483647> jpayne@69: jpayne@69: Input parameters: jpayne@69: in= Primary input file for reads to use as kmer data. jpayne@69: in2= Second input file for paired data. jpayne@69: reads=-1 Only process this number of reads, then quit (-1 means all). jpayne@69: jpayne@69: Output parameters: jpayne@69: out= Write contigs (in contig mode). jpayne@69: showstats=t Print assembly statistics after writing contigs. jpayne@69: fuse=0 Fuse output sequences into chunks at least this long, jpayne@69: padded with 1 N between sequences. jpayne@69: jpayne@69: Prefiltering parameters: jpayne@69: prefilter=0 If set to a positive integer, use a countmin sketch jpayne@69: to ignore kmers with depth of that value or lower. jpayne@69: prehashes=2 Number of hashes for prefilter. jpayne@69: prefiltersize=0.2 (pff) Fraction of memory to use for prefilter. jpayne@69: minprobprefilter=t (mpp) Use minprob for the prefilter. jpayne@69: prepasses=1 Use this many prefiltering passes; higher be more thorough jpayne@69: if the filter is very full. Set to 'auto' to iteratively jpayne@69: prefilter until the remaining kmers will fit in memory. jpayne@69: jpayne@69: Hashing parameters: jpayne@69: k=31 Kmer length (1 to 31). jpayne@69: prealloc=t Pre-allocate memory rather than dynamically growing; jpayne@69: faster and more memory-efficient. A float fraction (0-1) jpayne@69: may be specified; default is 1. jpayne@69: minprob=0.5 Ignore kmers with overall probability of correctness below this. jpayne@69: minprobmain=t (mpm) Use minprob for the primary kmer counts. jpayne@69: threads=X Spawn X threads (default is number of logical processors). jpayne@69: jpayne@69: Assembly parameters: jpayne@69: mincount=1 (min) Only retain kmers that occur at least this many times. jpayne@69: maxcount=BIG (max) Only retain kmers that occur at most this many times. jpayne@69: requiresamecount (rsc) Only build contigs from kmers with exactly the same count. jpayne@69: rcomp=t Store forward and reverse kmers together. Setting this to jpayne@69: false will only use forward kmers. jpayne@69: 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: } 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="-Xmx14g" jpayne@69: z2="-Xms14g" 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 15000m 84 jpayne@69: z="-Xmx${RAM}m" jpayne@69: z2="-Xms${RAM}m" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: kcompress() { jpayne@69: local CMD="java $EA $EOOM $z $z2 -cp $CP assemble.KmerCompressor $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: kcompress "$@"