From Genome Analysis Wiki
Jump to navigationJump to search
53 bytes added
, 16:23, 6 April 2010
Line 46: |
Line 46: |
| | Reads the next record from the file and stores it in the passed in record. | | | Reads the next record from the file and stores it in the passed in record. |
| | | |
− | If it is an indexed BAM file and SetReadSection was called, only alignments in the section specified by SetReadSection are read. If they all have already been read, this method returns false. | + | If it is an indexed BAM file and SetReadSection was called, only alignments in the section specified by <code>SetReadSection</code> are read. If they all have already been read, this method returns false. |
| | | |
| Validates that the record is sorted according to the value set by <code>setSortedValidation</code>. No sorting validation is done if specified to be unsorted, or <code>setSortedValidation</code> was never called. | | Validates that the record is sorted according to the value set by <code>setSortedValidation</code>. No sorting validation is done if specified to be unsorted, or <code>setSortedValidation</code> was never called. |
Line 69: |
Line 69: |
| |- | | |- |
| | <code>bool SamFile::SetReadSection(int32_t refID)</code> | | | <code>bool SamFile::SetReadSection(int32_t refID)</code> |
− | | Tell the class which reference ID should be read from the BAM file. This is the index into the BAM Index list of reference information: 0 - #references. The records for that reference id will be retrieved on each ReadRecord call. When all records have been retrieved for the specified reference id, ReadRecord will return false until a new read section is set. | + | | Tell the class which reference ID should be read from the BAM file. This is the index into the BAM Index list of reference information: 0 - #references. The records for that reference id will be retrieved on each <code>ReadRecord</code> call. When all records have been retrieved for the specified reference id, <code>ReadRecord</code> will return false until a new read section is set. |
| Pass in -1 in order to read the section of the bam file not associated with any reference ID. | | Pass in -1 in order to read the section of the bam file not associated with any reference ID. |
| Returns true if the read section was successfully set, false if not. False is returned if the BAM Index File has not yet been read or if a BAM file is not open for reading. | | Returns true if the read section was successfully set, false if not. False is returned if the BAM Index File has not yet been read or if a BAM file is not open for reading. |
Line 177: |
Line 177: |
| const char* indexFilename) | | const char* indexFilename) |
| { | | { |
− | IndexedBamReader samIn; | + | SamFile samIn; |
| | | |
− | samIn.OpenForRead(inputFilename, indexFilename); | + | samIn.OpenForRead(inputFilename); |
| + | samIn.ReadBamIndex(indexFilename); |
| | | |
| SamFile samOut; | | SamFile samOut; |