// Marth Lab, Department of Biology, Boston College\r
// All rights reserved.\r
// ---------------------------------------------------------------------------\r
-// Last modified: 27 July 2010 (DB)\r
+// Last modified: 3 September 2010 (DB)\r
// ---------------------------------------------------------------------------\r
// Provides the basic constants, data structures, etc. for using BAM files\r
// ***************************************************************************\r
\r
// C++ includes\r
#include <exception>\r
+#include <fstream>\r
+#include <iostream>\r
#include <map>\r
#include <string>\r
#include <utility>\r
SwapEndian_64(value);\r
}\r
\r
+inline bool FileExists(const std::string& filename) {\r
+ std::ifstream f(filename.c_str(), std::ifstream::in);\r
+ return !f.fail();\r
+}\r
+\r
// ----------------------------------------------------------------\r
// BamAlignment member methods\r
\r
case 'f':\r
case 'Z':\r
case 'H':\r
- printf("ERROR: Cannot store tag of type %c in integer destination\n", type);\r
+ fprintf(stderr, "ERROR: Cannot store tag of type %c in integer destination\n", type);\r
return false;\r
\r
// unknown tag type\r
default:\r
- printf("ERROR: Unknown tag storage class encountered: [%c]\n", type);\r
+ fprintf(stderr, "ERROR: Unknown tag storage class encountered: [%c]\n", type);\r
return false;\r
}\r
\r
// unsupported type (var-length strings)\r
case 'Z':\r
case 'H':\r
- printf("ERROR: Cannot store tag of type %c in integer destination\n", type);\r
+ fprintf(stderr, "ERROR: Cannot store tag of type %c in integer destination\n", type);\r
return false;\r
\r
// unknown tag type\r
default:\r
- printf("ERROR: Unknown tag storage class encountered: [%c]\n", type);\r
+ fprintf(stderr, "ERROR: Unknown tag storage class encountered: [%c]\n", type);\r
return false;\r
}\r
\r
\r
default: \r
// error case\r
- printf("ERROR: Unknown tag storage class encountered: [%c]\n", storageType);\r
+ fprintf(stderr, "ERROR: Unknown tag storage class encountered: [%c]\n", storageType);\r
return false;\r
}\r
\r