// Marth Lab, Department of Biology, Boston College\r
// All rights reserved.\r
// ---------------------------------------------------------------------------\r
-// Last modified: 15 July 2010 (DB)\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
\r
// "public" interface\r
void Close(void);\r
- void Open(const string& filename, const string& samHeader, const RefVector& referenceSequences);\r
+ bool Open(const string& filename, const string& samHeader, const RefVector& referenceSequences);\r
void SaveAlignment(const BamAlignment& al);\r
\r
// internal methods\r
}\r
\r
// opens the alignment archive\r
-void BamWriter::Open(const string& filename, const string& samHeader, const RefVector& referenceSequences) {\r
- d->Open(filename, samHeader, referenceSequences);\r
+bool BamWriter::Open(const string& filename, const string& samHeader, const RefVector& referenceSequences) {\r
+ return d->Open(filename, samHeader, referenceSequences);\r
}\r
\r
// saves the alignment to the alignment archive\r
}\r
\r
// opens the alignment archive\r
-void BamWriter::BamWriterPrivate::Open(const string& filename, const string& samHeader, const RefVector& referenceSequences) {\r
+bool BamWriter::BamWriterPrivate::Open(const string& filename, const string& samHeader, const RefVector& referenceSequences) {\r
\r
- // open the BGZF file for writing\r
- mBGZF.Open(filename, "wb");\r
+ // open the BGZF file for writing, return failure if error\r
+ if ( !mBGZF.Open(filename, "wb") )\r
+ return false;\r
\r
// ================\r
// write the header\r
if (IsBigEndian) SwapEndian_32(referenceLength);\r
mBGZF.Write((char*)&referenceLength, BT_SIZEOF_INT);\r
}\r
+ \r
+ // return success\r
+ return true;\r
}\r
\r
// saves the alignment to the alignment archive\r
// Marth Lab, Department of Biology, Boston College\r
// All rights reserved.\r
// ---------------------------------------------------------------------------\r
-// Last modified: 8 December 2009 (DB)\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
// closes the alignment archive\r
void Close(void);\r
// opens the alignment archive\r
- void Open(const std::string& filename, const std::string& samHeader, const BamTools::RefVector& referenceSequences);\r
+ bool Open(const std::string& filename, const std::string& samHeader, const BamTools::RefVector& referenceSequences);\r
// saves the alignment to the alignment archive\r
void SaveAlignment(const BamTools::BamAlignment& al);\r
\r