REFORMAT.SH(1)

๐Ÿ“ฆ
version 39.20 ยท 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ 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) to 9 (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 be 33 (Sanger), 64 (Illumina), or auto.
  • qout=auto โ€” ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (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 from in=<fasta file>
  • qfin2=<.qual file> โ€” Read qualities from this qual file, for the reads coming from in2=<fasta file>
  • qfout=<.qual file> โ€” Write qualities from this qual file, for the reads going to out=<fasta file>
  • qfout2=<.qual file> โ€” Write qualities from this qual file, for the reads coming from out2=<fasta file>
  • outsingle=<file> โ€” (outs) If a read is longer than minlength and its mate is shorter, the longer one goes here. main character gets her own file ๐Ÿ‘‘
  • deleteinput=f โ€” Delete input upon successful completion. ๐Ÿ—‘๏ธ gone girl
  • ref=<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) sets vpair to true and interleaved to true.
  • allowidenticalnames=f โ€” (ain) When verifying pair names, allows identical names, instead of requiring /1 and /2 or 1: and 2:
  • 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 up
  • ignorebadquality=f โ€” (ibq) Fix out-of-range quality values instead of crashing with a warning.
  • addslash=f โ€” Append /1 and /2 to read names, if not already present. Please include the flag int=t if the reads are interleaved.
  • spaceslash=t โ€” Put a space before the slash in addslash mode.
  • addcolon=f โ€” Append 1: and 2: to read names, if not already present. Please include the flag int=t if 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 of 0 and ACGT bases get a min quality of 2.
  • quantize=f โ€” 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
  • tuc=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=CTGN will transform C>T and G>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.01 would kill after 600 seconds under 1% 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 . - and X to 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, trim rname/rnext fields 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 โ€” Set padleft and padright to 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 โ€” Number gchist bins. Set to auto to use read length.
  • gcplot=f โ€” Add a graphical representation to the gchist.
  • maxhistlen=6000 โ€” Set an upper bound for histogram lengths; higher uses more memory.
๐Ÿซถ The default is 6000 for some histograms and 80000 for 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 โ€” Number idhist bins. Set to auto to 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; 1 means 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/sbt flags should not be used with stdin, samplerate, qtrim, minlength, or minavgquality. bestie do NOT mix those, it's giving chaos ๐Ÿ˜ญ
  • upsample=f โ€” Allow srt/sbt to 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 set srt or sbt).

โœ‚๏ธ Trimming and filtering parameters

  • qtrim=f โ€” Trim read ends to remove bases with quality below trimq.

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 like 7.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 than minlen.
  • 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, calculate maq from this many initial bases.
  • chastityfilter=f โ€” (cf) Reads with names containing 1:Y: or 2:Y: will be discarded.
  • barcodefilter=f โ€” Remove reads with unexpected barcodes if barcodes is set, or barcodes containing N otherwise.

A barcode must be the last part of the read header.

  • barcodes= โ€” Comma-delimited list of barcodes or files of barcodes.
  • maxns=-1 โ€” If 0 or 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 with gchist, 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 like foo,depth=5.5,bar and you only want depths of at least 3 โ€” the flags you'd need are tag=depth= minvalue=3 delimiter=, โœจ
  • delimiter= โ€” the character that comes after the end of the value, like delimiter=X. Control and whitespace symbols can be spelled out, like delimiter=tab or delimiter=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 to true for 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 โ€” (aka rbits) toss sam lines with any of these flag bits unset. Basically the same energy as samtools -f ๐Ÿซถ
  • filterbits=0 โ€” (aka fbits) toss sam lines with any of these flag bits set. Basically the same energy as samtools -F ๐Ÿซถ
  • stoptag=f โ€” set to true to write a tag indicating read stop location, prefixed by YS:i: ๐Ÿ›‘
  • sam= โ€” set it to sam=1.3 to convert = and X cigar symbols (from sam 1.4+ format) to M.

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 substitutions
  • minsubs=-1 โ€” discard reads with fewer than this many substitutions
  • insfilter=-1 โ€” discard reads with more than this many insertions
  • delfilter=-1 โ€” discard reads with more than this many deletions
  • indelfilter=-1 โ€” discard reads with more than this many indels
  • editfilter=-1 โ€” discard reads with more than this many edits
  • inslenfilter=-1 โ€” discard reads with an insertion longer than this
  • dellenfilter=-1 โ€” discard reads with a deletion longer than this
  • minidfilter=-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 โ€” (aka loglog) 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 -Xmx20g means 20 gigs of RAM, and -Xmx200m means 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