From Genome Analysis Wiki
Jump to navigationJump to search
12 bytes removed
, 14:41, 10 June 2010
Line 1: |
Line 1: |
− | ==== Simple Read/Write SAM/BAM files ====
| + | == Simple Read/Write SAM/BAM files == |
| The following example reads in a sam/bam file and writes it out as a sam/bam file. The file format of the input sam/bam is determined by the SamFile class based on reading the type from the file. The file format of the output sam/bam file is determined by the '''SamFile''' class based on the extension of the output file. A ".bam" extension indicates a BAM file. All other extensions indicate SAM files. | | The following example reads in a sam/bam file and writes it out as a sam/bam file. The file format of the input sam/bam is determined by the SamFile class based on reading the type from the file. The file format of the output sam/bam file is determined by the '''SamFile''' class based on the extension of the output file. A ".bam" extension indicates a BAM file. All other extensions indicate SAM files. |
| | | |
Line 90: |
Line 90: |
| | | |
| | | |
− | ==== Simple Read/Write Indexed BAM Files ====
| + | == Simple Read/Write Indexed BAM Files == |
| This example reads in the inputFilename bam file and writes it back out section by section to the specified outputFilename, starting with section -1. It also prints a count of the number of records in each section. | | This example reads in the inputFilename bam file and writes it back out section by section to the specified outputFilename, starting with section -1. It also prints a count of the number of records in each section. |
| <source lang="cpp"> | | <source lang="cpp"> |
Line 174: |
Line 174: |
| </source> | | </source> |
| | | |
− | ==== Validate SAM/BAM Files Continuing Processing After Allowed Errors ====
| + | == Validate SAM/BAM Files Continuing Processing After Allowed Errors == |
| This example demonstrates calling validation on a SAM/BAM file. It also demonstrates a more complicated read loop that continues until a configurable number of errors are hit. | | This example demonstrates calling validation on a SAM/BAM file. It also demonstrates a more complicated read loop that continues until a configurable number of errors are hit. |
| <source lang="cpp"> | | <source lang="cpp"> |