| 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 17GB RAM. |
| 8 | It is designed for NERSC and uses hard-coded paths. |
| 9 | |
| 10 | Description: Removes all reads that map to the human genome with at least 88% identity after quality trimming. |
| 11 | This is more aggressive than removehuman.sh and uses an unmasked human genome reference. |
| 12 | It removes roughly 99.99% of human 2x150bp reads, but may incur false-positive removals. |
| 13 | NOTE! This program uses hard-coded paths and will only run on Nersc systems unless you change the path. |
| 14 | |
| 15 | Usage: removehuman.sh in=<input file> outu=<clean output file> |
| 16 | |
| 17 | Input may be fasta or fastq, compressed or uncompressed. |
| 18 | |
| 19 | Parameters: |
| 20 | threads=auto (t) Set number of threads to use; default is number of logical processors. |
| 21 | overwrite=t (ow) Set to false to force the program to abort rather than overwrite an existing file. |
| 22 | interleaved=auto (int) If true, forces fastq input to be paired and interleaved. |
| 23 | trim=t Trim read ends to remove bases with quality below minq. |
| 24 | Values: t (trim both ends), f (neither end), r (right end only), l (left end only). |
| 25 | untrim=t Undo the trimming after mapping. |
| 26 | minq=4 Trim quality threshold. |
| 27 | ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression level; lower compression is faster. |
| 28 | outm=<file> File to output the reads that mapped to human. |
| 29 | path= Set the path to an indexed human genome. |
| 30 | |
| 31 | ***** All BBMap parameters can be used; run bbmap.sh for more details. ***** |
| 32 | |
| 33 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 34 | " |
| 35 | } |
| 36 | |
| 37 | #This block allows symlinked shellscripts to correctly set classpath. |
| 38 | pushd . > /dev/null |
| 39 | DIR="${BASH_SOURCE[0]}" |
| 40 | while [ -h "$DIR" ]; do |
| 41 | cd "$(dirname "$DIR")" |
| 42 | DIR="$(readlink "$(basename "$DIR")")" |
| 43 | done |
| 44 | cd "$(dirname "$DIR")" |
| 45 | DIR="$(pwd)/" |
| 46 | popd > /dev/null |
| 47 | |
| 48 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 49 | CP="$DIR""current/" |
| 50 | JNI="-Djava.library.path=""$DIR""jni/" |
| 51 | JNI="" |
| 52 | |
| 53 | z="-Xmx16000m" |
| 54 | z2="-Xms16000m" |
| 55 | set=0 |
| 56 | |
| 57 | calcXmx () { |
| 58 | source "$DIR""/calcmem.sh" |
| 59 | setEnvironment |
| 60 | parseXmx "$@" |
| 61 | } |
| 62 | calcXmx "$@" |
| 63 | |
| 64 | function removehuman() { |
| 65 | local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP align2.BBMap minratio=0.75 maxindel=8 bwr=0.22 bw=26 minhits=1 path=/global/cfs/cdirs/bbtools/hg19 build=2 pigz unpigz zl=6 qtrim=r trimq=10 untrim idtag usemodulo printunmappedcount ztd=2 maxsites=1 k=14 tipsearch=0 kfilter=25 bloomfilter $@" |
| 66 | echo $CMD >&2 |
| 67 | eval $CMD |
| 68 | } |
| 69 | |
| 70 | removehuman "$@" |