Shuffles and groups reads together by their names. A faster alternative to a full query name sort,
collate ensures that reads of the same name are grouped together in contiguous groups, but doesn't make
any guarantees about the order of read names between groups.
The output from this command should be suitable for any operation that requires all reads from the same
template to be grouped together.
Temporary files are written to <prefix>, specified either as the last argument or with the -T option. If
prefix is unspecified then one will be derived from the output filename (-o option). If no output file
was given then the TMPDIR environment variable will be used, and finally if that is unset then "/tmp" is
used.
Conversely, if prefix is specified but no output filename has been given then the output will be written
to <prefix>.<fmt> where <fmt> is appropriate to the file format is use (e.g. "bam" or "cram").
Using -f for fast mode will output only primary alignments that have either the READ1 or READ2 flags set
(but not both). Any other alignment records will be filtered out. The collation will only work
correctly if there are no more than two reads for any given QNAME after filtering.
Fast mode keeps a buffer of alignments in memory so that it can write out most pairs as soon as they are
found instead of storing them in temporary files. This allows collate to avoid some work and so finish
more quickly compared to the standard mode. The number of alignments held can be changed using -r,
storing more alignments uses more memory but increases the number of pairs that can be written early.
While collate normally randomises the ordering of read pairs, fast mode does not. Position-dependent
biases that would normally be broken up can remain in the fast collate output. It is therefore not a
good idea to use fast mode when preparing data for programs that expect randomly ordered paired reads.
For example using fast collate instead of the standard mode may lead to significantly different results
from aligners that estimate library insert sizes on batches of reads.