jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified January 13, 2022 jpayne@69: Description: Shreds sequences into shorter, potentially overlapping sequences. jpayne@69: jpayne@69: Usage: shred.sh in= out= length= minlength= overlap= jpayne@69: jpayne@69: in= Input sequences. jpayne@69: out= Destination of output shreds. jpayne@69: length=500 Desired length of shreds. jpayne@69: minlength=1 Shortest allowed shred. The last shred of each input sequence may be shorter than desired length. jpayne@69: overlap=0 Amount of overlap between successive reads. jpayne@69: reads=-1 If nonnegative, stop after this many input sequences. jpayne@69: equal=f Shred each sequence into subsequences of equal size of at most 'length', instead of a fixed size. jpayne@69: median=0 If nonzero, randomly shred reads to a length with this median. jpayne@69: variance=0 If median is nonzero, shred to lengths of median +-variance. jpayne@69: qfake=30 Quality score, if using fastq output. 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="-Xmx1400m" 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: stats() { jpayne@69: local CMD="java $EA $EOOM $z -cp $CP jgi.Shred $@" jpayne@69: # echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: stats "$@"