File: samtools-collate.1

package info (click to toggle)
samtools 1.21-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 21,804 kB
  • sloc: ansic: 33,931; perl: 7,702; sh: 452; makefile: 298; java: 158
file content (142 lines) | stat: -rw-r--r-- 5,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
'\" t
.TH samtools-collate 1 "12 September 2024" "samtools-1.21" "Bioinformatics tools"
.SH NAME
samtools collate \- shuffles and groups reads together by their names
.\"
.\" Copyright (C) 2008-2011, 2013-2018, 2023 Genome Research Ltd.
.\" Portions copyright (C) 2010, 2011 Broad Institute.
.\"
.\" Author: Heng Li <lh3@sanger.ac.uk>
.\" Author: Joshua C. Randall <jcrandall@alum.mit.edu>
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
.\" copy of this software and associated documentation files (the "Software"),
.\" to deal in the Software without restriction, including without limitation
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
.\" and/or sell copies of the Software, and to permit persons to whom the
.\" Software is furnished to do so, subject to the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
.\" DEALINGS IN THE SOFTWARE.
.
.\" For code blocks and examples (cf groff's Ultrix-specific man macros)
.de EX

.  in +\\$1
.  nf
.  ft CR
..
.de EE
.  ft
.  fi
.  in

..
.
.SH SYNOPSIS
.PP
samtools collate
.RI [ options ]
.IR in.sam | in.bam | in.cram " [" <prefix> "]"

.SH DESCRIPTION
.PP
Shuffles and groups reads together by their names.
A faster alternative to a full query name sort,
.B 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 \fB-T\fR option.  If prefix is unspecified then
one will be derived from the output filename (\fB\-o\fR option).
If no output file was given then the \fBTMPDIR\fR 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 \fB-f\fR for fast mode will output \fBonly\fR primary alignments that have
either the READ1 \fBor\fR 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 \fB-r\fR, 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.

.SH OPTIONS
.TP 8
.B -O
Output to stdout.  This option cannot be used with \fB-o\fR.
.TP
.BI "-o " FILE
Write output to FILE.  This option cannot be used with \fB-O\fR.  If
unspecified and \fB-O\fR is not set, the temporary file <prefix> is
used, appended by the the appropriate file-format suffix.
.TP
.BI "-T " PREFIX
Use \fIPREFIX\fR for temporary files.  This is the same as specifying
\fIPREFIX\fR as the last argument on the command line.  This option
is included for consistency with \fBsamtools sort\fR.
.TP
.B -u
Write uncompressed BAM output
.TP
.BI "-l "  INT
Compression level.
[1]
.TP
.BI "-n " INT
Number of temporary files to use.
[64]
.TP
.B -f
Fast mode (primary alignments only).
.TP
.BI "-r " INT
Number of reads to store in memory (for use with -f).
[10000]
.TP
.BI --no-PG
Do not add a @PG line to the header of the output file.
.TP
.BI "-@, --threads " INT
Number of input/output compression threads to use in addition to main thread [0].

.SH AUTHOR
.PP
Written by Heng Li from the Sanger Institute and extended by Andrew Whitwham.

.SH SEE ALSO
.IR samtools (1),
.IR samtools-sort (1)
.PP
Samtools website: <http://www.htslib.org/>