X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2FBamMultiReader.h;h=27745628cb0f0dabf3c819d2eb659b15aca5a33b;hb=574a2bfb36f7107529e7ccda0f75e70a493460e5;hp=cc49ec8eb2076469be2585bdf978bd603acec8a3;hpb=8c80d760637f8df39262683cd2570f0589423d36;p=bamtools.git diff --git a/src/api/BamMultiReader.h b/src/api/BamMultiReader.h index cc49ec8..2774562 100644 --- a/src/api/BamMultiReader.h +++ b/src/api/BamMultiReader.h @@ -1,9 +1,8 @@ // *************************************************************************** // BamMultiReader.h (c) 2010 Erik Garrison, Derek Barnett // Marth Lab, Department of Biology, Boston College -// All rights reserved. // --------------------------------------------------------------------------- -// Last modified: 15 March 2011 (DB) +// Last modified: 14 January 2013 (DB) // --------------------------------------------------------------------------- // Convenience class for reading multiple BAM files. // *************************************************************************** @@ -11,8 +10,8 @@ #ifndef BAMMULTIREADER_H #define BAMMULTIREADER_H -#include -#include +#include "api/api_global.h" +#include "api/BamReader.h" #include #include #include @@ -26,11 +25,13 @@ namespace Internal { class API_EXPORT BamMultiReader { + // enums public: - enum SortOrder { SortedByPosition = 0 - , SortedByReadName - , Unsorted - }; + // possible merge order strategies + enum MergeOrder { RoundRobinMerge = 0 + , MergeByCoordinate + , MergeByName + }; // constructor / destructor public: @@ -45,11 +46,13 @@ class API_EXPORT BamMultiReader { // ---------------------- // closes all open BAM files - void Close(void); + bool Close(void); // close only the requested BAM file - void CloseFile(const std::string& filename); + bool CloseFile(const std::string& filename); // returns list of filenames for all open BAM files const std::vector Filenames(void) const; + // returns curent merge order strategy + BamMultiReader::MergeOrder GetMergeOrder(void) const; // returns true if multireader has any open BAM files bool HasOpenReaders(void) const; // performs random-access jump within current BAM files @@ -60,6 +63,8 @@ class API_EXPORT BamMultiReader { bool OpenFile(const std::string& filename); // returns file pointers to beginning of alignments bool Rewind(void); + // sets an explicit merge order, regardless of the BAM files' SO header tag + void SetExplicitMergeOrder(BamMultiReader::MergeOrder order); // sets the target region of interest bool SetRegion(const BamRegion& region); // sets the target region of interest @@ -74,12 +79,9 @@ class API_EXPORT BamMultiReader { // retrieves next available alignment bool GetNextAlignment(BamAlignment& alignment); - // retrieves next available alignmnet (without populating the alignment's string data fields) + // retrieves next available alignment (without populating the alignment's string data fields) bool GetNextAlignmentCore(BamAlignment& alignment); - // sets the expected sorting order for reading across multiple BAM files - void SetSortOrder(const SortOrder& order); - // ---------------------- // access auxiliary data // ---------------------- @@ -107,15 +109,13 @@ class API_EXPORT BamMultiReader { bool LocateIndexes(const BamIndex::IndexType& preferredType = BamIndex::STANDARD); // opens index files for current BAM files. bool OpenIndexes(const std::vector& indexFilenames); - // changes the caching behavior of the index data - void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode); - // deprecated methods - public: - // returns \c true if all BAM files have index data available. - bool IsIndexLoaded(void) const; - // convenience method for printing filenames to stdout - void PrintFilenames(void) const; + // ---------------------- + // error handling + // ---------------------- + + // returns a human-readable description of the last error that occurred + std::string GetErrorString(void) const; // private implementation private: