| | 32 | |
| | 33 | === Differences between SAM and BAM files === |
| | 34 | |
| | 35 | * A BAM file is a binary version of a SAM file. |
| | 36 | * Both contain identical information about reads and their mapping. |
| | 37 | * A BAM file requires a header but a SAM file may not have one. (Use 'samtools view -h reads.bam' to print the header with the mapped reads.) |
| | 38 | * Many operations (such as sorting and indexing) work only on BAM files. |
| | 39 | * For almost any application that requires SAM input, this can be created on the fly from a BAM file (using 'samtools view reads.bam |'). |
| | 40 | * BAM files take up much less space than SAM files. |
| | 41 | * For archiving purposes, keep only the BAM file. The SAM file can easily be regenerated (if ever needed). |