// ***************************************************************************\r
// BamWriter.h (c) 2009 Michael Str�mberg, Derek Barnett\r
// Marth Lab, Department of Biology, Boston College\r
-// All rights reserved.\r
// ---------------------------------------------------------------------------\r
-// Last modified: 17 August 2010 (DB)\r
-// ---------------------------------------------------------------------------\r
-// Uses BGZF routines were adapted from the bgzf.c code developed at the Broad\r
-// Institute.\r
+// Last modified: 10 October 2011 (DB)\r
// ---------------------------------------------------------------------------\r
// Provides the basic functionality for producing BAM files\r
// ***************************************************************************\r
#ifndef BAMWRITER_H\r
#define BAMWRITER_H\r
\r
-// C++ includes\r
+#include "api/api_global.h"\r
+#include "api/BamAux.h"\r
#include <string>\r
\r
-// BamTools includes\r
-#include "BamAux.h"\r
-\r
namespace BamTools {\r
\r
-class BamWriter {\r
+class BamAlignment;\r
+class SamHeader;\r
+\r
+//! \cond\r
+namespace Internal {\r
+ class BamWriterPrivate;\r
+} // namespace Internal\r
+//! \endcond\r
+\r
+class API_EXPORT BamWriter {\r
+\r
+ // enums\r
+ public:\r
+ enum CompressionMode { Compressed = 0\r
+ , Uncompressed\r
+ };\r
\r
- // constructor/destructor\r
+ // ctor & dtor\r
public:\r
BamWriter(void);\r
~BamWriter(void);\r
\r
// public interface\r
public:\r
- // closes the alignment archive\r
+ // closes the current BAM file\r
void Close(void);\r
- // opens the alignment archive\r
+ // returns a human-readable description of the last error that occurred\r
+ std::string GetErrorString(void) const;\r
+ // returns true if BAM file is open for writing\r
+ bool IsOpen(void) const;\r
+ // opens a BAM file for writing\r
bool Open(const std::string& filename, \r
- const std::string& samHeader, \r
- const BamTools::RefVector& referenceSequences, \r
- bool writeUncompressed = false);\r
+ const std::string& samHeaderText,\r
+ const RefVector& referenceSequences);\r
+ // opens a BAM file for writing\r
+ bool Open(const std::string& filename,\r
+ const SamHeader& samHeader,\r
+ const RefVector& referenceSequences);\r
// saves the alignment to the alignment archive\r
- void SaveAlignment(const BamTools::BamAlignment& al);\r
+ bool SaveAlignment(const BamAlignment& alignment);\r
+ // sets the output compression mode\r
+ void SetCompressionMode(const BamWriter::CompressionMode& compressionMode);\r
\r
// private implementation\r
private:\r
- struct BamWriterPrivate;\r
- BamWriterPrivate* d;\r
+ Internal::BamWriterPrivate* d;\r
};\r
\r
} // namespace BamTools\r