libStatGen Software 1
|
Child class of SamFile for writing files. More...
#include <SamFile.h>
Public Member Functions | |
SamFileWriter () | |
Default Constructor. | |
SamFileWriter (const char *filename) | |
Constructor that opens the specified file for write. | |
SamFileWriter (const char *filename, ErrorHandler::HandlingType errorHandlingType) | |
Constructor that opens the specified file for write. | |
SamFileWriter (const char *filename, SamFileHeader *header) | |
Constructor that opens the specified file for write and write the specified header into the file. | |
SamFileWriter (const char *filename, ErrorHandler::HandlingType errorHandlingType, SamFileHeader *header) | |
Constructor that opens the specified file for write and write the specified header into the file. | |
![]() | |
SamFile () | |
Default Constructor, initializes the variables, but does not open any files. | |
SamFile (ErrorHandler::HandlingType errorHandlingType) | |
Constructor that sets the error handling type. | |
SamFile (const char *filename, OpenType mode) | |
Constructor that opens the specified file based on the specified mode (READ/WRITE), aborts if the file could not be opened. | |
SamFile (const char *filename, OpenType mode, ErrorHandler::HandlingType errorHandlingType) | |
Constructor that opens the specified file based on the specified mode (READ/WRITE) and handles errors per the specified handleType. | |
SamFile (const char *filename, OpenType mode, SamFileHeader *header) | |
Constructor that opens the specified file based on the specified mode (READ/WRITE) and reads the header, aborts if the file could not be opened or the header not read. | |
SamFile (const char *filename, OpenType mode, ErrorHandler::HandlingType errorHandlingType, SamFileHeader *header) | |
Constructor that opens the specified file based on the specified mode (READ/WRITE) and reads the header, handling errors per the specified handleType. | |
virtual | ~SamFile () |
Destructor. | |
bool | OpenForRead (const char *filename, SamFileHeader *header=NULL) |
Open a sam/bam file for reading with the specified filename, determing the type of file and SAM/BAM by reading the file (if not stdin). | |
bool | OpenForWrite (const char *filename, SamFileHeader *header=NULL) |
Open a sam/bam file for writing with the specified filename, determining SAM/BAM from the extension (.bam = BAM). | |
bool | ReadBamIndex (const char *filename) |
Read the specified bam index file. | |
bool | ReadBamIndex () |
Read the bam index file using the BAM filename as a base. | |
void | SetReference (GenomeSequence *reference) |
Sets the reference to the specified genome sequence object. | |
void | SetReadSequenceTranslation (SamRecord::SequenceTranslation translation) |
Set the type of sequence translation to use when reading the sequence. | |
void | SetWriteSequenceTranslation (SamRecord::SequenceTranslation translation) |
Set the type of sequence translation to use when writing the sequence. | |
void | Close () |
Close the file if there is one open. | |
bool | IsOpen () |
Returns whether or not the file has been opened successfully. | |
bool | IsEOF () |
Returns whether or not the end of the file has been reached. | |
bool | IsStream () |
Returns whether or not the file has been opened for streaming input/output. | |
bool | ReadHeader (SamFileHeader &header) |
Reads the header section from the file and stores it in the passed in header. | |
bool | WriteHeader (SamFileHeader &header) |
Writes the specified header into the file. | |
bool | ReadRecord (SamFileHeader &header, SamRecord &record) |
Reads the next record from the file & stores it in the passed in record. | |
bool | WriteRecord (SamFileHeader &header, SamRecord &record) |
Writes the specified record into the file. | |
void | setSortedValidation (SortedType sortType) |
Set the flag to validate that the file is sorted as it is read/written. | |
uint32_t | GetCurrentRecordCount () |
Return the number of records that have been read/written so far. | |
SamStatus::Status | GetFailure () |
Deprecated, get the Status of the last call that sets status. | |
SamStatus::Status | GetStatus () |
Get the Status of the last call that sets status. | |
const char * | GetStatusMessage () |
Get the Status Message of the last call that sets status. | |
bool | SetReadSection (int32_t refID) |
Sets which reference id (index into the BAM list of reference information) of the BAM file should be read. | |
bool | SetReadSection (const char *refName) |
Sets which reference name of the BAM file should be read. | |
bool | SetReadSection (int32_t refID, int32_t start, int32_t end, bool overlap=true) |
Sets which reference id (index into the BAM list of reference information) & start/end positions of the BAM file should be read. | |
bool | SetReadSection (const char *refName, int32_t start, int32_t end, bool overlap=true) |
Sets which reference name & start/end positions of the BAM file should be read. | |
void | SetReadFlags (uint16_t requiredFlags, uint16_t excludedFlags) |
Specify which reads should be returned by ReadRecord. | |
int32_t | getNumMappedReadsFromIndex (int32_t refID) |
Get the number of mapped reads in the specified reference id. | |
int32_t | getNumUnMappedReadsFromIndex (int32_t refID) |
Get the number of unmapped reads in the specified reference id. | |
int32_t | getNumMappedReadsFromIndex (const char *refName, SamFileHeader &header) |
Get the number of mapped reads in the specified reference name. | |
int32_t | getNumUnMappedReadsFromIndex (const char *refName, SamFileHeader &header) |
Get the number of unmapped reads in the specified reference name. | |
uint32_t | GetNumOverlaps (SamRecord &samRecord) |
Returns the number of bases in the passed in read that overlap the region that is currently set. | |
void | GenerateStatistics (bool genStats) |
Whether or not statistics should be generated for this file. | |
const BamIndex * | GetBamIndex () |
Return the bam index if one has been opened. | |
int64_t | GetCurrentPosition () |
Get the current file position. | |
void | DisableBuffering () |
Turn off file read buffering. | |
void | PrintStatistics () |
Print the statistics that have been recorded due to a call to GenerateStatistics. | |
bool | attemptRecoverySync (bool(*checkSignature)(void *data), int length) |
void | setAttemptRecovery (bool flag=false) |
Additional Inherited Members | |
![]() | |
enum | OpenType { READ , WRITE } |
Enum for indicating whether to open the file for read or write. More... | |
enum | SortedType { UNSORTED = 0 , FLAG , COORDINATE , QUERY_NAME } |
Enum for indicating the type of sort expected in the file. More... | |
![]() | |
void | init () |
void | init (const char *filename, OpenType mode, SamFileHeader *header) |
void | resetFile () |
Resets the file prepping for a new file. | |
bool | validateSortOrder (SamRecord &record, SamFileHeader &header) |
Validate that the record is sorted compared to the previously read record if there is one, according to the specified sort order. | |
SortedType | getSortOrderFromHeader (SamFileHeader &header) |
bool | processNewSection (SamFileHeader &header) |
bool | ensureIndexedReadPosition () |
bool | checkRecordInSection (SamRecord &record) |
![]() | |
IFILE | myFilePtr |
GenericSamInterface * | myInterfacePtr |
bool | myIsOpenForRead |
Flag to indicate if a file is open for reading. | |
bool | myIsOpenForWrite |
Flag to indicate if a file is open for writing. | |
bool | myHasHeader |
Flag to indicate if a header has been read/written - required before being able to read/write a record. | |
SortedType | mySortedType |
int32_t | myPrevCoord |
Previous values used for checking if the file is sorted. | |
int32_t | myPrevRefID |
String | myPrevReadName |
uint32_t | myRecordCount |
Keep a count of the number of records that have been read/written so far. | |
SamStatistics * | myStatistics |
Pointer to the statistics for this file. | |
SamStatus | myStatus |
The status of the last SamFile command. | |
bool | myIsBamOpenForRead |
Values for reading Sorted BAM files via the index. | |
bool | myNewSection |
bool | myOverlapSection |
int32_t | myRefID |
int32_t | myStartPos |
int32_t | myEndPos |
uint64_t | myCurrentChunkEnd |
SortedChunkList | myChunksToRead |
BamIndex * | myBamIndex |
GenomeSequence * | myRefPtr |
SamRecord::SequenceTranslation | myReadTranslation |
SamRecord::SequenceTranslation | myWriteTranslation |
std::string | myRefName |
SamFileWriter::SamFileWriter | ( | ) |
Default Constructor.
Definition at line 1419 of file SamFile.cpp.
SamFileWriter::SamFileWriter | ( | const char * | filename | ) |
Constructor that opens the specified file for write.
Definition at line 1426 of file SamFile.cpp.
SamFileWriter::SamFileWriter | ( | const char * | filename, |
ErrorHandler::HandlingType | errorHandlingType | ||
) |
Constructor that opens the specified file for write.
Definition at line 1433 of file SamFile.cpp.
SamFileWriter::SamFileWriter | ( | const char * | filename, |
SamFileHeader * | header | ||
) |
Constructor that opens the specified file for write and write the specified header into the file.
Definition at line 1441 of file SamFile.cpp.
SamFileWriter::SamFileWriter | ( | const char * | filename, |
ErrorHandler::HandlingType | errorHandlingType, | ||
SamFileHeader * | header | ||
) |
Constructor that opens the specified file for write and write the specified header into the file.
Definition at line 1449 of file SamFile.cpp.
|
virtual |
Definition at line 1457 of file SamFile.cpp.