// BamWriter.cpp (c) 2009 Michael Str�mberg, Derek Barnett\r
// Marth Lab, Department of Biology, Boston College\r
// ---------------------------------------------------------------------------\r
-// Last modified: 4 March 2011 (DB)\r
+// Last modified: 25 October 2011 (DB)\r
// ---------------------------------------------------------------------------\r
// Provides the basic functionality for producing BAM files\r
// ***************************************************************************\r
\r
-#include <api/BamAlignment.h>\r
-#include <api/BamWriter.h>\r
-#include <api/SamHeader.h>\r
-#include <api/internal/BamWriter_p.h>\r
+#include "api/BamAlignment.h"\r
+#include "api/BamWriter.h"\r
+#include "api/SamHeader.h"\r
+#include "api/internal/bam/BamWriter_p.h"\r
using namespace BamTools;\r
using namespace BamTools::Internal;\r
-\r
-#include <iostream>\r
using namespace std;\r
\r
/*! \class BamTools::BamWriter\r
d->Close();\r
}\r
\r
+/*! \fn std::string BamWriter::GetErrorString(void) const\r
+ \brief Returns a human-readable description of the last error that occurred\r
+\r
+ This method allows elimination of STDERR pollution. Developers of client code\r
+ may choose how the messages are displayed to the user, if at all.\r
+\r
+ \return error description\r
+*/\r
+std::string BamWriter::GetErrorString(void) const {\r
+ return d->GetErrorString();\r
+}\r
+\r
/*! \fn bool BamWriter::IsOpen(void) const\r
\brief Returns \c true if BAM file is open for writing.\r
\sa Open()\r
\r
Will overwrite the BAM file if it already exists.\r
\r
- \param filename name of output BAM file\r
- \param samHeaderText header data, as SAM-formatted string\r
- \param referenceSequences list of reference entries\r
+ \param[in] filename name of output BAM file\r
+ \param[in] samHeaderText header data, as SAM-formatted string\r
+ \param[in] referenceSequences list of reference entries\r
\r
\return \c true if opened successfully\r
\sa Close(), IsOpen(), BamReader::GetHeaderText(), BamReader::GetReferenceData()\r
\r
Will overwrite the BAM file if it already exists.\r
\r
- \param filename name of output BAM file\r
- \param samHeader header data, wrapped in SamHeader object\r
- \param referenceSequences list of reference entries\r
+ \param[in] filename name of output BAM file\r
+ \param[in] samHeader header data, wrapped in SamHeader object\r
+ \param[in] referenceSequences list of reference entries\r
\r
\return \c true if opened successfully\r
\sa Close(), IsOpen(), BamReader::GetHeader(), BamReader::GetReferenceData()\r
/*! \fn void BamWriter::SaveAlignment(const BamAlignment& alignment)\r
\brief Saves an alignment to the BAM file.\r
\r
- \param alignment BamAlignment record to save\r
+ \param[in] alignment BamAlignment record to save\r
\sa BamReader::GetNextAlignment(), BamReader::GetNextAlignmentCore()\r
*/\r
-void BamWriter::SaveAlignment(const BamAlignment& alignment) {\r
- d->SaveAlignment(alignment);\r
+bool BamWriter::SaveAlignment(const BamAlignment& alignment) {\r
+ return d->SaveAlignment(alignment);\r
}\r
\r
-/*! \fn void BamWriter::SetCompressionMode(const CompressionMode& compressionMode)\r
+/*! \fn void BamWriter::SetCompressionMode(const BamWriter::CompressionMode& compressionMode)\r
\brief Sets the output compression mode.\r
\r
Default mode is BamWriter::Compressed.\r
\r
- N.B. - Changing the compression mode is disabled on open files (i.e. the request will be ignored).\r
- Be sure to call this function before opening the BAM file.\r
+ \note Changing the compression mode is disabled on open files (i.e. the request will\r
+ be ignored). Be sure to call this function before opening the BAM file.\r
\r
\code\r
BamWriter writer;\r
// ...\r
\endcode\r
\r
- \param compressionMode desired output compression behavior\r
+ \param[in] compressionMode desired output compression behavior\r
\sa IsOpen(), Open()\r
*/\r
-void BamWriter::SetCompressionMode(const CompressionMode& compressionMode) {\r
+void BamWriter::SetCompressionMode(const BamWriter::CompressionMode& compressionMode) {\r
d->SetWriteCompressed( compressionMode == BamWriter::Compressed );\r
}\r