Merge commit 'upstream/0.1.10'
[samtools.git] / bcftools / bcf.tex
1 \documentclass[10pt,pdftex]{article}
2 \usepackage{color}
3 \definecolor{gray}{rgb}{0.7,0.7,0.7}
4
5 \setlength{\topmargin}{0.0cm}
6 \setlength{\textheight}{21.5cm}
7 \setlength{\oddsidemargin}{0cm} 
8 \setlength{\textwidth}{16.5cm}
9 \setlength{\columnsep}{0.6cm}
10
11 \begin{document}
12
13 \begin{center}
14 \begin{tabular}{|l|l|l|l|l|}
15 \hline
16 \multicolumn{2}{|c|}{\bf Field} & \multicolumn{1}{c|}{\bf Descrption} & \multicolumn{1}{c|}{\bf Type} & \multicolumn{1}{c|}{\bf Value} \\\hline\hline
17 \multicolumn{2}{|l|}{\tt magic} & Magic string & {\tt char[4]} & {\tt BCF\char92 4} \\\hline
18 \multicolumn{2}{|l|}{\tt l\_nm} & Length of concatenated sequence names & {\tt int32\_t} & \\\hline
19 \multicolumn{2}{|l|}{\tt name} & Concatenated names, {\tt NULL} padded & {\tt char[l\_nm]} & \\\hline
20 \multicolumn{2}{|l|}{\tt l\_smpl} & Length of concatenated sample names & {\tt int32\_t} & \\\hline
21 \multicolumn{2}{|l|}{\tt sname} & Concatenated sample names & {\tt char[l\_smpl]} & \\\hline
22 \multicolumn{2}{|l|}{\tt l\_txt} & Length of the meta text (double-hash lines)& {\tt int32\_t} & \\\hline
23 \multicolumn{2}{|l|}{\tt text} & Meta text, {\tt NULL} terminated & {\tt char[l\_txt]} & \\\hline
24 \multicolumn{5}{|c|}{\it \color{gray}{List of records until the end of the file}}\\\cline{2-5}
25 & {\tt seq\_id} & Reference sequence ID & {\tt int32\_t} & \\\cline{2-5}
26 & {\tt pos} & Position & {\tt int32\_t} & \\\cline{2-5}
27 & {\tt qual} & Variant quality & {\tt float} & \\\cline{2-5}
28 & {\tt l\_str} & Length of str & {\tt int32\_t} & \\\cline{2-5}
29 & {\tt str} & {\tt ID+REF+ALT+FILTER+INFO+FORMAT}, {\tt NULL} padded & {\tt char[slen]} &\\\cline{2-5}
30 & \multicolumn{4}{c|}{Blocks of data; \#blocks and formats defined by {\tt FORMAT} (table below)}\\
31 \hline
32 \end{tabular}
33 \end{center}
34
35 \begin{center}
36 \begin{tabular}{cll}
37 \hline
38 \multicolumn{1}{l}{\bf Field} & \multicolumn{1}{l}{\bf Type} & \multicolumn{1}{l}{\bf Description} \\\hline
39 {\tt DP} & {\tt uint16\_t[n]} & Read depth \\
40 {\tt GL} & {\tt float[n*x]} & Log10 likelihood of data; $x=\frac{m(m+1)}{2}$, $m=\#\{alleles\}$\\
41 {\tt GT} & {\tt uint8\_t[n]} & {\tt phase\char60\char60 6 | allele1\char60\char60 3 | allele2} \\
42 {\tt GQ} & {\tt uint8\_t[n]} & {Genotype quality}\\
43 {\tt HQ} & {\tt uint8\_t[n*2]} & {Haplotype quality}\\
44 {\tt PL} & {\tt uint8\_t[n*x]} & {Phred-scaled likelihood of data}\\
45 \emph{misc} & {\tt int32\_t+char*} & {\tt NULL} padded concatenated strings (integer equal to the length) \\
46 \hline
47 \end{tabular}
48 \end{center}
49
50 \begin{itemize}
51 \item The file is {\tt BGZF} compressed.
52 \item All integers are little-endian.
53 \item In a string, a missing value `.' is an empty C string ``{\tt
54     \char92 0}'' (not ``{\tt .\char92 0}'')
55 \item For {\tt GL} and {\tt PL}, likelihoods of genotypes appear in the
56   order of alleles in {\tt REF} and then {\tt ALT}. For example, if {\tt
57     REF=C}, {\tt ALT=T,A}, likelihoods appear in the order of {\tt
58     CC,CT,CA,TT,TA,AA}.
59 \item {\tt GL} is an extension to and is backward compatible with the
60   {\tt GL} genotype field in {\tt VCFv4.0}.
61 \end{itemize}
62
63 \end{document}