annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/removemicrobes.sh @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #!/bin/bash
jpayne@69 2
jpayne@69 3 usage(){
jpayne@69 4 echo "
jpayne@69 5 Written by Brian Bushnell
jpayne@69 6 Last modified December 22, 2021
jpayne@69 7 This script requires at least 10GB RAM.
jpayne@69 8 It is designed for NERSC and uses hard-coded paths.
jpayne@69 9
jpayne@69 10 Description: Removes all reads that map to selected common microbial contaminant genomes.
jpayne@69 11 Removes approximately 98.5% of common contaminant reads, with zero false-positives to non-bacteria.
jpayne@69 12 NOTE! This program uses hard-coded paths and will only run on Nersc systems.
jpayne@69 13
jpayne@69 14 Usage: removemicrobes.sh in=<input file> outu=<clean output file>
jpayne@69 15
jpayne@69 16 Input may be fasta or fastq, compressed or uncompressed.
jpayne@69 17
jpayne@69 18 Parameters:
jpayne@69 19 in=<file> Input reads. Should already be adapter-trimmed.
jpayne@69 20 outu=<file> Destination for clean reads.
jpayne@69 21 outm=<file> Optional destination for contaminant reads.
jpayne@69 22 threads=auto (t) Set number of threads to use; default is number of logical processors.
jpayne@69 23 overwrite=t (ow) Set to false to force the program to abort rather than overwrite an existing file.
jpayne@69 24 interleaved=auto (int) If true, forces fastq input to be paired and interleaved.
jpayne@69 25 trim=t Trim read ends to remove bases with quality below minq.
jpayne@69 26 Values: t (trim both ends), f (neither end), r (right end only), l (left end only).
jpayne@69 27 untrim=t Undo the trimming after mapping.
jpayne@69 28 minq=4 Trim quality threshold.
jpayne@69 29 ziplevel=6 (zl) Set to 1 (lowest) through 9 (max) to change compression level; lower compression is faster.
jpayne@69 30
jpayne@69 31 build=1 Choses which masking mode was used:
jpayne@69 32 1 is most stringent and should be used for bacteria.
jpayne@69 33 2 uses fewer bacteria for masking (only RefSeq references).
jpayne@69 34 3 is only masked for plastids and entropy, for use on anything except bacteria.
jpayne@69 35 4 is unmasked.
jpayne@69 36
jpayne@69 37 ***** All BBMap parameters can be used; run bbmap.sh for more details. *****
jpayne@69 38
jpayne@69 39 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
jpayne@69 40 "
jpayne@69 41 }
jpayne@69 42
jpayne@69 43 #This block allows symlinked shellscripts to correctly set classpath.
jpayne@69 44 pushd . > /dev/null
jpayne@69 45 DIR="${BASH_SOURCE[0]}"
jpayne@69 46 while [ -h "$DIR" ]; do
jpayne@69 47 cd "$(dirname "$DIR")"
jpayne@69 48 DIR="$(readlink "$(basename "$DIR")")"
jpayne@69 49 done
jpayne@69 50 cd "$(dirname "$DIR")"
jpayne@69 51 DIR="$(pwd)/"
jpayne@69 52 popd > /dev/null
jpayne@69 53
jpayne@69 54 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
jpayne@69 55 CP="$DIR""current/"
jpayne@69 56 JNI="-Djava.library.path=""$DIR""jni/"
jpayne@69 57 JNI=""
jpayne@69 58
jpayne@69 59 z="-Xmx6000m"
jpayne@69 60 z2="-Xms6000m"
jpayne@69 61 set=0
jpayne@69 62
jpayne@69 63 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
jpayne@69 64 usage
jpayne@69 65 exit
jpayne@69 66 fi
jpayne@69 67
jpayne@69 68 calcXmx () {
jpayne@69 69 source "$DIR""/calcmem.sh"
jpayne@69 70 setEnvironment
jpayne@69 71 parseXmx "$@"
jpayne@69 72 }
jpayne@69 73 calcXmx "$@"
jpayne@69 74
jpayne@69 75 function removemicrobes() {
jpayne@69 76 local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP align2.BBMap strictmaxindel=4 bwr=0.16 bw=12 ef=0.001 minhits=2 path=/global/cfs/cdirs/bbtools/commonMicrobes pigz unpigz zl=6 qtrim=r trimq=10 untrim idtag printunmappedcount ztd=2 kfilter=25 maxsites=1 k=13 minid=0.95 idfilter=0.95 minhits=2 build=1 bloomfilter $@"
jpayne@69 77 echo $CMD >&2
jpayne@69 78 eval $CMD
jpayne@69 79 }
jpayne@69 80
jpayne@69 81 removemicrobes "$@"