+ reheader samtools reheader <in.header.sam> <in.bam>
+
+ Replace the header in in.bam with the header in
+ in.header.sam. This command is much faster than replacing
+ the header with a BAM->SAM->BAM conversion.
+
+
+ sort samtools sort [-no] [-m maxMem] <in.bam> <out.prefix>
+
+ Sort alignments by leftmost coordinates. File <out.pre-
+ fix>.bam will be created. This command may also create tempo-
+ rary files <out.prefix>.%d.bam when the whole alignment can-
+ not be fitted into memory (controlled by option -m).
+
+ OPTIONS:
+
+ -o Output the final alignment to the standard output.
+
+ -n Sort by read names rather than by chromosomal coordi-
+ nates
+
+ -m INT Approximately the maximum required memory.
+ [500000000]
+
+
+ merge samtools merge [-h inh.sam] [-nr] <out.bam> <in1.bam>
+ <in2.bam> [...]
+
+ Merge multiple sorted alignments. The header reference lists
+ of all the input BAM files, and the @SQ headers of inh.sam,
+ if any, must all refer to the same set of reference
+ sequences. The header reference list and (unless overridden
+ by -h) `@' headers of in1.bam will be copied to out.bam, and
+ the headers of other files will be ignored.
+
+ OPTIONS:
+
+ -h FILE Use the lines of FILE as `@' headers to be copied to
+ out.bam, replacing any header lines that would other-
+ wise be copied from in1.bam. (FILE is actually in
+ SAM format, though any alignment records it may con-
+ tain are ignored.)
+
+ -r Attach an RG tag to each alignment. The tag value is
+ inferred from file names.
+
+ -n The input alignments are sorted by read names rather
+ than by chromosomal coordinates
+
+
+ index samtools index <aln.bam>
+
+ Index sorted alignment for fast random access. Index file
+ <aln.bam>.bai will be created.
+
+
+ idxstats samtools idxstats <aln.bam>
+
+ Retrieve and print stats in the index file. The output is TAB
+ delimited with each line consisting of reference sequence
+ name, sequence length, # mapped reads and # unmapped reads.
+
+
+ faidx samtools faidx <ref.fasta> [region1 [...]]
+
+ Index reference sequence in the FASTA format or extract sub-
+ sequence from indexed reference sequence. If no region is
+ specified, faidx will index the file and create
+ <ref.fasta>.fai on the disk. If regions are speficified, the
+ subsequences will be retrieved and printed to stdout in the
+ FASTA format. The input file can be compressed in the RAZF
+ format.
+