Debian Codegraph @

bbmask.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified October 17, 2017
7
8 Description: Masks sequences of low-complexity, or containing repeat kmers, or covered by mapped reads.
9 By default this program will mask using entropy with a window=80 and entropy=0.75
10 Please read bbmap/docs/guides/BBMaskGuide.txt for more information.
11
12 Usage: bbmask.sh in=<file> out=<file> sam=<file,file,...file>
13
14 Input may be stdin or a fasta or fastq file, raw or gzipped.
15 sam is optional, but may be a comma-delimited list of sam files to mask.
16 Sam files may also be used as arguments without sam=, so you can use *.sam for example.
17 If you pipe via stdin/stdout, please include the file type; e.g. for gzipped fasta input, set in=stdin.fa.gz
18
19 Input parameters:
20 in=<file> Input sequences to mask. 'in=stdin.fa' will pipe from standard in.
21 sam=<file,file> Comma-delimited list of sam files. Optional. Their mapped coordinates will be masked.
22 touppercase=f (tuc) Change all letters to upper-case.
23 interleaved=auto (int) If true, forces fastq input to be paired and interleaved.
24 qin=auto ASCII offset for input quality. May be 33 (Sanger), 64 (Illumina), or auto.
25
26 Output parameters:
27 out=<file> Write masked sequences here. 'out=stdout.fa' will pipe to standard out.
28 overwrite=t (ow) Set to false to force the program to abort rather than overwrite an existing file.
29 ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression level; lower compression is faster.
30 fastawrap=70 Length of lines in fasta output.
31 qout=auto ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (same as input).
32
33 Processing parameters:
34 threads=auto (t) Set number of threads to use; default is number of logical processors.
35 maskrepeats=f (mr) Mask areas covered by exact repeat kmers.
36 kr=5 Kmer size to use for repeat detection (1-15). Use minkr and maxkr to sweep a range of kmers.
37 minlen=40 Minimum length of repeat area to mask.
38 mincount=4 Minimum number of repeats to mask.
39 masklowentropy=t (mle) Mask areas with low complexity by calculating entropy over a window for a fixed kmer size.
40 ke=5 Kmer size to use for entropy calculation (1-15). Use minke and maxke to sweep a range. Large ke uses more memory.
41 window=80 (w) Window size for entropy calculation.
42 entropy=0.70 (e) Mask windows with entropy under this value (0-1). 0.0001 will mask only homopolymers and 1 will mask everything.
43 lowercase=f (lc) Convert masked bases to lower case. Default is to convert them to N.
44 split=f Split into unmasked pieces and discard masked pieces.
45
46 Coverage parameters (only relevant if sam files are specified):
47 mincov=-1 If nonnegative, mask bases with coverage outside this range.
48 maxcov=-1 If nonnegative, mask bases with coverage outside this range.
49 delcov=t Include deletions when calculating coverage.
50 NOTE: If neither mincov nor maxcov are set, all covered bases will be masked.
51
52 Other parameters:
53 pigz=t Use pigz to compress. If argument is a number, that will set the number of pigz threads.
54 unpigz=t Use pigz to decompress.
55
56 Java Parameters:
57 -Xmx This will set Java's memory usage, overriding autodetection.
58 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
59 The max is typically 85% of physical memory.
60 -eoom This flag will cause the process to exit if an
61 out-of-memory exception occurs. Requires Java 8u92+.
62 -da Disable assertions.
63
64 Please contact Brian Bushnell at [email protected] if you encounter any problems.
65 "
66 }
67
68 #This block allows symlinked shellscripts to correctly set classpath.
69 pushd . > /dev/null
70 DIR="${BASH_SOURCE[0]}"
71 while [ -h "$DIR" ]; do
72 cd "$(dirname "$DIR")"
73 DIR="$(readlink "$(basename "$DIR")")"
74 done
75 cd "$(dirname "$DIR")"
76 DIR="$(pwd)/"
77 popd > /dev/null
78
79 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
80 CP="$DIR""current/"
81
82 z="-Xmx1g"
83 z2="-Xms1g"
84 set=0
85
86 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
87 usage
88 exit
89 fi
90
91 calcXmx () {
92 source "$DIR""/calcmem.sh"
93 setEnvironment
94 parseXmx "$@"
95 if [[ $set == 1 ]]; then
96 return
97 fi
98 freeRam 3200m 84
99 z="-Xmx${RAM}m"
100 z2="-Xms${RAM}m"
101 }
102 calcXmx "$@"
103
104 bbmask() {
105 local CMD="java $EA $EOOM $z $z2 -cp $CP jgi.BBMask $@"
106 echo $CMD >&2
107 eval $CMD
108 }
109
110 bbmask "$@"