# bcftools/bcf-fix.pl removed upstream.
[samtools.git] / samtools.1
1 .TH samtools 1 "1 March 2011" "samtools-0.1.13" "Bioinformatics tools"
2 .SH NAME
3 .PP
4 samtools - Utilities for the Sequence Alignment/Map (SAM) format
5 .SH SYNOPSIS
6 .PP
7 samtools view -bt ref_list.txt -o aln.bam aln.sam.gz
8 .PP
9 samtools sort aln.bam aln.sorted
10 .PP
11 samtools index aln.sorted.bam
12 .PP
13 samtools idxstats aln.sorted.bam
14 .PP
15 samtools view aln.sorted.bam chr2:20,100,000-20,200,000
16 .PP
17 samtools merge out.bam in1.bam in2.bam in3.bam
18 .PP
19 samtools faidx ref.fasta
20 .PP
21 samtools pileup -vcf ref.fasta aln.sorted.bam
22 .PP
23 samtools mpileup -C50 -gf ref.fasta -r chr3:1,000-2,000 in1.bam in2.bam
24 .PP
25 samtools tview aln.sorted.bam ref.fasta
26
27 .SH DESCRIPTION
28 .PP
29 Samtools is a set of utilities that manipulate alignments in the BAM
30 format. It imports from and exports to the SAM (Sequence Alignment/Map)
31 format, does sorting, merging and indexing, and allows to retrieve reads
32 in any regions swiftly.
33
34 Samtools is designed to work on a stream. It regards an input file `-'
35 as the standard input (stdin) and an output file `-' as the standard
36 output (stdout). Several commands can thus be combined with Unix
37 pipes. Samtools always output warning and error messages to the standard
38 error output (stderr).
39
40 Samtools is also able to open a BAM (not SAM) file on a remote FTP or
41 HTTP server if the BAM file name starts with `ftp://' or `http://'.
42 Samtools checks the current working directory for the index file and
43 will download the index upon absence. Samtools does not retrieve the
44 entire alignment file unless it is asked to do so.
45
46 .SH COMMANDS AND OPTIONS
47
48 .TP 10
49 .B view
50 samtools view [-bchuHS] [-t in.refList] [-o output] [-f reqFlag] [-F
51 skipFlag] [-q minMapQ] [-l library] [-r readGroup] [-R rgFile] <in.bam>|<in.sam> [region1 [...]]
52
53 Extract/print all or sub alignments in SAM or BAM format. If no region
54 is specified, all the alignments will be printed; otherwise only
55 alignments overlapping the specified regions will be output. An
56 alignment may be given multiple times if it is overlapping several
57 regions. A region can be presented, for example, in the following
58 format: `chr2' (the whole chr2), `chr2:1000000' (region starting from
59 1,000,000bp) or `chr2:1,000,000-2,000,000' (region between 1,000,000 and
60 2,000,000bp including the end points). The coordinate is 1-based.
61
62 .B OPTIONS:
63 .RS
64 .TP 8
65 .B -b
66 Output in the BAM format.
67 .TP
68 .BI -f \ INT
69 Only output alignments with all bits in INT present in the FLAG
70 field. INT can be in hex in the format of /^0x[0-9A-F]+/ [0]
71 .TP
72 .BI -F \ INT
73 Skip alignments with bits present in INT [0]
74 .TP
75 .B -h
76 Include the header in the output.
77 .TP
78 .B -H
79 Output the header only.
80 .TP
81 .BI -l \ STR
82 Only output reads in library STR [null]
83 .TP
84 .BI -o \ FILE
85 Output file [stdout]
86 .TP
87 .BI -q \ INT
88 Skip alignments with MAPQ smaller than INT [0]
89 .TP
90 .BI -r \ STR
91 Only output reads in read group STR [null]
92 .TP
93 .BI -R \ FILE
94 Output reads in read groups listed in
95 .I FILE
96 [null]
97 .TP
98 .B -S
99 Input is in SAM. If @SQ header lines are absent, the
100 .B `-t'
101 option is required.
102 .TP
103 .B -c
104 Instead of printing the alignments, only count them and print the
105 total number. All filter options, such as
106 .B `-f',
107 .B `-F'
108 and
109 .B `-q'
110 , are taken into account.
111 .TP
112 .BI -t \ FILE
113 This file is TAB-delimited. Each line must contain the reference name
114 and the length of the reference, one line for each distinct reference;
115 additional fields are ignored. This file also defines the order of the
116 reference sequences in sorting. If you run `samtools faidx <ref.fa>',
117 the resultant index file
118 .I <ref.fa>.fai
119 can be used as this
120 .I <in.ref_list>
121 file.
122 .TP
123 .B -u
124 Output uncompressed BAM. This option saves time spent on
125 compression/decomprssion and is thus preferred when the output is piped
126 to another samtools command.
127 .RE
128
129 .TP
130 .B tview
131 samtools tview <in.sorted.bam> [ref.fasta]
132
133 Text alignment viewer (based on the ncurses library). In the viewer,
134 press `?' for help and press `g' to check the alignment start from a
135 region in the format like `chr10:10,000,000' or `=10,000,000' when
136 viewing the same reference sequence.
137
138 .TP
139 .B mpileup
140 samtools mpileup [-EBug] [-C capQcoef] [-r reg] [-f in.fa] [-l list] [-M capMapQ] [-Q minBaseQ] [-q minMapQ] in.bam [in2.bam [...]]
141
142 Generate BCF or pileup for one or multiple BAM files. Alignment records
143 are grouped by sample identifiers in @RG header lines. If sample
144 identifiers are absent, each input file is regarded as one sample.
145
146 .B OPTIONS:
147 .RS
148 .TP 8
149 .B -B
150 Disable probabilistic realignment for the computation of base alignment
151 quality (BAQ). BAQ is the Phred-scaled probability of a read base being
152 misaligned. Applying this option greatly helps to reduce false SNPs
153 caused by misalignments.
154 .TP
155 .BI -C \ INT
156 Coefficient for downgrading mapping quality for reads containing
157 excessive mismatches. Given a read with a phred-scaled probability q of
158 being generated from the mapped position, the new mapping quality is
159 about sqrt((INT-q)/INT)*INT. A zero value disables this
160 functionality; if enabled, the recommended value for BWA is 50. [0]
161 .TP
162 .BI -e \ INT
163 Phred-scaled gap extension sequencing error probability. Reducing
164 .I INT
165 leads to longer indels. [20]
166 .TP
167 .B -E
168 Extended BAQ computation. This option helps sensitivity especially for MNPs, but may hurt
169 specificity a little bit.
170 .TP
171 .BI -f \ FILE
172 The reference file [null]
173 .TP
174 .B -g
175 Compute genotype likelihoods and output them in the binary call format (BCF).
176 .TP
177 .BI -h \ INT
178 Coefficient for modeling homopolymer errors. Given an
179 .IR l -long
180 homopolymer
181 run, the sequencing error of an indel of size
182 .I s
183 is modeled as
184 .IR INT * s / l .
185 [100]
186 .TP
187 .BI -l \ FILE
188 File containing a list of sites where pileup or BCF is outputted [null]
189 .TP
190 .BI -o \ INT
191 Phred-scaled gap open sequencing error probability. Reducing
192 .I INT
193 leads to more indel calls. [40]
194 .TP
195 .BI -P \ STR
196 Comma dilimited list of platforms (determined by
197 .BR @RG-PL )
198 from which indel candidates are obtained. It is recommended to collect
199 indel candidates from sequencing technologies that have low indel error
200 rate such as ILLUMINA. [all]
201 .TP
202 .BI -q \ INT
203 Minimum mapping quality for an alignment to be used [0]
204 .TP
205 .BI -Q \ INT
206 Minimum base quality for a base to be considered [13]
207 .TP
208 .BI -r \ STR
209 Only generate pileup in region
210 .I STR
211 [all sites]
212 .TP
213 .B -u
214 Similar to
215 .B -g
216 except that the output is uncompressed BCF, which is preferred for piping.
217 .RE
218
219 .TP
220 .B reheader
221 samtools reheader <in.header.sam> <in.bam>
222
223 Replace the header in
224 .I in.bam
225 with the header in
226 .I in.header.sam.
227 This command is much faster than replacing the header with a
228 BAM->SAM->BAM conversion.
229
230 .TP
231 .B sort
232 samtools sort [-no] [-m maxMem] <in.bam> <out.prefix>
233
234 Sort alignments by leftmost coordinates. File
235 .I <out.prefix>.bam
236 will be created. This command may also create temporary files
237 .I <out.prefix>.%d.bam
238 when the whole alignment cannot be fitted into memory (controlled by
239 option -m).
240
241 .B OPTIONS:
242 .RS
243 .TP 8
244 .B -o
245 Output the final alignment to the standard output.
246 .TP
247 .B -n
248 Sort by read names rather than by chromosomal coordinates
249 .TP
250 .BI -m \ INT
251 Approximately the maximum required memory. [500000000]
252 .RE
253
254 .TP
255 .B merge
256 samtools merge [-nur] [-h inh.sam] [-R reg] <out.bam> <in1.bam> <in2.bam> [...]
257
258 Merge multiple sorted alignments.
259 The header reference lists of all the input BAM files, and the @SQ headers of
260 .IR inh.sam ,
261 if any, must all refer to the same set of reference sequences.
262 The header reference list and (unless overridden by
263 .BR -h )
264 `@' headers of
265 .I in1.bam
266 will be copied to
267 .IR out.bam ,
268 and the headers of other files will be ignored.
269
270 .B OPTIONS:
271 .RS
272 .TP 8
273 .BI -h \ FILE
274 Use the lines of
275 .I FILE
276 as `@' headers to be copied to
277 .IR out.bam ,
278 replacing any header lines that would otherwise be copied from
279 .IR in1.bam .
280 .RI ( FILE
281 is actually in SAM format, though any alignment records it may contain
282 are ignored.)
283 .TP
284 .BI -R \ STR
285 Merge files in the specified region indicated by
286 .I STR
287 .TP
288 .B -r
289 Attach an RG tag to each alignment. The tag value is inferred from file names.
290 .TP
291 .B -n
292 The input alignments are sorted by read names rather than by chromosomal
293 coordinates
294 .TP
295 .B -u
296 Uncompressed BAM output
297 .RE
298
299 .TP
300 .B index
301 samtools index <aln.bam>
302
303 Index sorted alignment for fast random access. Index file
304 .I <aln.bam>.bai
305 will be created.
306
307 .TP
308 .B idxstats
309 samtools idxstats <aln.bam>
310
311 Retrieve and print stats in the index file. The output is TAB delimited
312 with each line consisting of reference sequence name, sequence length, #
313 mapped reads and # unmapped reads.
314
315 .TP
316 .B faidx
317 samtools faidx <ref.fasta> [region1 [...]]
318
319 Index reference sequence in the FASTA format or extract subsequence from
320 indexed reference sequence. If no region is specified,
321 .B faidx
322 will index the file and create
323 .I <ref.fasta>.fai
324 on the disk. If regions are speficified, the subsequences will be
325 retrieved and printed to stdout in the FASTA format. The input file can
326 be compressed in the
327 .B RAZF
328 format.
329
330 .TP
331 .B fixmate
332 samtools fixmate <in.nameSrt.bam> <out.bam>
333
334 Fill in mate coordinates, ISIZE and mate related flags from a
335 name-sorted alignment.
336
337 .TP
338 .B rmdup
339 samtools rmdup [-sS] <input.srt.bam> <out.bam>
340
341 Remove potential PCR duplicates: if multiple read pairs have identical
342 external coordinates, only retain the pair with highest mapping quality.
343 In the paired-end mode, this command
344 .B ONLY
345 works with FR orientation and requires ISIZE is correctly set. It does
346 not work for unpaired reads (e.g. two ends mapped to different
347 chromosomes or orphan reads).
348
349 .B OPTIONS:
350 .RS
351 .TP 8
352 .B -s
353 Remove duplicate for single-end reads. By default, the command works for
354 paired-end reads only.
355 .TP 8
356 .B -S
357 Treat paired-end reads and single-end reads.
358 .RE
359
360 .TP
361 .B calmd
362 samtools calmd [-EeubSr] [-C capQcoef] <aln.bam> <ref.fasta>
363
364 Generate the MD tag. If the MD tag is already present, this command will
365 give a warning if the MD tag generated is different from the existing
366 tag. Output SAM by default.
367
368 .B OPTIONS:
369 .RS
370 .TP 8
371 .B -A
372 When used jointly with
373 .B -r
374 this option overwrites the original base quality.
375 .TP 8
376 .B -e
377 Convert a the read base to = if it is identical to the aligned reference
378 base. Indel caller does not support the = bases at the moment.
379 .TP
380 .B -u
381 Output uncompressed BAM
382 .TP
383 .B -b
384 Output compressed BAM
385 .TP
386 .B -S
387 The input is SAM with header lines
388 .TP
389 .BI -C \ INT
390 Coefficient to cap mapping quality of poorly mapped reads. See the
391 .B pileup
392 command for details. [0]
393 .TP
394 .B -r
395 Compute the BQ tag (without -A) or cap base quality by BAQ (with -A).
396 .TP
397 .B -E
398 Extended BAQ calculation. This option trades specificity for sensitivity, though the
399 effect is minor.
400 .RE
401
402 .TP
403 .B targetcut
404 samtools targetcut [-Q minBaseQ] [-i inPenalty] [-0 em0] [-1 em1] [-2 em2] [-f ref] <in.bam>
405
406 This command identifies target regions by examining the continuity of read depth, computes
407 haploid consensus sequences of targets and outputs a SAM with each sequence corresponding
408 to a target. When option
409 .B -f
410 is in use, BAQ will be applied. This command is
411 .B only
412 designed for cutting fosmid clones from fosmid pool sequencing [Ref. Kitzman et al. (2010)].
413 .RE
414
415 .TP
416 .B phase
417 samtools phase [-AF] [-k len] [-b prefix] [-q minLOD] [-Q minBaseQ] <in.bam>
418
419 Call and phase heterozygous SNPs.
420 .B OPTIONS:
421 .RS
422 .TP 8
423 .B -A
424 Drop reads with ambiguous phase.
425 .TP 8
426 .BI -b \ STR
427 Prefix of BAM output. When this option is in use, phase-0 reads will be saved in file
428 .BR STR .0.bam
429 and phase-1 reads in
430 .BR STR .1.bam.
431 Phase unknown reads will be randomly allocated to one of the two files. Chimeric reads
432 with switch errors will be saved in
433 .BR STR .chimeric.bam.
434 [null]
435 .TP
436 .B -F
437 Do not attempt to fix chimeric reads.
438 .TP
439 .BI -k \ INT
440 Maximum length for local phasing. [13]
441 .TP
442 .BI -q \ INT
443 Minimum Phred-scaled LOD to call a heterozygote. [40]
444 .TP
445 .BI -Q \ INT
446 Minimum base quality to be used in het calling. [13]
447 .RE
448
449 .TP
450 .B pileup
451 samtools pileup [-2sSBicv] [-f in.ref.fasta] [-t in.ref_list] [-l
452 in.site_list] [-C capMapQ] [-M maxMapQ] [-T theta] [-N nHap] [-r
453 pairDiffRate] [-m mask] [-d maxIndelDepth] [-G indelPrior]
454 <in.bam>|<in.sam>
455
456 Print the alignment in the pileup format. In the pileup format, each
457 line represents a genomic position, consisting of chromosome name,
458 coordinate, reference base, read bases, read qualities and alignment
459 mapping qualities. Information on match, mismatch, indel, strand,
460 mapping quality and start and end of a read are all encoded at the read
461 base column. At this column, a dot stands for a match to the reference
462 base on the forward strand, a comma for a match on the reverse strand,
463 a '>' or '<' for a reference skip, `ACGTN' for a mismatch on the forward
464 strand and `acgtn' for a mismatch on the reverse strand. A pattern
465 `\\+[0-9]+[ACGTNacgtn]+' indicates there is an insertion between this
466 reference position and the next reference position. The length of the
467 insertion is given by the integer in the pattern, followed by the
468 inserted sequence. Similarly, a pattern `-[0-9]+[ACGTNacgtn]+'
469 represents a deletion from the reference. The deleted bases will be
470 presented as `*' in the following lines. Also at the read base column, a
471 symbol `^' marks the start of a read. The ASCII of the character
472 following `^' minus 33 gives the mapping quality. A symbol `$' marks the
473 end of a read segment.
474
475 If option
476 .B -c
477 is applied, the consensus base, Phred-scaled consensus quality, SNP
478 quality (i.e. the Phred-scaled probability of the consensus being
479 identical to the reference) and root mean square (RMS) mapping quality
480 of the reads covering the site will be inserted between the `reference
481 base' and the `read bases' columns. An indel occupies an additional
482 line. Each indel line consists of chromosome name, coordinate, a star,
483 the genotype, consensus quality, SNP quality, RMS mapping quality, #
484 covering reads, the first alllele, the second allele, # reads supporting
485 the first allele, # reads supporting the second allele and # reads
486 containing indels different from the top two alleles.
487
488 .B NOTE:
489 Since 0.1.10, the `pileup' command is deprecated by `mpileup'.
490
491 .B OPTIONS:
492 .RS
493 .TP 10
494 .B -B
495 Disable the BAQ computation. See the
496 .B mpileup
497 command for details.
498 .TP
499 .B -c
500 Call the consensus sequence. Options
501 .BR -T ", " -N ", " -I " and " -r
502 are only effective when
503 .BR -c " or " -g
504 is in use.
505 .TP
506 .BI -C \ INT
507 Coefficient for downgrading the mapping quality of poorly mapped
508 reads. See the
509 .B mpileup
510 command for details. [0]
511 .TP
512 .BI -d \ INT
513 Use the first
514 .I NUM
515 reads in the pileup for indel calling for speed up. Zero for unlimited. [1024]
516 .TP
517 .BI -f \ FILE
518 The reference sequence in the FASTA format. Index file
519 .I FILE.fai
520 will be created if
521 absent.
522 .TP
523 .B -g
524 Generate genotype likelihood in the binary GLFv3 format. This option
525 suppresses -c, -i and -s. This option is deprecated by the
526 .B mpileup
527 command.
528 .TP
529 .B -i
530 Only output pileup lines containing indels.
531 .TP
532 .BI -I \ INT
533 Phred probability of an indel in sequencing/prep. [40]
534 .TP
535 .BI -l \ FILE
536 List of sites at which pileup is output. This file is space
537 delimited. The first two columns are required to be chromosome and
538 1-based coordinate. Additional columns are ignored. It is
539 recommended to use option
540 .TP
541 .BI -m \ INT
542 Filter reads with flag containing bits in
543 .I INT
544 [1796]
545 .TP
546 .BI -M \ INT
547 Cap mapping quality at INT [60]
548 .TP
549 .BI -N \ INT
550 Number of haplotypes in the sample (>=2) [2]
551 .TP
552 .BI -r \ FLOAT
553 Expected fraction of differences between a pair of haplotypes [0.001]
554 .TP
555 .B -s
556 Print the mapping quality as the last column. This option makes the
557 output easier to parse, although this format is not space efficient.
558 .TP
559 .B -S
560 The input file is in SAM.
561 .TP
562 .BI -t \ FILE
563 List of reference names ane sequence lengths, in the format described
564 for the
565 .B import
566 command. If this option is present, samtools assumes the input
567 .I <in.alignment>
568 is in SAM format; otherwise it assumes in BAM format.
569 .B -s
570 together with
571 .B -l
572 as in the default format we may not know the mapping quality.
573 .TP
574 .BI -T \ FLOAT
575 The theta parameter (error dependency coefficient) in the maq consensus
576 calling model [0.85]
577 .RE
578
579 .SH SAM FORMAT
580
581 SAM is TAB-delimited. Apart from the header lines, which are started
582 with the `@' symbol, each alignment line consists of:
583
584 .TS
585 center box;
586 cb | cb | cb
587 n | l | l .
588 Col     Field   Description
589 _
590 1       QNAME   Query (pair) NAME
591 2       FLAG    bitwise FLAG
592 3       RNAME   Reference sequence NAME
593 4       POS     1-based leftmost POSition/coordinate of clipped sequence
594 5       MAPQ    MAPping Quality (Phred-scaled)
595 6       CIAGR   extended CIGAR string
596 7       MRNM    Mate Reference sequence NaMe (`=' if same as RNAME)
597 8       MPOS    1-based Mate POSistion
598 9       ISIZE   Inferred insert SIZE
599 10      SEQ     query SEQuence on the same strand as the reference
600 11      QUAL    query QUALity (ASCII-33 gives the Phred base quality)
601 12      OPT     variable OPTional fields in the format TAG:VTYPE:VALUE
602 .TE
603
604 .PP
605 Each bit in the FLAG field is defined as:
606
607 .TS
608 center box;
609 cb | cb | cb
610 l | c | l .
611 Flag    Chr     Description
612 _
613 0x0001  p       the read is paired in sequencing
614 0x0002  P       the read is mapped in a proper pair
615 0x0004  u       the query sequence itself is unmapped
616 0x0008  U       the mate is unmapped
617 0x0010  r       strand of the query (1 for reverse)
618 0x0020  R       strand of the mate
619 0x0040  1       the read is the first read in a pair
620 0x0080  2       the read is the second read in a pair
621 0x0100  s       the alignment is not primary
622 0x0200  f       the read fails platform/vendor quality checks
623 0x0400  d       the read is either a PCR or an optical duplicate
624 .TE
625
626 .SH EXAMPLES
627 .IP o 2
628 Import SAM to BAM when
629 .B @SQ
630 lines are present in the header:
631
632   samtools view -bS aln.sam > aln.bam
633
634 If
635 .B @SQ
636 lines are absent:
637
638   samtools faidx ref.fa
639   samtools view -bt ref.fa.fai aln.sam > aln.bam
640
641 where
642 .I ref.fa.fai
643 is generated automatically by the
644 .B faidx
645 command.
646
647 .IP o 2
648 Attach the
649 .B RG
650 tag while merging sorted alignments:
651
652   perl -e 'print "@RG\\tID:ga\\tSM:hs\\tLB:ga\\tPL:Illumina\\n@RG\\tID:454\\tSM:hs\\tLB:454\\tPL:454\\n"' > rg.txt
653   samtools merge -rh rg.txt merged.bam ga.bam 454.bam
654
655 The value in a
656 .B RG
657 tag is determined by the file name the read is coming from. In this
658 example, in the
659 .IR merged.bam ,
660 reads from
661 .I ga.bam
662 will be attached 
663 .IR RG:Z:ga ,
664 while reads from
665 .I 454.bam
666 will be attached
667 .IR RG:Z:454 .
668
669 .IP o 2
670 Call SNPs and short indels for one diploid individual:
671
672   samtools mpileup -ugf ref.fa aln.bam | bcftools view -bvcg - > var.raw.bcf
673   bcftools view var.raw.bcf | vcfutils.pl varFilter -D 100 > var.flt.vcf
674
675 The
676 .B -D
677 option of varFilter controls the maximum read depth, which should be
678 adjusted to about twice the average read depth.  One may consider to add
679 .B -C50
680 to
681 .B mpileup
682 if mapping quality is overestimated for reads containing excessive
683 mismatches. Applying this option usually helps
684 .B BWA-short
685 but may not other mappers.
686
687 .IP o 2
688 Generate the consensus sequence for one diploid individual:
689
690   samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
691
692 .IP o 2
693 Phase one individual:
694
695   samtools calmd -AEur aln.bam ref.fa | samtools phase -b prefix - > phase.out
696
697 The
698 .B calmd
699 command is used to reduce false heterozygotes around INDELs.
700
701 .IP o 2
702 Call SNPs and short indels for multiple diploid individuals:
703
704   samtools mpileup -P ILLUMINA -ugf ref.fa *.bam | bcftools view -bcvg - > var.raw.bcf
705   bcftools view var.raw.bcf | vcfutils.pl varFilter -D 2000 > var.flt.vcf
706
707 Individuals are identified from the
708 .B SM
709 tags in the
710 .B @RG
711 header lines. Individuals can be pooled in one alignment file; one
712 individual can also be separated into multiple files. The
713 .B -P
714 option specifies that indel candidates should be collected only from
715 read groups with the
716 .B @RG-PL
717 tag set to
718 .IR ILLUMINA .
719 Collecting indel candidates from reads sequenced by an indel-prone
720 technology may affect the performance of indel calling.
721
722 .IP o 2
723 Derive the allele frequency spectrum (AFS) on a list of sites from multiple individuals:
724
725   samtools mpileup -Igf ref.fa *.bam > all.bcf
726   bcftools view -bl sites.list all.bcf > sites.bcf
727   bcftools view -cGP cond2 sites.bcf > /dev/null 2> sites.1.afs
728   bcftools view -cGP sites.1.afs sites.bcf > /dev/null 2> sites.2.afs
729   bcftools view -cGP sites.2.afs sites.bcf > /dev/null 2> sites.3.afs
730   ......
731
732 where
733 .I sites.list
734 contains the list of sites with each line consisting of the reference
735 sequence name and position. The following
736 .B bcftools
737 commands estimate AFS by EM.
738
739 .IP o 2
740 Dump BAQ applied alignment for other SNP callers:
741
742   samtools calmd -bAr aln.bam > aln.baq.bam
743
744 It adds and corrects the
745 .B NM
746 and
747 .B MD
748 tags at the same time. The
749 .B calmd
750 command also comes with the
751 .B -C
752 option, the same as the one in
753 .B pileup
754 and
755 .BR mpileup .
756 Apply if it helps.
757
758 .SH LIMITATIONS
759 .PP
760 .IP o 2
761 Unaligned words used in bam_import.c, bam_endian.h, bam.c and bam_aux.c.
762 .IP o 2
763 In merging, the input files are required to have the same number of
764 reference sequences. The requirement can be relaxed. In addition,
765 merging does not reconstruct the header dictionaries
766 automatically. Endusers have to provide the correct header. Picard is
767 better at merging.
768 .IP o 2
769 Samtools paired-end rmdup does not work for unpaired reads (e.g. orphan
770 reads or ends mapped to different chromosomes). If this is a concern,
771 please use Picard's MarkDuplicate which correctly handles these cases,
772 although a little slower.
773
774 .SH AUTHOR
775 .PP
776 Heng Li from the Sanger Institute wrote the C version of samtools. Bob
777 Handsaker from the Broad Institute implemented the BGZF library and Jue
778 Ruan from Beijing Genomics Institute wrote the RAZF library. John
779 Marshall and Petr Danecek contribute to the source code and various
780 people from the 1000 Genomes Project have contributed to the SAM format
781 specification.
782
783 .SH SEE ALSO
784 .PP
785 Samtools website: <http://samtools.sourceforge.net>