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