Changes

From Genome Analysis Wiki
Jump to: navigation, search

LibStatGen: BAM

969 bytes added, 12:09, 23 March 2010
no edit summary
Determines if it is a BAM/SAM file by reading the beginning of the file.
Returns true if successfully opened reading, false if not.
|-
| bool IsEOF()
| bool: true if the end of file has been reached, false if not.
|-
| bool OpenForWrite(const char * filename)
SamRecord samRecord;
// Keep reading records until it failsthe end of the file is reached. int recordCount numValidRecords = 0; int numRecords = 0; while (!samIn.ReadRecordIsEOF(samHeader, samRecord) == true)
{
recordCountif(samIn.ReadRecord(samHeader, samRecord) == true) { numRecords++; // Successfully read a record from the file, so check to see // if it is valid. if(samRecord.isValid()) { // It is valid, so write it. numValidRecords++; samOut.WriteRecord(samHeader, samRecord); } }
}
printf(std::cout << "RecordCount Number of records = %d\n", recordCount)<< numRecords << std::endl; std::cout << "Number of valid records = " << numValidRecords << std::endl;
}
</pre>
! width=""|Method Name
! width=""|Description
|-
| void resetRecord()
| Resets the record to be an empty record. This is not necessary when you are reading a Sam/Bam file, but if you are setting fields, it is a good idea to clean out a record before reusing it. Clearing it allows you to not have to set any empty fields.
|-
| bool setReadName(const char* readName)
! width=""|Method Name
! width=""|Description
|-
| bool isValid()
| Returns true if the record is valid. This performs validation steps. TODO: the method exists, but it does not yet perform any checks, so just returns true.
|-
| int getBlockSize()

Navigation menu