jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified December 22, 2021 jpayne@69: This script requires at least 52GB RAM. jpayne@69: It is designed for NERSC and uses hard-coded paths. jpayne@69: jpayne@69: Description: Removes all reads that map to the cat, dog, mouse, or human genome with at least 95% identity after quality trimming. jpayne@69: Removes approximately 98.6% of human 2x150bp reads, with zero false-positives to non-animals. jpayne@69: NOTE! This program uses hard-coded paths and will only run on Nersc systems. jpayne@69: jpayne@69: Usage: removecatdogmousehuman.sh in= outu= jpayne@69: jpayne@69: Input may be fasta or fastq, compressed or uncompressed. jpayne@69: jpayne@69: Parameters: jpayne@69: threads=auto (t) Set number of threads to use; default is number of logical processors. jpayne@69: overwrite=t (ow) Set to false to force the program to abort rather than overwrite an existing file. jpayne@69: interleaved=auto (int) If true, forces fastq input to be paired and interleaved. jpayne@69: trim=t Trim read ends to remove bases with quality below minq. jpayne@69: Values: t (trim both ends), f (neither end), r (right end only), l (left end only). jpayne@69: untrim=t Undo the trimming after mapping. jpayne@69: minq=4 Trim quality threshold. jpayne@69: ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression level; lower compression is faster. jpayne@69: outm= File to output the reads that mapped to human. jpayne@69: jpayne@69: ***** All BBMap parameters can be used; run bbmap.sh for more details. ***** 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: JNI="-Djava.library.path=""$DIR""jni/" jpayne@69: JNI="" jpayne@69: jpayne@69: z="-Xmx50g" jpayne@69: z2="-Xms50g" 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: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: function removecatdogmousehuman() { jpayne@69: local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP align2.BBMap minratio=0.9 maxindel=3 bwr=0.16 bw=12 quickmatch fast minhits=2 path=/global/cfs/cdirs/bbtools/mousecatdoghuman/ pigz unpigz zl=6 qtrim=r trimq=10 untrim idtag usemodulo printunmappedcount ztd=2 kfilter=25 maxsites=1 k=14 bloomfilter $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: removecatdogmousehuman "$@"