X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2FBamWriter.h;h=68257ee4a8a3e3145090154cd93fb601a1ca2666;hb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;hp=910f9be6240fa40a0fe9ecefe2da52ad564cdb6c;hpb=e24bc523b0bd086dbfad7165901b2237b5d64316;p=bamtools.git diff --git a/src/api/BamWriter.h b/src/api/BamWriter.h index 910f9be..68257ee 100644 --- a/src/api/BamWriter.h +++ b/src/api/BamWriter.h @@ -1,12 +1,8 @@ // *************************************************************************** // BamWriter.h (c) 2009 Michael Str�mberg, Derek Barnett // Marth Lab, Department of Biology, Boston College -// All rights reserved. // --------------------------------------------------------------------------- -// Last modified: 19 November 2010 (DB) -// --------------------------------------------------------------------------- -// Uses BGZF routines were adapted from the bgzf.c code developed at the Broad -// Institute. +// Last modified: 10 October 2011 (DB) // --------------------------------------------------------------------------- // Provides the basic functionality for producing BAM files // *************************************************************************** @@ -14,35 +10,58 @@ #ifndef BAMWRITER_H #define BAMWRITER_H -#include -#include +#include "api/api_global.h" +#include "api/BamAux.h" #include namespace BamTools { +class BamAlignment; +class SamHeader; + +//! \cond +namespace Internal { + class BamWriterPrivate; +} // namespace Internal +//! \endcond + class API_EXPORT BamWriter { - // constructor/destructor + // enums + public: + enum CompressionMode { Compressed = 0 + , Uncompressed + }; + + // ctor & dtor public: BamWriter(void); ~BamWriter(void); // public interface public: - // closes the alignment archive + // closes the current BAM file void Close(void); - // opens the alignment archive + // returns a human-readable description of the last error that occurred + std::string GetErrorString(void) const; + // returns true if BAM file is open for writing + bool IsOpen(void) const; + // opens a BAM file for writing bool Open(const std::string& filename, - const std::string& samHeader, - const BamTools::RefVector& referenceSequences, - bool writeUncompressed = false); + const std::string& samHeaderText, + const RefVector& referenceSequences); + // opens a BAM file for writing + bool Open(const std::string& filename, + const SamHeader& samHeader, + const RefVector& referenceSequences); // saves the alignment to the alignment archive - void SaveAlignment(const BamTools::BamAlignment& al); + bool SaveAlignment(const BamAlignment& alignment); + // sets the output compression mode + void SetCompressionMode(const BamWriter::CompressionMode& compressionMode); // private implementation private: - struct BamWriterPrivate; - BamWriterPrivate* d; + Internal::BamWriterPrivate* d; }; } // namespace BamTools