REFORMAT.SH(1)
โจ REFORMAT.SH(1) โจ โ the reformat.sh manual, but make it a group chat
okay so this is the manual page for reformat.sh, sitting in the User Commands section, and honestly? she's the makeover artist of the read world ๐
๐ NAME ๐
reformat.sh โ reformats reads between fasta/fastq/scarf/fasta+qual/sam, interleaved/paired, and ASCII-33/64. periodt.
๐ธ SYNOPSIS ๐ธ
reformat.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2>
๐ฆ DESCRIPTION ๐ฆ
Bestie, this tool reformats your reads so you can change the ASCII quality encoding, the interleaving, the file format, or the compression format. Like a whole glow-up for your files, no cap.
And if that wasn't enough, she can optionally do extra side quests too โ quality trimming, subsetting, and subsampling. She supports fastq, fasta, fasta+qual, scarf, oneline, sam, bam, gzip, bz2. iconic.
๐ Please read bbmap/docs/guides/ReformatGuide.txt for more information. fr fr, go read it.
in2 and out2 are for paired reads and they're optional. And here's the tea: if your input is paired and you only give one output file, it gets written interleaved. ๐
โจ OPTIONS โจ
๐ Parameters and their defaults:
ow=fโ (overwrite) Overwrites files that already exist. so rude, but okay.app=fโ (append) Append to files that already exist. adding to the group chat instead of starting fresh ๐ฌzl=4โ (ziplevel) Set compression level,1(low) to9(max). crank it up if you're feeling spicy ๐ฅint=fโ (interleaved) Determines whether INPUT file is considered interleaved.fastawrap=70โ Length of lines in fasta output.fastareadlen=0โ Set to a non-zero number to break fasta files into reads of at most this length.fastaminlen=1โ Ignore fasta reads shorter than this. sorry short king ๐qin=autoโ ASCII offset for input quality. May be33(Sanger),64(Illumina), orauto.qout=autoโ ASCII offset for output quality. May be33(Sanger),64(Illumina), orauto(same as input).qfake=30โ Quality value used for fasta to fastq reformatting.qfin=<.qual file>โ Read qualities from this qual file, for the reads coming fromin=<fasta file>qfin2=<.qual file>โ Read qualities from this qual file, for the reads coming fromin2=<fasta file>qfout=<.qual file>โ Write qualities from this qual file, for the reads going toout=<fasta file>qfout2=<.qual file>โ Write qualities from this qual file, for the reads coming fromout2=<fasta file>outsingle=<file>โ (outs) If a read is longer thanminlengthand its mate is shorter, the longer one goes here. main character gets her own file ๐deleteinput=fโ Delete input upon successful completion. ๐๏ธ gone girlref=<file>โ Optional reference fasta for sam processing.
๐ง Processing Parameters
verifypaired=fโ (vpair) When true, checks reads to see if the names look paired. Prints an error message if not. the vibe check for read names โจverifyinterleaved=fโ (vint) setsvpairto true andinterleavedto true.allowidenticalnames=fโ (ain) When verifying pair names, allows identical names, instead of requiring/1and/2or1:and2:tossbrokenreads=fโ (tbr) Discard reads that have different numbers of bases and qualities. By default this will be detected and cause a crash. ๐ yeah she crashes, heads upignorebadquality=fโ (ibq) Fix out-of-range quality values instead of crashing with a warning.addslash=fโ Append/1and/2to read names, if not already present. Please include the flagint=tif the reads are interleaved.spaceslash=tโ Put a space before the slash inaddslashmode.addcolon=fโ Append1:and2:to read names, if not already present. Please include the flagint=tif the reads are interleaved.underscore=fโ Change whitespace in read names to underscores.rcomp=fโ (rc) Reverse-complement reads.rcompmate=fโ (rcm) Reverse-complement read 2 only.comp=fโ (complement) Reverse-complement reads.changequality=tโ (cq) N bases always get a quality of0and ACGT bases get a min quality of2.quantize=fโ Quantize qualities to a subset of values like NextSeq. Can also be used with comma-delimited list, likequantize=0,8,13,22,27,32,37tuc=fโ (touppercase) Change lowercase letters in reads to uppercase. LOUDER FOR THE PEOPLE IN THE BACK ๐ฃuniquenames=fโ Make duplicate names unique by appending_<number>.remap=โ A set of pairs:remap=CTGNwill transformC>TandG>N.
Use remap1 and remap2 to specify read 1 or 2.
iupacToN=fโ (itn) Convert non-ACGTN symbols to N.monitor=fโ Kill this process if it crashes.monitor=600,0.01would kill after600seconds under1%usage.crashjunk=tโ Crash when encountering reads with invalid bases.tossjunk=fโ Discard reads with invalid characters as bases.fixjunk=fโ Convert invalid bases to N (or X for amino acids).dotdashxton=fโ Specifically convert.-andXto N (or X for amino acids).fixheaders=fโ Convert nonstandard header characters to standard ASCII.recalibrate=fโ (recal) Recalibrate quality scores. Must first generate matrices with CalcTrueQuality.maxcalledquality=41โ Quality scores capped at this upper bound.mincalledquality=2โ Quality scores of ACGT bases will be capped at lower bound.trimreaddescription=fโ (trd) Trim the names of reads after the first whitespace.trimrname=fโ For sam/bam files, trimrname/rnextfields after the first space.fixheaders=fโ Replace characters in headers such as space,*, and|to make them valid file names.warnifnosequence=tโ For fasta, issue a warning if a sequenceless header is encountered.warnfirsttimeonly=tโ Issue a warning for only the first sequenceless header.utot=fโ Convert U to T (for RNA -> DNA translation).padleft=0โ Pad the left end of sequences with this many symbols.padright=0โ Pad the right end of sequences with this many symbols.pad=0โ Setpadleftandpadrightto the same value.padsymbol=Nโ Symbol to use for padding.
๐ Histogram output parameters
bhist=<file>โ Base composition histogram by position.qhist=<file>โ Quality histogram by position.qchist=<file>โ Count of bases with each quality value.aqhist=<file>โ Histogram of average read quality.bqhist=<file>โ Quality histogram designed for box plots.lhist=<file>โ Read length histogram.gchist=<file>โ Read GC content histogram.gcbins=100โ Numbergchistbins. Set toautoto use read length.gcplot=fโ Add a graphical representation to thegchist.maxhistlen=6000โ Set an upper bound for histogram lengths; higher uses more memory.
๐ซถ The default is6000for some histograms and80000for others. yes, it's giving inconsistent, but that's just how she is.
๐ฌ Histograms for sam files only (requires sam format 1.4 or higher):
ehist=<file>โ Errors-per-read histogram.qahist=<file>โ Quality accuracy histogram of error rates versus quality score.indelhist=<file>โ Indel length histogram.mhist=<file>โ Histogram of match, sub, del, and ins rates by read location.ihist=<file>โ Insert size histograms. Requires paired reads in a sam file.idhist=<file>โ Histogram of read count versus percent identity.idbins=100โ Numberidhistbins. Set toautoto use read length.
๐ฒ Sampling parameters
reads=-1โ Set to a positive number to only process this many INPUT reads (or pairs), then quit.skipreads=-1โ Skip (discard) this many INPUT reads before processing the rest.samplerate=1โ Randomly output only this fraction of reads;1means sampling is disabled.sampleseed=-1โ Set to a positive number to use that prng seed for sampling (allowing deterministic sampling).samplereadstarget=0โ (srt) Exact number of OUTPUT reads (or pairs) desired.samplebasestarget=0โ (sbt) Exact number of OUTPUT bases desired.
โ ๏ธ Important:srt/sbtflags should not be used with stdin,samplerate,qtrim,minlength, orminavgquality. bestie do NOT mix those, it's giving chaos ๐ญ
upsample=fโ Allowsrt/sbtto upsample (duplicate reads) when the target is greater than input.prioritizelength=fโ If true, calculate a length threshold to reach the target, and retain all reads of at least that length (must setsrtorsbt).
โ๏ธ Trimming and filtering parameters
qtrim=fโ Trim read ends to remove bases with quality belowtrimq.
Values: t (trim both ends), f (neither end), r (right end only), l (left end only), w (sliding window).
trimq=6โ Regions with average quality BELOW this will be trimmed. Can be a floating-point number like7.3.minlength=0โ (ml) Reads shorter than this after trimming will be discarded. Pairs will be discarded only if both are shorter.mlf=0โ (mlf) Reads shorter than this fraction of original length after trimming will be discarded.maxlength=0โ If nonzero, reads longer than this after trimming will be discarded.breaklength=0โ If nonzero, reads longer than this will be broken into multiple reads of this length. Does not work for paired reads. sorry paired girlies ๐requirebothbad=tโ (rbb) Only discard pairs if both reads are shorter thanminlen.invertfilters=fโ (invert) Output failing reads instead of passing reads.minavgquality=0โ (maq) Reads with average quality (after trimming) below this will be discarded.maqb=0โ If positive, calculatemaqfrom this many initial bases.chastityfilter=fโ (cf) Reads with names containing1:Y:or2:Y:will be discarded.barcodefilter=fโ Remove reads with unexpected barcodes ifbarcodesis set, or barcodes containingNotherwise.
A barcode must be the last part of the read header.
barcodes=โ Comma-delimited list of barcodes or files of barcodes.maxns=-1โ If0or greater, reads with more Ns than this (after trimming) will be discarded.minconsecutivebases=0โ (mcb) Discard reads without at least this many consecutive called bases.forcetrimleft=0โ (ftl) If nonzero, trim left bases of the read to this position (exclusive, 0-based).forcetrimright=-1โ (ftr) If nonnegative, trim right bases of the read after this position (exclusive, 0-based).forcetrimright2=0โ (ftr2) If positive, trim this many bases on the right end.forcetrimmod=5โ (ftm) If positive, trim length to be equal to zero modulo this number.mingc=0โ Discard reads with GC content below this.maxgc=1โ Discard reads with GC content above this.
gcpairs=tโ use the average GC of paired reads ๐ (yes, it also messes withgchist, fyi)
๐ท๏ธ Tag-filtering parameters
tag=โ the tag you want to hunt for in the header, so the next value can filter on it. Say your reads have a header likefoo,depth=5.5,barand you only want depths of at least 3 โ the flags you'd need aretag=depth= minvalue=3 delimiter=,โจdelimiter=โ the character that comes after the end of the value, likedelimiter=X. Control and whitespace symbols can be spelled out, likedelimiter=tabordelimiter=pipe๐. Heads up: the tag itself may contain the delimiter. And if the value is the last term in the header, the delimiter doesn't actually matter โ but it's still required, so don't skip it ๐minvalue=โ if you set it, only numeric values at least this big get accepted.maxvalue=โ if you set it, only numeric values at most this big get accepted.value=โ if you set it, only a string value exactly this gets accepted.
๐ Illumina-specific parameters
top=trueโ include reads from the top of the flowcell โฌ๏ธbottom=trueโ include reads from the bottom of the flowcell โฌ๏ธ
๐งฌ Sam and bam processing options
mappedonly=fโ toss unmapped reads ๐๏ธunmappedonly=fโ toss mapped reads ๐๏ธpairedonly=fโ toss reads that are not mapped as proper pairs ๐unpairedonly=fโ toss reads that are mapped as proper pairs ๐primaryonly=fโ toss secondary alignments. Set this totruefor sam-to-fastq conversion ๐minmapq=-1โ if non-negative, toss reads with mapq under this ๐maxmapq=-1โ if non-negative, toss reads with mapq over this ๐requiredbits=0โ (akarbits) toss sam lines with any of these flag bits unset. Basically the same energy assamtools -f๐ซถfilterbits=0โ (akafbits) toss sam lines with any of these flag bits set. Basically the same energy assamtools -F๐ซถstoptag=fโ set totrueto write a tag indicating read stop location, prefixed byYS:i:๐sam=โ set it tosam=1.3to convert=andXcigar symbols (from sam 1.4+ format) toM.
Set it to sam=1.4 to convert M to = and X (heads up, sam=1.4 requires MD tags to be present, or ref to be specified) โ ๏ธ
๐ Sam and bam alignment filtering options
These need = and X symbols in cigar strings, or MD tags, or a reference fasta, okay bestie? And -1 means disabled; but if you want to filter reads with any of a symbol type, set it to 0 โจ
subfilter=-1โ discard reads with more than this many substitutionsminsubs=-1โ discard reads with fewer than this many substitutionsinsfilter=-1โ discard reads with more than this many insertionsdelfilter=-1โ discard reads with more than this many deletionsindelfilter=-1โ discard reads with more than this many indelseditfilter=-1โ discard reads with more than this many editsinslenfilter=-1โ discard reads with an insertion longer than thisdellenfilter=-1โ discard reads with a deletion longer than thisminidfilter=-1.0โ discard reads with identity below this (range is 0-1) ๐maxidfilter=1.0โ discard reads with identity above this (range is 0-1) ๐clipfilter=-1โ discard reads with more than this many soft-clipped bases โ๏ธ
๐ข Kmer counting and cardinality estimation
k=0โ if positive, count the total number of kmers ๐งฎcardinality=fโ (akaloglog) count unique kmers using the LogLog algorithm โจloglogbuckets=1999โ use this many buckets for cardinality estimation ๐ชฃ
โก Shortcuts
The # symbol gets substituted for 1 and 2 ๐ And the % symbol in out gets substituted for the input name minus extensions. Like, for example:
reformat.sh in=read#.fq out=%.fa
...is literally the same as:
reformat.sh in1=read1.fq in2=read2.fq out1=read1.fa out2=read2.fa
โ Java Parameters
-Xmxโ this sets Java's memory usage, overriding autodetection. So-Xmx20gmeans 20 gigs of RAM, and-Xmx200mmeans 200 megs. The max is typically 85% of physical memory ๐ง-eoomโ this flag makes the process exit if an out-of-memory exception occurs. Requires Java 8u92+ โ ๏ธ-daโ disable assertions.
๐ AUTHOR
Written by Brian Bushnell (Last modified November 22, 2023).
Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems ๐ซถ
This manpage was written by Andreas Tille for the Debian distribution and can be used for any other usage of the program ๐
okay that's the whole thing bestie, you're officially a reformat.sh expert now ๐
this page is from reformat.sh 39.11, dated November 2023, and it's REFORMAT.SH(1) โ go slay some reads โจ๐ฆ
๐ฆ where this page comes from
- debian trixie: bbmap 39.20+dfsg-2 ยท BSD-3-Clause
- ubuntu questing: bbmap 39.20+dfsg-2
- ubuntu resolute: bbmap 39.20+dfsg-3 ยท BSD-3-Clause
- ubuntu stonking: bbmap 39.20+dfsg-3 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms