BamWriter.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 // BamWriter.h (c) 2009 Michael Str�mberg, Derek Barnett
00003 // Marth Lab, Department of Biology, Boston College
00004 // ---------------------------------------------------------------------------
00005 // Last modified: 10 October 2011 (DB)
00006 // ---------------------------------------------------------------------------
00007 // Provides the basic functionality for producing BAM files
00008 // ***************************************************************************
00009 
00010 #ifndef BAMWRITER_H
00011 #define BAMWRITER_H
00012 
00013 #include "api/api_global.h"
00014 #include "api/BamAux.h"
00015 #include <string>
00016 
00017 namespace BamTools {
00018 
00019 class BamAlignment;
00020 class SamHeader;
00021 
00023 namespace Internal {
00024     class BamWriterPrivate;
00025 } // namespace Internal
00027 
00028 class API_EXPORT BamWriter {
00029 
00030     // enums
00031     public:
00032         enum CompressionMode { Compressed = 0
00033                              , Uncompressed
00034                              };
00035 
00036     // ctor & dtor
00037     public:
00038         BamWriter(void);
00039         ~BamWriter(void);
00040 
00041     // public interface
00042     public:
00043         //  closes the current BAM file
00044         void Close(void);
00045         // returns a human-readable description of the last error that occurred
00046         std::string GetErrorString(void) const;
00047         // returns true if BAM file is open for writing
00048         bool IsOpen(void) const;
00049         // opens a BAM file for writing
00050         bool Open(const std::string& filename, 
00051                   const std::string& samHeaderText,
00052                   const RefVector& referenceSequences);
00053         // opens a BAM file for writing
00054         bool Open(const std::string& filename,
00055                   const SamHeader& samHeader,
00056                   const RefVector& referenceSequences);
00057         // saves the alignment to the alignment archive
00058         bool SaveAlignment(const BamAlignment& alignment);
00059         // sets the output compression mode
00060         void SetCompressionMode(const BamWriter::CompressionMode& compressionMode);
00061 
00062     // private implementation
00063     private:
00064         Internal::BamWriterPrivate* d;
00065 };
00066 
00067 } // namespace BamTools
00068 
00069 #endif // BAMWRITER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Aug 29 17:43:46 2012 for BamTools by  doxygen 1.6.3