Home Software Services About Contact usearch manual
fastx_demux command
Commands > Reads, FASTA/Q files

Performs demultiplexing by assigning reads to samples using index reads or barcodes.

Sample identifiers are added to the read labels. By default, the sample identifier is appended to the read label using sample=xxx; syntax. If the sample_delim option is set, then the new label is the sample identifier followed by the sample_delim string followed by 1, 2, 3...

Sample identifiers are taken from the barcode sequence labels.

The barcodes option is always required. Specifies a FASTA file containing barcode sequences which are matched to the index reads (if -index option is specified) or start of the forward reads (otherwise). The label of a barcode label is used as the sample identifier.

The index option specifies a FASTA or FASTQ file with index reads. If the index option is not specified, the barcodes are assumed to be at the start of the forward reads. Index labels must match the read labels and appear in the same order in both files.

The maxdiffs option specifies the maximum number of differences allowed between an index read and a barcode. Default 0. Allowing differences may tend to increase cross-talk.

The reverse option gives a FASTQ filename for the reverse (R2) reads, if applicable. Sequence labels must match the forward (R1) reads and appear in the same order. The output2 option specifies a FASTQ filename for the demultiplexed reverse reads.

Example: Illumina unpaired with index reads

usearch -fastx_demux fwd.fq -index index.fq -barcodes bar.fa -fastqout reads_demux.fq

Example: Illumina paired with single index (i1 + r1 + r2)

usearch -fastx_demux R1.fq -reverse R2.fq -index I1.fq -barcodes bar.fa \
  -fastqout fwd_demux.fq -output2 rev_demux.fq

Example: 454 with barcodes in the main reads

usearch -fastx_demux reads.fq -barcodes bar.fa -fastqout reads_demux.fq