1 // ***************************************************************************
2 // bamtools_utilities.h (c) 2010 Derek Barnett, Erik Garrison
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 23 September 2010
7 // ---------------------------------------------------------------------------
8 // Provides general utilities used by BamTools sub-tools.
9 // ***************************************************************************
11 #ifndef BAMTOOLS_UTILITIES_H
12 #define BAMTOOLS_UTILITIES_H
19 #define BAMTOOLS_ASSERT_UNREACHABLE assert( false )
20 #define BAMTOOLS_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
30 // check if a file exists
31 static bool FileExists(const std::string& fname);
33 // Parses a region string, uses reader to do validation (valid ID's, positions), stores in Region struct
34 // Returns success (true/false)
35 static bool ParseRegionString(const std::string& regionString, const BamReader& reader, BamRegion& region);
36 // Same as above, but accepts a BamMultiReader
37 static bool ParseRegionString(const std::string& regionString, const BamMultiReader& reader, BamRegion& region);
40 static void Reverse(std::string& sequence);
41 static void ReverseComplement(std::string& sequence);
44 } // namespace BamTools
46 #endif // BAMTOOLS_UTILITIES_H