forked from samtools/htslib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
faidx.5
146 lines (146 loc) · 4.66 KB
/
faidx.5
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
143
144
145
146
'\" t
.TH faidx 5 "August 2015" "htslib" "Bioinformatics formats"
.SH NAME
faidx \- an index enabling random access to FASTA files
.\"
.\" Copyright (C) 2013, 2015 Genome Research Ltd.
.\"
.\" Author: John Marshall <jm18@sanger.ac.uk>
.\"
.\" 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.
.\"
.SH SYNOPSIS
.IR file.fa .fai,
.IR file.fasta .fai
.SH DESCRIPTION
Using an \fBfai index\fP file in conjunction with a FASTA file containing
reference sequences enables efficient access to arbitrary regions within
those reference sequences.
The index file typically has the same filename as the corresponding FASTA
file, with \fB.fai\fP appended.
.P
An \fBfai index\fP file is a text file consisting of lines each with
five TAB-delimited columns:
.TS
lbl.
NAME Name of this reference sequence
LENGTH Total length of this reference sequence, in bases
OFFSET Offset within the FASTA file of this sequence's first base
LINEBASES The number of bases on each line
LINEWIDTH The number of bytes in each line, including the newline
.TE
.P
The \fBNAME\fP and \fBLENGTH\fP columns contain the same
data as would appear in the \fBSN\fP and \fBLN\fP fields of a
SAM \fB@SQ\fP header for the same reference sequence.
.P
The \fBOFFSET\fP column contains the offset within the FASTA file, in bytes
starting from zero, of the first base of this reference sequence, i.e., of
the character following the newline at the end of the "\fB>\fP" header line.
Typically the lines of a \fBfai index\fP file appear in the order in which the
reference sequences appear in the FASTA file, so \fB.fai\fP files are typically
sorted according to this column.
.P
The \fBLINEBASES\fP column contains the number of bases in each of the sequence
lines that form the body of this reference sequence, apart from the final line
which may be shorter.
The \fBLINEWIDTH\fP column contains the number of \fIbytes\fP in each of
the sequence lines (except perhaps the final line), thus differing from
\fBLINEBASES\fP in that it also counts the bytes forming the line terminator.
.SS FASTA Files
In order to be indexed with \fBsamtools faidx\fP, a FASTA file must be a text
file of the form
.LP
.RS
.RI > name
.RI [ description ...]
.br
ATGCATGCATGCATGCATGCATGCATGCAT
.br
GCATGCATGCATGCATGCATGCATGCATGC
.br
ATGCAT
.br
.RI > name
.RI [ description ...]
.br
ATGCATGCATGCAT
.br
GCATGCATGCATGC
.br
[...]
.RE
.LP
In particular, each reference sequence must be "well-formatted", i.e., all
of its sequence lines must be the same length, apart from the final sequence
line which may be shorter.
(While this sequence line length must be the same within each sequence,
it may vary between different reference sequences in the same FASTA file.)
.P
This also means that although the FASTA file may have Unix- or Windows-style
or other line termination, the newline characters present must be consistent,
at least within each reference sequence.
.P
The \fBsamtools\fP implementation uses the first word of the "\fB>\fP" header
line text (i.e., up to the first whitespace character, having skipped any
initial whitespace after the ">") as the \fBNAME\fP column.
.SH EXAMPLE
For example, given this FASTA file
.LP
.RS
>one
.br
ATGCATGCATGCATGCATGCATGCATGCAT
.br
GCATGCATGCATGCATGCATGCATGCATGC
.br
ATGCAT
.br
>two another chromosome
.br
ATGCATGCATGCAT
.br
GCATGCATGCATGC
.br
.RE
.LP
formatted with Unix-style (LF) line termination, the corresponding fai index
would be
.RS
.TS
lnnnn.
one 66 5 30 31
two 28 98 14 15
.TE
.RE
.LP
If the FASTA file were formatted with Windows-style (CR-LF) line termination,
the fai index would be
.RS
.TS
lnnnn.
one 66 6 30 32
two 28 103 14 16
.TE
.RE
.SH SEE ALSO
.IR samtools (1)
.TP
http://en.wikipedia.org/wiki/FASTA_format
Further description of the FASTA format