| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. |
| 2 |
.TH REFORMAT.SH "1" "November 2023" "reformat.sh 39.11" "User Commands" |
| 3 |
.SH NAME |
| 4 |
reformat.sh \- Reformats reads between fasta/fastq/scarf/fasta+qual/sam, interleaved/paired, and ASCII-33/64 |
| 5 |
.SH SYNOPSIS |
| 6 |
.B reformat.sh |
| 7 |
\fI\,in=<file> in2=<file2> out=<outfile> out2=<outfile2>\/\fR |
| 8 |
.SH DESCRIPTION |
| 9 |
Reformats reads to change ASCII quality encoding, interleaving, file format, or compression format. |
| 10 |
Optionally performs additional functions such as quality trimming, subsetting, and subsampling. |
| 11 |
Supports fastq, fasta, fasta+qual, scarf, oneline, sam, bam, gzip, bz2. |
| 12 |
Please read bbmap/docs/guides/ReformatGuide.txt for more information. |
| 13 |
.PP |
| 14 |
in2 and out2 are for paired reads and are optional. |
| 15 |
If input is paired and there is only one output file, it will be written interleaved. |
| 16 |
.SH OPTIONS |
| 17 |
.SS Parameters and their defaults: |
| 18 |
.TP |
| 19 |
ow=f |
| 20 |
(overwrite) Overwrites files that already exist. |
| 21 |
.TP |
| 22 |
app=f |
| 23 |
(append) Append to files that already exist. |
| 24 |
.TP |
| 25 |
zl=4 |
| 26 |
(ziplevel) Set compression level, 1 (low) to 9 (max). |
| 27 |
.TP |
| 28 |
int=f |
| 29 |
(interleaved) Determines whether INPUT file is considered interleaved. |
| 30 |
.TP |
| 31 |
fastawrap=70 |
| 32 |
Length of lines in fasta output. |
| 33 |
.TP |
| 34 |
fastareadlen=0 |
| 35 |
Set to a non\-zero number to break fasta files into reads of at most this length. |
| 36 |
.TP |
| 37 |
fastaminlen=1 |
| 38 |
Ignore fasta reads shorter than this. |
| 39 |
.TP |
| 40 |
qin=auto |
| 41 |
ASCII offset for input quality. May be 33 (Sanger), 64 (Illumina), or auto. |
| 42 |
.TP |
| 43 |
qout=auto |
| 44 |
ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (same as input). |
| 45 |
.TP |
| 46 |
qfake=30 |
| 47 |
Quality value used for fasta to fastq reformatting. |
| 48 |
.TP |
| 49 |
qfin=<.qual file> |
| 50 |
Read qualities from this qual file, for the reads coming from 'in=<fasta file>' |
| 51 |
.TP |
| 52 |
qfin2=<.qual file> |
| 53 |
Read qualities from this qual file, for the reads coming from 'in2=<fasta file>' |
| 54 |
.TP |
| 55 |
qfout=<.qual file> |
| 56 |
Write qualities from this qual file, for the reads going to 'out=<fasta file>' |
| 57 |
.TP |
| 58 |
qfout2=<.qual file> |
| 59 |
Write qualities from this qual file, for the reads coming from 'out2=<fasta file>' |
| 60 |
.TP |
| 61 |
outsingle=<file> |
| 62 |
(outs) If a read is longer than minlength and its mate is shorter, the longer one goes here. |
| 63 |
.TP |
| 64 |
deleteinput=f |
| 65 |
Delete input upon successful completion. |
| 66 |
.TP |
| 67 |
ref=<file> |
| 68 |
Optional reference fasta for sam processing. |
| 69 |
.SS Processing Parameters |
| 70 |
.TP |
| 71 |
verifypaired=f |
| 72 |
(vpair) When true, checks reads to see if the names look paired. Prints an error message if not. |
| 73 |
.TP |
| 74 |
verifyinterleaved=f |
| 75 |
(vint) sets 'vpair' to true and 'interleaved' to true. |
| 76 |
.TP |
| 77 |
allowidenticalnames=f |
| 78 |
(ain) When verifying pair names, allows identical names, instead of requiring \fI\,/1\/\fP and \fI\,/2\/\fP or 1: and 2: |
| 79 |
.TP |
| 80 |
tossbrokenreads=f |
| 81 |
(tbr) Discard reads that have different numbers of bases and qualities. By default this will be detected and cause a crash. |
| 82 |
.TP |
| 83 |
ignorebadquality=f |
| 84 |
(ibq) Fix out\-of\-range quality values instead of crashing with a warning. |
| 85 |
.TP |
| 86 |
addslash=f |
| 87 |
Append ' /1' and ' /2' to read names, if not already present. Please include the flag 'int=t' if the reads are interleaved. |
| 88 |
.TP |
| 89 |
spaceslash=t |
| 90 |
Put a space before the slash in addslash mode. |
| 91 |
.TP |
| 92 |
addcolon=f |
| 93 |
Append ' 1:' and ' 2:' to read names, if not already present. Please include the flag 'int=t' if the reads are interleaved. |
| 94 |
.TP |
| 95 |
underscore=f |
| 96 |
Change whitespace in read names to underscores. |
| 97 |
.TP |
| 98 |
rcomp=f |
| 99 |
(rc) Reverse\-complement reads. |
| 100 |
.TP |
| 101 |
rcompmate=f |
| 102 |
(rcm) Reverse\-complement read 2 only. |
| 103 |
.TP |
| 104 |
comp=f |
| 105 |
(complement) Reverse\-complement reads. |
| 106 |
.TP |
| 107 |
changequality=t |
| 108 |
(cq) N bases always get a quality of 0 and ACGT bases get a min quality of 2. |
| 109 |
.TP |
| 110 |
quantize=f |
| 111 |
Quantize qualities to a subset of values like NextSeq. Can also be used with comma\-delimited list, like quantize=0,8,13,22,27,32,37 |
| 112 |
.TP |
| 113 |
tuc=f |
| 114 |
(touppercase) Change lowercase letters in reads to uppercase. |
| 115 |
.TP |
| 116 |
uniquenames=f |
| 117 |
Make duplicate names unique by appending _<number>. |
| 118 |
.TP |
| 119 |
remap= |
| 120 |
A set of pairs: remap=CTGN will transform C>T and G>N. |
| 121 |
.IP |
| 122 |
Use remap1 and remap2 to specify read 1 or 2. |
| 123 |
.TP |
| 124 |
iupacToN=f |
| 125 |
(itn) Convert non\-ACGTN symbols to N. |
| 126 |
.TP |
| 127 |
monitor=f |
| 128 |
Kill this process if it crashes. monitor=600,0.01 would kill after 600 seconds under 1% usage. |
| 129 |
.TP |
| 130 |
crashjunk=t |
| 131 |
Crash when encountering reads with invalid bases. |
| 132 |
.TP |
| 133 |
tossjunk=f |
| 134 |
Discard reads with invalid characters as bases. |
| 135 |
.TP |
| 136 |
fixjunk=f |
| 137 |
Convert invalid bases to N (or X for amino acids). |
| 138 |
.TP |
| 139 |
dotdashxton=f |
| 140 |
Specifically convert . \- and X to N (or X for amino acids). |
| 141 |
fixheaders=f |
| 142 |
Convert nonstandard header characters to standard ASCII. |
| 143 |
.TP |
| 144 |
recalibrate=f |
| 145 |
(recal) Recalibrate quality scores. Must first generate matrices with CalcTrueQuality. |
| 146 |
.TP |
| 147 |
maxcalledquality=41 |
| 148 |
Quality scores capped at this upper bound. |
| 149 |
.TP |
| 150 |
mincalledquality=2 |
| 151 |
Quality scores of ACGT bases will be capped at lower bound. |
| 152 |
.TP |
| 153 |
trimreaddescription=f |
| 154 |
(trd) Trim the names of reads after the first whitespace. |
| 155 |
.TP |
| 156 |
trimrname=f |
| 157 |
For sam/bam files, trim rname/rnext fields after the first space. |
| 158 |
.TP |
| 159 |
fixheaders=f |
| 160 |
Replace characters in headers such as space, *, and | to make them valid file names. |
| 161 |
.TP |
| 162 |
warnifnosequence=t |
| 163 |
For fasta, issue a warning if a sequenceless header is encountered. |
| 164 |
.TP |
| 165 |
warnfirsttimeonly=t |
| 166 |
Issue a warning for only the first sequenceless header. |
| 167 |
.TP |
| 168 |
utot=f |
| 169 |
Convert U to T (for RNA \-> DNA translation). |
| 170 |
.TP |
| 171 |
padleft=0 |
| 172 |
Pad the left end of sequences with this many symbols. |
| 173 |
.TP |
| 174 |
padright=0 |
| 175 |
Pad the right end of sequences with this many symbols. |
| 176 |
.TP |
| 177 |
pad=0 |
| 178 |
Set padleft and padright to the same value. |
| 179 |
.TP |
| 180 |
padsymbol=N |
| 181 |
Symbol to use for padding. |
| 182 |
.SS Histogram output parameters |
| 183 |
.TP |
| 184 |
bhist=<file> |
| 185 |
Base composition histogram by position. |
| 186 |
.TP |
| 187 |
qhist=<file> |
| 188 |
Quality histogram by position. |
| 189 |
.TP |
| 190 |
qchist=<file> |
| 191 |
Count of bases with each quality value. |
| 192 |
.TP |
| 193 |
aqhist=<file> |
| 194 |
Histogram of average read quality. |
| 195 |
.TP |
| 196 |
bqhist=<file> |
| 197 |
Quality histogram designed for box plots. |
| 198 |
.TP |
| 199 |
lhist=<file> |
| 200 |
Read length histogram. |
| 201 |
.TP |
| 202 |
gchist=<file> |
| 203 |
Read GC content histogram. |
| 204 |
.TP |
| 205 |
gcbins=100 |
| 206 |
Number gchist bins. Set to 'auto' to use read length. |
| 207 |
.TP |
| 208 |
gcplot=f |
| 209 |
Add a graphical representation to the gchist. |
| 210 |
.TP |
| 211 |
maxhistlen=6000 |
| 212 |
Set an upper bound for histogram lengths; higher uses more memory. |
| 213 |
.IP |
| 214 |
The default is 6000 for some histograms and 80000 for others. |
| 215 |
.SS Histograms for sam files only (requires sam format 1.4 or higher): |
| 216 |
.TP |
| 217 |
ehist=<file> |
| 218 |
Errors\-per\-read histogram. |
| 219 |
.TP |
| 220 |
qahist=<file> |
| 221 |
Quality accuracy histogram of error rates versus quality score. |
| 222 |
.TP |
| 223 |
indelhist=<file> |
| 224 |
Indel length histogram. |
| 225 |
.TP |
| 226 |
mhist=<file> |
| 227 |
Histogram of match, sub, del, and ins rates by read location. |
| 228 |
.TP |
| 229 |
ihist=<file> |
| 230 |
Insert size histograms. Requires paired reads in a sam file. |
| 231 |
.TP |
| 232 |
idhist=<file> |
| 233 |
Histogram of read count versus percent identity. |
| 234 |
.TP |
| 235 |
idbins=100 |
| 236 |
Number idhist bins. Set to 'auto' to use read length. |
| 237 |
.SS Sampling parameters |
| 238 |
.TP |
| 239 |
reads=\-1 |
| 240 |
Set to a positive number to only process this many INPUT reads (or pairs), then quit. |
| 241 |
.TP |
| 242 |
skipreads=\-1 |
| 243 |
Skip (discard) this many INPUT reads before processing the rest. |
| 244 |
.TP |
| 245 |
samplerate=1 |
| 246 |
Randomly output only this fraction of reads; 1 means sampling is disabled. |
| 247 |
.TP |
| 248 |
sampleseed=\-1 |
| 249 |
Set to a positive number to use that prng seed for sampling (allowing deterministic sampling). |
| 250 |
.TP |
| 251 |
samplereadstarget=0 |
| 252 |
(srt) Exact number of OUTPUT reads (or pairs) desired. |
| 253 |
.TP |
| 254 |
samplebasestarget=0 |
| 255 |
(sbt) Exact number of OUTPUT bases desired. |
| 256 |
.IP |
| 257 |
Important: srt/sbt flags should not be used with stdin, samplerate, qtrim, minlength, or minavgquality. |
| 258 |
.TP |
| 259 |
upsample=f |
| 260 |
Allow srt/sbt to upsample (duplicate reads) when the target is greater than input. |
| 261 |
.TP |
| 262 |
prioritizelength=f |
| 263 |
If true, calculate a length threshold to reach the target, and retain all reads of at least that length (must set srt or sbt). |
| 264 |
.SS Trimming and filtering parameters |
| 265 |
.TP |
| 266 |
qtrim=f |
| 267 |
Trim read ends to remove bases with quality below trimq. |
| 268 |
.IP |
| 269 |
Values: t (trim both ends), f (neither end), r (right end only), l (left end only), w (sliding window). |
| 270 |
.TP |
| 271 |
trimq=6 |
| 272 |
Regions with average quality BELOW this will be trimmed. Can be a floating\-point number like 7.3. |
| 273 |
.TP |
| 274 |
minlength=0 |
| 275 |
(ml) Reads shorter than this after trimming will be discarded. Pairs will be discarded only if both are shorter. |
| 276 |
.TP |
| 277 |
mlf=0 |
| 278 |
(mlf) Reads shorter than this fraction of original length after trimming will be discarded. |
| 279 |
.TP |
| 280 |
maxlength=0 |
| 281 |
If nonzero, reads longer than this after trimming will be discarded. |
| 282 |
.TP |
| 283 |
breaklength=0 |
| 284 |
If nonzero, reads longer than this will be broken into multiple reads of this length. Does not work for paired reads. |
| 285 |
.TP |
| 286 |
requirebothbad=t |
| 287 |
(rbb) Only discard pairs if both reads are shorter than minlen. |
| 288 |
.TP |
| 289 |
invertfilters=f |
| 290 |
(invert) Output failing reads instead of passing reads. |
| 291 |
.TP |
| 292 |
minavgquality=0 |
| 293 |
(maq) Reads with average quality (after trimming) below this will be discarded. |
| 294 |
.TP |
| 295 |
maqb=0 |
| 296 |
If positive, calculate maq from this many initial bases. |
| 297 |
.TP |
| 298 |
chastityfilter=f |
| 299 |
(cf) Reads with names containing ' 1:Y:' or ' 2:Y:' will be discarded. |
| 300 |
.TP |
| 301 |
barcodefilter=f |
| 302 |
Remove reads with unexpected barcodes if barcodes is set, or barcodes containing 'N' otherwise. |
| 303 |
.IP |
| 304 |
A barcode must be the last part of the read header. |
| 305 |
.TP |
| 306 |
barcodes= |
| 307 |
Comma\-delimited list of barcodes or files of barcodes. |
| 308 |
.TP |
| 309 |
maxns=\-1 |
| 310 |
If 0 or greater, reads with more Ns than this (after trimming) will be discarded. |
| 311 |
.TP |
| 312 |
minconsecutivebases=0 |
| 313 |
(mcb) Discard reads without at least this many consecutive called bases. |
| 314 |
.TP |
| 315 |
forcetrimleft=0 |
| 316 |
(ftl) If nonzero, trim left bases of the read to this position (exclusive, 0\-based). |
| 317 |
.TP |
| 318 |
forcetrimright=\-1 |
| 319 |
(ftr) If nonnegative, trim right bases of the read after this position (exclusive, 0\-based). |
| 320 |
.TP |
| 321 |
forcetrimright2=0 |
| 322 |
(ftr2) If positive, trim this many bases on the right end. |
| 323 |
.TP |
| 324 |
forcetrimmod=5 |
| 325 |
(ftm) If positive, trim length to be equal to zero modulo this number. |
| 326 |
.TP |
| 327 |
mingc=0 |
| 328 |
Discard reads with GC content below this. |
| 329 |
.TP |
| 330 |
maxgc=1 |
| 331 |
Discard reads with GC content above this. |
| 332 |
.TP |
| 333 |
gcpairs=t |
| 334 |
Use average GC of paired reads. |
| 335 |
.IP |
| 336 |
Also affects gchist. |
| 337 |
.SS Tag\-filtering parameters: |
| 338 |
.TP |
| 339 |
tag= |
| 340 |
Look for this tag in the header to filter by the next value. To filter reads |
| 341 |
with a header like 'foo,depth=5.5,bar' where you only want depths |
| 342 |
of at least 3, the necessary flags would be 'tag=depth= minvalue=3 delimiter=,' |
| 343 |
.TP |
| 344 |
delimiter= |
| 345 |
Character after the end of the value, such as delimiter=X. Control and |
| 346 |
whitespace symbols may be spelled out, like delimiter=tab or delimiter=pipe. |
| 347 |
The tag may contain the delimiter. If the value is the last term in the header, |
| 348 |
the delimiter doesn't matter but is still required. |
| 349 |
.TP |
| 350 |
minvalue= |
| 351 |
If set, only accept a numeric value of at least this. |
| 352 |
.TP |
| 353 |
maxvalue= |
| 354 |
If set, only accept a numeric value of at most this. |
| 355 |
.TP |
| 356 |
value= |
| 357 |
If set, only accept a string value of exactly this. |
| 358 |
.SS Illumina\-specific parameters: |
| 359 |
.TP |
| 360 |
top=true |
| 361 |
Include reads from the top of the flowcell. |
| 362 |
.TP |
| 363 |
bottom=true |
| 364 |
Include reads from the bottom of the flowcell. |
| 365 |
.SS Sam and bam processing options: |
| 366 |
.TP |
| 367 |
mappedonly=f |
| 368 |
Toss unmapped reads. |
| 369 |
.TP |
| 370 |
unmappedonly=f |
| 371 |
Toss mapped reads. |
| 372 |
.TP |
| 373 |
pairedonly=f |
| 374 |
Toss reads that are not mapped as proper pairs. |
| 375 |
.TP |
| 376 |
unpairedonly=f |
| 377 |
Toss reads that are mapped as proper pairs. |
| 378 |
.TP |
| 379 |
primaryonly=f |
| 380 |
Toss secondary alignments. Set this to true for sam to fastq conversion. |
| 381 |
.TP |
| 382 |
minmapq=\-1 |
| 383 |
If non\-negative, toss reads with mapq under this. |
| 384 |
.TP |
| 385 |
maxmapq=\-1 |
| 386 |
If non\-negative, toss reads with mapq over this. |
| 387 |
.TP |
| 388 |
requiredbits=0 |
| 389 |
(rbits) Toss sam lines with any of these flag bits unset. Similar to samtools \fB\-f\fR. |
| 390 |
.TP |
| 391 |
filterbits=0 |
| 392 |
(fbits) Toss sam lines with any of these flag bits set. Similar to samtools \fB\-F\fR. |
| 393 |
.TP |
| 394 |
stoptag=f |
| 395 |
Set to true to write a tag indicating read stop location, prefixed by YS:i: |
| 396 |
.TP |
| 397 |
sam= |
| 398 |
Set to 'sam=1.3' to convert '=' and 'X' cigar symbols (from sam 1.4+ format) to 'M'. |
| 399 |
.IP |
| 400 |
Set to 'sam=1.4' to convert 'M' to '=' and 'X' (sam=1.4 requires MD tags to be present, or ref to be specified). |
| 401 |
.SS Sam and bam alignment filtering options: |
| 402 |
These require = and X symbols in cigar strings, or MD tags, or a reference fasta. |
| 403 |
\fB\-1\fR means disabled; to filter reads with any of a symbol type, set to 0. |
| 404 |
.TP |
| 405 |
subfilter=\-1 |
| 406 |
Discard reads with more than this many substitutions. |
| 407 |
.TP |
| 408 |
minsubs=\-1 |
| 409 |
Discard reads with fewer than this many substitutions. |
| 410 |
.TP |
| 411 |
insfilter=\-1 |
| 412 |
Discard reads with more than this many insertions. |
| 413 |
.TP |
| 414 |
delfilter=\-1 |
| 415 |
Discard reads with more than this many deletions. |
| 416 |
.TP |
| 417 |
indelfilter=\-1 |
| 418 |
Discard reads with more than this many indels. |
| 419 |
.TP |
| 420 |
editfilter=\-1 |
| 421 |
Discard reads with more than this many edits. |
| 422 |
.TP |
| 423 |
inslenfilter=\-1 |
| 424 |
Discard reads with an insertion longer than this. |
| 425 |
.TP |
| 426 |
dellenfilter=\-1 |
| 427 |
Discard reads with a deletion longer than this. |
| 428 |
.TP |
| 429 |
minidfilter=\-1.0 |
| 430 |
Discard reads with identity below this (0\-1). |
| 431 |
.TP |
| 432 |
maxidfilter=1.0 |
| 433 |
Discard reads with identity above this (0\-1). |
| 434 |
.TP |
| 435 |
clipfilter=\-1 |
| 436 |
Discard reads with more than this many soft\-clipped bases. |
| 437 |
.SS Kmer counting and cardinality estimation: |
| 438 |
.TP |
| 439 |
k=0 |
| 440 |
If positive, count the total number of kmers. |
| 441 |
.TP |
| 442 |
cardinality=f |
| 443 |
(loglog) Count unique kmers using the LogLog algorithm. |
| 444 |
.TP |
| 445 |
loglogbuckets=1999 |
| 446 |
Use this many buckets for cardinality estimation. |
| 447 |
.SS Shortcuts |
| 448 |
The # symbol will be substituted for 1 and 2. The % symbol in out will be substituted for input name minus extensions. |
| 449 |
For example: |
| 450 |
.IP |
| 451 |
reformat.sh in=read#.fq out=%.fa |
| 452 |
.PP |
| 453 |
\&...is equivalent to: |
| 454 |
.IP |
| 455 |
reformat.sh in1=read1.fq in2=read2.fq out1=read1.fa out2=read2.fa |
| 456 |
.SS Java Parameters |
| 457 |
.TP |
| 458 |
\fB\-Xmx\fR |
| 459 |
This will set Java's memory usage, overriding autodetection. |
| 460 |
.IP |
| 461 |
\fB\-Xmx20g\fR will specify 20 gigs of RAM, and \fB\-Xmx200m\fR will specify 200 megs. |
| 462 |
The max is typically 85% of physical memory. |
| 463 |
.TP |
| 464 |
\fB\-eoom\fR |
| 465 |
This flag will cause the process to exit if an out\-of\-memory exception occurs. Requires Java 8u92+. |
| 466 |
.TP |
| 467 |
\fB\-da\fR |
| 468 |
Disable assertions. |
| 469 |
.SH AUTHOR |
| 470 |
Written by Brian Bushnell (Last modified November 22, 2023) |
| 471 |
.P |
| 472 |
Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 473 |
.P |
| 474 |
This manpage was written by Andreas Tille for the Debian distribution and can be used for any other usage of the program. |