Home Software Services About Contact usearch manual
fastq_mergepairs command

See also
 
FASTQ files
  Quality scores
  FASTQ format options

Performs merging of paired reads. (This is sometimes called 'assembly' of paired reads, but I find this term confusing because assembly usually refers to making longer contigs, so I prefer to call it merging).

The FASTQ filename for the forward reads (called R1 by Illumina) is specified by the -fastq_mergepairs option, and the reverse read filename (called R2 by Illumina) is specified by the ‑reverse option.

Merged reads are written to -fastqout (for FASTQ) and / or -fastaout (for FASTA). Reads which failed to merge are written to ‑fastqout_notmerged_fwd, -fastqout_notmerged_rev, -fastaout_notmerged_fwd, -fastaout_notmerged_rev. The ‑eetabbedout.output file is a tabbed text file given expected and observed errors in the read pair.

Forward and reverse must be in 1:1 correspondence and must appear in the same order in both files. The labels for the forward and reverse read in a given pair must be identical except for a single position where a '1' appears in the forward read label and a '2' appears in the reverse read label.

The -label_suffix option specifies a string that is appended to the labels of the merged reads.

Option   Description
fastq_minovlen k   Minimum length of the overlap. Default: no minimum.

Note: overlaps shorter than the -minhsp option will fail to align, so this option also has the effect of imposing a minimum overlap. You should therefore set -minhsp to the shortest overlap that you expect in your data. Values less than 8 may cause performance problems, and may cause spurious overlaps.
 

fastq_minmergelen L   Minimum length of the merged read. Default: no minimum.
 
fastq_maxmergelen L   Maximum length of the merged read. Default: no maximum.
 
fastq_maxdiffs d   Maximum number of mismatches allowed in the overlap region. Default: any number of mismatches allowed.
 
fastq_maxgaps n   (v8.0.1616 or later). Maximum number of gaps allowed in the alignment of the overlapping region. Default is 0, because gaps are very rare with Illumina paired reads so gaps are more likely to indicate a misalignment than a read error. Also, the merge is ambiguous in a gapped column: should the base be included or not? There is no Q score to decide which read is better in this case.
 
fastq_maxee e   Discard pairs if the number of expected errors is > e after merging. By default, no expected error filtering is performed. (Requires v8.0.1610 or later. In earlier versions, you can use fastq_filter to perform e.e. filtering on the merged reads).
 
fastq_truncqual q   This option is provided for older Illumina data with "#" tails, it is not recommended for newer reads.

It truncates the forward and reverse reads at the first Q<=q, if present. This truncation is performed before aligning the pair. This option is provided for older Illumina reads where Q=2 was used to indicate a bad tail. For such reads, it is recommended to use ‑fastq_trunqual 2 or higher, as low-quality tails often caused alignments to fail. Default: no quality truncation as this is not needed with newer reads.
 

fastq_minlen L   Minimum length of the forward and reverse read, after truncating per  ‑fastq_truncqual if applicable. Default: no minimum.
 
fastq_allowmergestagger   Allow merge of a pair where the alignment is "staggered" like this:

  --FORWARD
  REVERSE--

By default, pairs with staggered alignments are discarded.

You should always use -fastq_trimstagger if you allow staggered alignments; I don't know of any scenario where you want to keep the overhangs.
 

fastq_trimstagger   Delete "overhangs" in a staggered alignment. In the above example, this would discard RE at the start and RD at the end. In v8.0.1610 and later, staggered alignments are always trimmed and -fastq_trimstagger is ignored.
 
fastqout_notmerged_fwd
fastqout_notmerged_rev
fastaout_notmerged_fwd
fastaout_notmerged_rev

 
  Filenames for forward and reverse reads that are not merged (FASTQ or FASTA  format).
fastq_eeout   Append "ee=xxx;" annotation to the read labels giving the expected errors after merging. (Requires v8.0.1610 or later).
 
alnout   Alignments in human-readable format. (Requires v8.0.1610 or later).
 

Example

usearch -fastq_mergepairs fwd.fastq -reverse rev.fastq -fastqout merged.fastq \
  -fastq_merge_maxee 1.0