Debian Codegraph @

debian/mans/bbduk.sh.1

raw
1 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
2 .TH BBDUK.SH "1" "October 2024" "bbduk.sh 39.11" "User Commands"
3 .SH NAME
4 bbduk.sh \- Filters, trims, or masks reads with kmer matches to an artifact/contaminant file
5 .SH SYNOPSIS
6 .B bbduk.sh
7 \fI\,in=<input file> out=<output file> ref=<contaminant files>\/\fR
8 .SH DESCRIPTION
9 Compares reads to the kmers in a reference dataset, optionally
10 allowing an edit distance. Splits the reads into two outputs \- those that
11 match the reference, and those that don't. Can also trim (remove) the matching
12 parts of the reads rather than binning the reads.
13 Please read bbmap/docs/guides/BBDukGuide.txt for more information.
14 .PP
15 Input may be stdin or a fasta or fastq file, compressed or uncompressed.
16 If you pipe via stdin/stdout, please include the file type; e.g. for gzipped
17 fasta input, set in=stdin.fa.gz
18 .SH OPTIONS
19 .SS Input parameters
20 .TP
21 in=<file>
22 Main input. in=stdin.fq will pipe from stdin.
23 .TP
24 in2=<file>
25 Input for 2nd read of pairs in a different file.
26 .TP
27 ref=<file,file>
28 Comma\-delimited list of reference files.
29 .IP
30 In addition to filenames, you may also use the keywords:
31 adapters, artifacts, phix, lambda, pjet, mtst, kapa
32 .TP
33 literal=<seq,seq>
34 Comma\-delimited list of literal reference sequences.
35 Polymers are also allowed with the 'poly' prefix;
36 for example, 'literal=ATGGT,polyGC' will add both ATGGT
37 and GCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGC \- 32+ of them,
38 enough replicates to ensure that all kmers are present.
39 .TP
40 touppercase=f
41 (tuc) Change all bases upper\-case.
42 .TP
43 interleaved=auto
44 (int) t/f overrides interleaved autodetection.
45 Must be set mainually when streaming fastq input.
46 .TP
47 qin=auto
48 Input quality offset: 33 (Sanger), 64, or auto.
49 .TP
50 reads=\-1
51 If positive, quit after processing X reads or pairs.
52 .TP
53 copyundefined=f
54 (cu) Process non\-AGCT IUPAC reference bases by making all
55 possible unambiguous copies.
56 Intended for short motifs
57 or adapter barcodes, as time/memory use is exponential.
58 .TP
59 samplerate=1
60 Set lower to only process a fraction of input reads.
61 .TP
62 samref=<file>
63 Optional reference fasta for processing sam files.
64 .SS Output parameters
65 .TP
66 out=<file>
67 (outnonmatch) Write reads here that do not contain
68 kmers matching the database.
69 \&'out=stdout.fq' will pipe
70 to standard out.
71 .TP
72 out2=<file>
73 (outnonmatch2) Use this to write 2nd read of pairs to a
74 different file.
75 .TP
76 outm=<file>
77 (outmatch) Write reads here that fail filters. In default
78 kfilter mode, this means any read with a matching kmer.
79 In any mode, it also includes reads that fail filters such
80 as minlength, mingc, maxgc, entropy, etc. In other words,
81 it includes all reads that do not go to 'out'.
82 .TP
83 outm2=<file>
84 (outmatch2) Use this to write 2nd read of pairs to a
85 different file.
86 .TP
87 outs=<file>
88 (outsingle) Use this to write singleton reads whose mate
89 was trimmed shorter than minlen.
90 .TP
91 stats=<file>
92 Write statistics about which contamininants were detected.
93 .TP
94 refstats=<file>
95 Write statistics on a per\-reference\-file basis.
96 .TP
97 rpkm=<file>
98 Write RPKM for each reference sequence (for RNA\-seq).
99 .TP
100 dump=<file>
101 Dump kmer tables to a file, in fasta format.
102 .TP
103 duk=<file>
104 Write statistics in duk's format. *DEPRECATED*
105 .TP
106 nzo=t
107 Only write statistics about ref sequences with nonzero hits.
108 .TP
109 overwrite=t
110 (ow) Grant permission to overwrite files.
111 .TP
112 showspeed=t
113 (ss) 'f' suppresses display of processing speed.
114 .TP
115 ziplevel=2
116 (zl) Compression level; 1 (min) through 9 (max).
117 .TP
118 fastawrap=70
119 Length of lines in fasta output.
120 .TP
121 qout=auto
122 Output quality offset: 33 (Sanger), 64, or auto.
123 .TP
124 statscolumns=3
125 (cols) Number of columns for stats output, 3 or 5.
126 5 includes base counts.
127 .TP
128 rename=f
129 Rename reads to indicate which sequences they matched.
130 .TP
131 refnames=f
132 Use names of reference files rather than scaffold IDs.
133 .TP
134 trd=f
135 Truncate read and ref names at the first whitespace.
136 .TP
137 ordered=f
138 Set to true to output reads in same order as input.
139 .TP
140 maxbasesout=\-1
141 If positive, quit after writing approximately this many
142 bases to out (outu/outnonmatch).
143 .TP
144 maxbasesoutm=\-1
145 If positive, quit after writing approximately this many
146 bases to outm (outmatch).
147 .TP
148 json=f
149 Print to screen in json format.
150 .SS Histogram output parameters
151 .TP
152 bhist=<file>
153 Base composition histogram by position.
154 .TP
155 qhist=<file>
156 Quality histogram by position.
157 .TP
158 qchist=<file>
159 Count of bases with each quality value.
160 .TP
161 aqhist=<file>
162 Histogram of average read quality.
163 .TP
164 bqhist=<file>
165 Quality histogram designed for box plots.
166 .TP
167 lhist=<file>
168 Read length histogram.
169 .TP
170 phist=<file>
171 Polymer length histogram.
172 .TP
173 gchist=<file>
174 Read GC content histogram.
175 .TP
176 enthist=<file>
177 Read entropy histogram.
178 .TP
179 ihist=<file>
180 Insert size histogram, for paired reads in mapped sam.
181 .TP
182 gcbins=100
183 Number gchist bins. Set to 'auto' to use read length.
184 .TP
185 maxhistlen=6000
186 Set an upper bound for histogram lengths; higher uses
187 more memory.
188 The default is 6000 for some histograms
189 and 80000 for others.
190 .SS Histograms for mapped sam/bam files only
191 .TP
192 histbefore=t
193 Calculate histograms from reads before processing.
194 .TP
195 ehist=<file>
196 Errors\-per\-read histogram.
197 .TP
198 qahist=<file>
199 Quality accuracy histogram of error rates versus quality
200 score.
201 .TP
202 indelhist=<file>
203 Indel length histogram.
204 .TP
205 mhist=<file>
206 Histogram of match, sub, del, and ins rates by position.
207 .TP
208 idhist=<file>
209 Histogram of read count versus percent identity.
210 .TP
211 idbins=100
212 Number idhist bins. Set to 'auto' to use read length.
213 .TP
214 varfile=<file>
215 Ignore substitution errors listed in this file when
216 calculating error rates.
217 Can be generated with
218 CallVariants.
219 .TP
220 vcf=<file>
221 Ignore substitution errors listed in this VCF file
222 when calculating error rates.
223 .TP
224 ignorevcfindels=t
225 Also ignore indels listed in the VCF.
226 .SS Processing parameters
227 .TP
228 k=27
229 Kmer length used for finding contaminants. Contaminants
230 shorter than k will not be found.
231 k must be at least 1.
232 .TP
233 rcomp=t
234 Look for reverse\-complements of kmers in addition to
235 forward kmers.
236 .TP
237 maskmiddle=t
238 (mm) Treat the middle base of a kmer as a wildcard, to
239 increase sensitivity in the presence of errors.
240 This may
241 also be set to a number, e.g. mm=3, to mask that many bp.
242 The default mm=t corresponds to mm=1 for odd\-length kmers
243 and mm=2 for even\-length kmers (as of v39.04), while
244 mm=f is always equivalent to mm=0.
245 .TP
246 minkmerhits=1
247 (mkh) Reads need at least this many matching kmers
248 to be considered as matching the reference.
249 .TP
250 minkmerfraction=0.0
251 (mkf) A reads needs at least this fraction of its total
252 kmers to hit a ref, in order to be considered a match.
253 If this and minkmerhits are set, the greater is used.
254 .TP
255 mincovfraction=0.0
256 (mcf) A reads needs at least this fraction of its total
257 bases to be covered by ref kmers to be considered a match.
258 If specified, mcf overrides mkh and mkf.
259 .TP
260 hammingdistance=0
261 (hdist) Maximum Hamming distance for ref kmers (subs only).
262 Memory use is proportional to (3*K)^hdist.
263 .TP
264 qhdist=0
265 Hamming distance for query kmers; impacts speed, not memory.
266 .TP
267 editdistance=0
268 (edist) Maximum edit distance from ref kmers (subs
269 and indels).
270 .IP
271 Memory use is proportional to (8*K)^edist.
272 .TP
273 hammingdistance2=0
274 (hdist2) Sets hdist for short kmers, when using mink.
275 .TP
276 qhdist2=0
277 Sets qhdist for short kmers, when using mink.
278 .TP
279 editdistance2=0
280 (edist2) Sets edist for short kmers, when using mink.
281 .TP
282 forbidn=f
283 (fn) Forbids matching of read kmers containing N.
284 By default, these will match a reference 'A' if
285 hdist>0 or edist>0, to increase sensitivity.
286 .TP
287 removeifeitherbad=t
288 (rieb) Paired reads get sent to 'outmatch' if either is
289 match (or either is trimmed shorter than minlen).
290 Set to false to require both.
291 .TP
292 trimfailures=f
293 Instead of discarding failed reads, trim them to 1bp.
294 .IP
295 This makes the statistics a bit odd.
296 .TP
297 findbestmatch=f
298 (fbm) If multiple matches, associate read with sequence
299 sharing most kmers.
300 Reduces speed.
301 .TP
302 skipr1=f
303 Don't do kmer\-based operations on read 1.
304 .TP
305 skipr2=f
306 Don't do kmer\-based operations on read 2.
307 .TP
308 ecco=f
309 For overlapping paired reads only. Performs errorcorrection with BBMerge prior to kmer operations.
310 .TP
311 recalibrate=f
312 (recal) Recalibrate quality scores. Requires calibration
313 matrices generated by CalcTrueQuality.
314 .TP
315 sam=<file,file>
316 If recalibration is desired, and matrices have not already
317 been generated, BBDuk will create them from the sam file.
318 .TP
319 amino=f
320 Run in amino acid mode. Some features have not been
321 tested, but kmer\-matching works fine.
322 Maximum k is 12.
323 .SS Speed and Memory parameters
324 .TP
325 threads=auto
326 (t) Set number of threads to use; default is number of
327 logical processors.
328 .TP
329 prealloc=f
330 Preallocate memory in table. Allows faster table loading
331 and more efficient memory usage, for a large reference.
332 .TP
333 monitor=f
334 Kill this process if it crashes. monitor=600,0.01 would
335 kill after 600 seconds under 1% usage.
336 .TP
337 minrskip=1
338 (mns) Force minimal skip interval when indexing reference
339 kmers.
340 .IP
341 1 means use all, 2 means use every other kmer, etc.
342 .TP
343 maxrskip=1
344 (mxs) Restrict maximal skip interval when indexing
345 reference kmers. Normally all are used for scaffolds<100kb,
346 but with longer scaffolds, up to maxrskip\-1 are skipped.
347 .TP
348 rskip=
349 Set both minrskip and maxrskip to the same value.
350 .IP
351 If not set, rskip will vary based on sequence length.
352 .TP
353 qskip=1
354 Skip query kmers to increase speed. 1 means use all.
355 .TP
356 speed=0
357 Ignore this fraction of kmer space (0\-15 out of 16) in both
358 reads and reference.
359 Increases speed and reduces memory.
360 .IP
361 Note: Do not use more than one of 'speed', 'qskip', and 'rskip'.
362 .SS Trimming/Filtering/Masking parameters
363 Note \- if ktrim, kmask, and ksplit are unset, the default behavior is kfilter.
364 All kmer processing modes are mutually exclusive.
365 Reads only get sent to 'outm' purely based on kmer matches in kfilter mode.
366 .TP
367 ktrim=f
368 Trim reads to remove bases matching reference kmers, plus
369 all bases to the left or right.
370 .IP
371 Values:
372 .IP
373 f (don't trim),
374 .IP
375 r (trim to the right),
376 .IP
377 l (trim to the left)
378 .TP
379 ktrimtips=0
380 Set this to a positive number to perform ktrim on both
381 ends, examining only the outermost X bases.
382 .TP
383 kmask=
384 Replace bases matching ref kmers with another symbol.
385 .TP
386 Allows any non\-whitespace character, and processes short
387 kmers on both ends if mink is set. 'kmask=lc' will
388 convert masked bases to lowercase.
389 .TP
390 maskfullycovered=f
391 (mfc) Only mask bases that are fully covered by kmers.
392 .TP
393 ksplit=f
394 For single\-ended reads only. Reads will be split into
395 .TP
396 pairs around the kmer.
397 If the kmer is at the end of the
398 .TP
399 read, it will be trimmed instead.
400 Singletons will go to
401 .TP
402 out, and pairs will go to outm.
403 Do not use ksplit with
404 other operations such as quality\-trimming or filtering.
405 .TP
406 mink=0
407 Look for shorter kmers at read tips down to this length,
408 .TP
409 when k\-trimming or masking.
410 0 means disabled. Enabling
411 this will disable maskmiddle.
412 .TP
413 qtrim=f
414 Trim read ends to remove bases with quality below trimq.
415 .TP
416 Performed AFTER looking for kmers.
417 Values:
418 .TP
419 rl (trim both ends),
420 f (neither end),
421 r (right end only),
422 l (left end only),
423 w (sliding window).
424 .TP
425 trimq=6
426 Regions with average quality BELOW this will be trimmed,
427 if qtrim is set to something other than f.
428 Can be a
429 floating\-point number like 7.3.
430 .TP
431 quantize
432 Bin quality scores to reduce file size. quantize=2 will
433 eliminate all odd quality scores, while quantize=0,10,37
434 will only allow qualty scores of 0, 10, or 37.
435 .TP
436 trimclip=f
437 Trim soft\-clipped bases from sam files.
438 .TP
439 minlength=10
440 (ml) Reads shorter than this after trimming will be
441 discarded.
442 Pairs will be discarded if both are shorter.
443 .TP
444 mlf=0
445 (minlengthfraction) Reads shorter than this fraction of
446 original length after trimming will be discarded.
447 .TP
448 maxlength=
449 Reads longer than this after trimming will be discarded.
450 .TP
451 minavgquality=0
452 (maq) Reads with average quality (after trimming) below
453 this will be discarded.
454 .TP
455 maqb=0
456 If positive, calculate maq from this many initial bases.
457 .TP
458 minbasequality=0
459 (mbq) Reads with any base below this quality (after
460 trimming) will be discarded.
461 .TP
462 maxns=\-1
463 If non\-negative, reads with more Ns than this
464 (after trimming) will be discarded.
465 .TP
466 mcb=0
467 (minconsecutivebases) Discard reads without at least
468 this many consecutive called bases.
469 .TP
470 ottm=f
471 (outputtrimmedtomatch) Output reads trimmed to shorter
472 than minlength to outm rather than discarding.
473 .TP
474 tp=0
475 (trimpad) Trim this much extra around matching kmers.
476 .TP
477 tbo=f
478 (trimbyoverlap) Trim adapters based on where paired
479 reads overlap.
480 .TP
481 strictoverlap=t
482 Adjust sensitivity for trimbyoverlap mode.
483 .TP
484 minoverlap=14
485 Require this many bases of overlap for detection.
486 .TP
487 mininsert=40
488 Require insert size of at least this for overlap.
489 Should be reduced to 16 for small RNA sequencing.
490 .TP
491 tpe=f
492 (trimpairsevenly) When kmer right\-trimming, trim both
493 reads to the minimum length of either.
494 .TP
495 forcetrimleft=0
496 (ftl) If positive, trim bases to the left of this position
497 (exclusive, 0\-based).
498 .TP
499 forcetrimright=0
500 (ftr) If positive, trim bases to the right of this position
501 (exclusive, 0\-based).
502 .TP
503 forcetrimright2=0
504 (ftr2) If positive, trim this many bases on the right end.
505 .TP
506 forcetrimmod=0
507 (ftm) If positive, right\-trim length to be equal to zero,
508 modulo this number.
509 .TP
510 restrictleft=0
511 If positive, only look for kmer matches in the
512 leftmost X bases.
513 .TP
514 restrictright=0
515 If positive, only look for kmer matches in the
516 rightmost X bases.
517 .IP
518 NOTE: restrictleft and restrictright are mutually exclusive. If trimming
519 both ends is desired, use ktrimtips.
520 .TP
521 mingc=0
522 Discard reads with GC content below this.
523 .TP
524 maxgc=1
525 Discard reads with GC content above this.
526 .TP
527 gcpairs=t
528 Use average GC of paired reads.
529 Also affects gchist.
530 .TP
531 tossjunk=f
532 Discard reads with invalid characters as bases.
533 .TP
534 swift=f
535 Trim Swift sequences: Trailing C/T/N R1, leading G/A/N R2.
536 .SS Header\-parsing parameters \- these require Illumina headers
537 .TP
538 chastityfilter=f
539 (cf) Discard reads with id containing ' 1:Y:' or ' 2:Y:'.
540 .TP
541 barcodefilter=f
542 Remove reads with unexpected barcodes if barcodes is set,
543
544 or barcodes containing 'N' otherwise.
545 A barcode must be
546 the last part of the read header.
547 .IP
548 Values:
549 .IP
550 t: Remove reads with bad barcodes.
551 .IP
552 f: Ignore barcodes.
553 .IP
554 crash: Crash upon encountering bad barcodes.
555 .TP
556 barcodes=
557 Comma\-delimited list of barcodes or files of barcodes.
558 .TP
559 xmin=\-1
560 If positive, discard reads with a lesser X coordinate.
561 .TP
562 ymin=\-1
563 If positive, discard reads with a lesser Y coordinate.
564 .TP
565 xmax=\-1
566 If positive, discard reads with a greater X coordinate.
567 .TP
568 ymax=\-1
569 If positive, discard reads with a greater Y coordinate.
570 .SS Polymer trimming
571 .TP
572 trimpolya=0
573 If greater than 0, trim poly\-A or poly\-T tails of
574 at least this length on either end of reads.
575 .TP
576 trimpolygleft=0
577 If greater than 0, trim poly\-G prefixes of at least this
578 length on the left end of reads.
579 Does not trim poly\-C.
580 .TP
581 trimpolygright=0
582 If greater than 0, trim poly\-G tails of at least this
583 length on the right end of reads.
584 Does not trim poly\-C.
585 .TP
586 trimpolyg=0
587 This sets both left and right at once.
588 .TP
589 filterpolyg=0
590 If greater than 0, remove reads with a poly\-G prefix of
591 at least this length (on the left).
592 .IP
593 Note: there are also equivalent poly\-C flags.
594 .SS Polymer tracking
595 .TP
596 pratio=base,base
597 \&'pratio=G,C' will print the ratio of G to C polymers.
598 .TP
599 plen=20
600 Length of homopolymers to count.
601 .SS Entropy/Complexity parameters
602 .TP
603 entropy=\-1
604 Set between 0 and 1 to filter reads with entropy below
605 that value.
606 Higher is more stringent.
607 .TP
608 entropywindow=50
609 Calculate entropy using a sliding window of this length.
610 .TP
611 entropyk=5
612 Calculate entropy using kmers of this length.
613 .TP
614 minbasefrequency=0
615 Discard reads with a minimum base frequency below this.
616 .TP
617 entropytrim=f
618 Values:
619 .IP
620 f: (false) Do not entropy\-trim.
621 .IP
622 r: (right) Trim low entropy on the right end only.
623 .IP
624 l: (left) Trim low entropy on the left end only.
625 .IP
626 rl: (both) Trim low entropy on both ends.
627 .TP
628 entropymask=f
629 Values:
630 .IP
631 f: (filter) Discard low\-entropy sequences.
632 .IP
633 t: (true) Mask low\-entropy parts of sequences with N.
634 .IP
635 lc: Change low\-entropy parts of sequences to lowercase.
636 .TP
637 entropymark=f
638 Mark each base with its entropy value. This is on a scale
639 of 0\-41 and is reported as quality scores, so the output
640 should be fastq or fasta+qual.
641 .PP
642 NOTE: If set, entropytrim overrides entropymask.
643 .SS Cardinality estimation
644 .TP
645 cardinality=f
646 (loglog) Count unique kmers using the LogLog algorithm.
647 .TP
648 cardinalityout=f
649 (loglogout) Count unique kmers in output reads.
650 .TP
651 loglogk=31
652 Use this kmer length for counting.
653 .TP
654 loglogbuckets=2048
655 Use this many buckets for counting.
656 .TP
657 khist=<file>
658 Kmer frequency histogram; plots number of kmers versus
659 kmer depth.
660 This is approximate.
661 .TP
662 khistout=<file>
663 Kmer frequency histogram for output reads.
664 .SS Side Channel
665 .TP
666 sideout=<file>
667 Output for aligned reads.
668 .TP
669 sideref=phix
670 Reference for side\-channel alignment; must be a single
671 sequence and virtually repeat\-free at selected k.
672 .TP
673 sidek1=17
674 Kmer length for seeding alignment to reference.
675 .TP
676 sidek2=13
677 Kmer length for seeding alignment of unaligned reads
678 with an aligned mate.
679 .TP
680 sideminid1=0.66
681 Minimum identity to accept individual alignments.
682 .TP
683 sideminid2=0.58
684 Minimum identity for aligning reads with aligned mates.
685 .TP
686 sidemm1=1
687 Middle mask length for sidek1.
688 .TP
689 sidemm2=1
690 Middle mask length for sidek2.
691 .PP
692 Note: The side channel is a special additional output that allows alignment
693 to a secondary reference while also doing trimming. Alignment does not affect
694 whether reads go to the normal outputs (out, outm). The main purpose is to
695 simplify pipelines that need trimmed, aligned phiX reads for recalibration.
696 .SS Java Parameters
697 .TP
698 \fB\-Xmx\fR
699 This will set Java's memory usage, overriding autodetection.
700 .IP
701 \fB\-Xmx20g\fR will
702 specify 20 gigs of RAM, and \fB\-Xmx200m\fR will specify 200 megs.
703 The max is typically 85% of physical memory.
704 .TP
705 \fB\-eoom\fR
706 This flag will cause the process to exit if an
707 out\-of\-memory exception occurs.
708 Requires Java 8u92+.
709 .TP
710 \fB\-da\fR
711 Disable assertions.
712 .SH AUTHOR
713 Written by Brian Bushnell, Last modified October 9, 2024
714 Please contact Brian Bushnell at [email protected] if you encounter any problems.
715 .P
716 This manpage was written by Andreas Tille for the Debian distribution and can be used for any other usage of the program.