X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2FBamWriter.cpp;h=b1582a86a8236ff4d9bca170b06a4148f4870dd5;hb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;hp=8bf6f18c5caf31c404d88cb24ca2020996a128e7;hpb=1a93ff03d7e40d97c32e6f5966045ceaeb2f038a;p=bamtools.git diff --git a/src/api/BamWriter.cpp b/src/api/BamWriter.cpp index 8bf6f18..b1582a8 100644 --- a/src/api/BamWriter.cpp +++ b/src/api/BamWriter.cpp @@ -2,19 +2,17 @@ // BamWriter.cpp (c) 2009 Michael Str�mberg, Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 4 March 2011 (DB) +// Last modified: 10 October 2011 (DB) // --------------------------------------------------------------------------- // Provides the basic functionality for producing BAM files // *************************************************************************** -#include -#include -#include -#include +#include "api/BamAlignment.h" +#include "api/BamWriter.h" +#include "api/SamHeader.h" +#include "api/internal/BamWriter_p.h" using namespace BamTools; using namespace BamTools::Internal; - -#include using namespace std; /*! \class BamTools::BamWriter @@ -57,6 +55,18 @@ void BamWriter::Close(void) { d->Close(); } +/*! \fn std::string BamWriter::GetErrorString(void) const + \brief Returns a human-readable description of the last error that occurred + + This method allows elimination of STDERR pollution. Developers of client code + may choose how the messages are displayed to the user, if at all. + + \return error description +*/ +std::string BamWriter::GetErrorString(void) const { + return d->GetErrorString(); +} + /*! \fn bool BamWriter::IsOpen(void) const \brief Returns \c true if BAM file is open for writing. \sa Open() @@ -72,9 +82,9 @@ bool BamWriter::IsOpen(void) const { Will overwrite the BAM file if it already exists. - \param filename name of output BAM file - \param samHeaderText header data, as SAM-formatted string - \param referenceSequences list of reference entries + \param[in] filename name of output BAM file + \param[in] samHeaderText header data, as SAM-formatted string + \param[in] referenceSequences list of reference entries \return \c true if opened successfully \sa Close(), IsOpen(), BamReader::GetHeaderText(), BamReader::GetReferenceData() @@ -95,9 +105,9 @@ bool BamWriter::Open(const std::string& filename, Will overwrite the BAM file if it already exists. - \param filename name of output BAM file - \param samHeader header data, wrapped in SamHeader object - \param referenceSequences list of reference entries + \param[in] filename name of output BAM file + \param[in] samHeader header data, wrapped in SamHeader object + \param[in] referenceSequences list of reference entries \return \c true if opened successfully \sa Close(), IsOpen(), BamReader::GetHeader(), BamReader::GetReferenceData() @@ -112,20 +122,20 @@ bool BamWriter::Open(const std::string& filename, /*! \fn void BamWriter::SaveAlignment(const BamAlignment& alignment) \brief Saves an alignment to the BAM file. - \param alignment BamAlignment record to save + \param[in] alignment BamAlignment record to save \sa BamReader::GetNextAlignment(), BamReader::GetNextAlignmentCore() */ -void BamWriter::SaveAlignment(const BamAlignment& alignment) { - d->SaveAlignment(alignment); +bool BamWriter::SaveAlignment(const BamAlignment& alignment) { + return d->SaveAlignment(alignment); } -/*! \fn void BamWriter::SetCompressionMode(const CompressionMode& compressionMode) +/*! \fn void BamWriter::SetCompressionMode(const BamWriter::CompressionMode& compressionMode) \brief Sets the output compression mode. Default mode is BamWriter::Compressed. - N.B. - Changing the compression mode is disabled on open files (i.e. the request will be ignored). - Be sure to call this function before opening the BAM file. + \note Changing the compression mode is disabled on open files (i.e. the request will + be ignored). Be sure to call this function before opening the BAM file. \code BamWriter writer; @@ -134,9 +144,9 @@ void BamWriter::SaveAlignment(const BamAlignment& alignment) { // ... \endcode - \param compressionMode desired output compression behavior + \param[in] compressionMode desired output compression behavior \sa IsOpen(), Open() */ -void BamWriter::SetCompressionMode(const CompressionMode& compressionMode) { +void BamWriter::SetCompressionMode(const BamWriter::CompressionMode& compressionMode) { d->SetWriteCompressed( compressionMode == BamWriter::Compressed ); }