libStatGen Software 1
|
Class for buffering up output reads to ensure that it is sorted. More...
#include <SamCoordOutput.h>
Public Member Functions | |
SamCoordOutput (SamRecordPool &pool) | |
Create an output buffer returning any written records to the specified pool. | |
void | setOutputFile (SamFile *outFile, SamFileHeader *header) |
Set the already opened output file to write to when flushed. | |
bool | add (SamRecord *record) |
Add the specified record to this read buffer. | |
bool | flushAll () |
Flush the entire buffer, writing all records. | |
bool | flush (int32_t chromID, int32_t pos0Based) |
Flush the buffer based on the specified chromosome id/position, writing any records that start at/before the specified chromosome id/position. | |
Class for buffering up output reads to ensure that it is sorted.
They are added in almost sorted order. Flush writes any records that start at/before the specified position.
Definition at line 27 of file SamCoordOutput.h.
SamCoordOutput::SamCoordOutput | ( | SamRecordPool & | pool | ) |
Create an output buffer returning any written records to the specified pool.
pool | pool that any written records should be returned to, a pointer to this pool is stored, so it should not go out of scope until the output buffer has written all the records. |
Definition at line 22 of file SamCoordOutput.cpp.
References SamCoordOutput().
Referenced by SamCoordOutput().
SamCoordOutput::~SamCoordOutput | ( | ) |
Definition at line 29 of file SamCoordOutput.cpp.
bool SamCoordOutput::add | ( | SamRecord * | record | ) |
Add the specified record to this read buffer.
Definition at line 45 of file SamCoordOutput.cpp.
References SamHelper::combineChromPos(), SamRecord::get0BasedPosition(), and SamRecord::getReferenceID().
bool SamCoordOutput::flush | ( | int32_t | chromID, |
int32_t | pos0Based | ||
) |
Flush the buffer based on the specified chromosome id/position, writing any records that start at/before the specified chromosome id/position.
If no output buffer is set, the files cannot be written, but the flushed records are removed/freed. A chromID of -1 will flush everything regardless of pos0Based.
Definition at line 64 of file SamCoordOutput.cpp.
References SamHelper::combineChromPos(), SamRecordPool::releaseRecord(), and SamFile::WriteRecord().
Referenced by flushAll().
bool SamCoordOutput::flushAll | ( | ) |
Flush the entire buffer, writing all records.
If no output buffer is set, the files cannot be written, but the flushed records are removed/freed.
Definition at line 59 of file SamCoordOutput.cpp.
References flush().
void SamCoordOutput::setOutputFile | ( | SamFile * | outFile, |
SamFileHeader * | header | ||
) |
Set the already opened output file to write to when flushed.
The user should not close/delete the SamFile until this class is done with it. This class does NOT close/delete the SamFile.
outFile | pointer to an already opened (and header written) SAM/BAM output file. |
header | pointer to an already written header that should be used for writing the records. |
Definition at line 38 of file SamCoordOutput.cpp.