BamTools  2.4.1
BamWriter.h
Go to the documentation of this file.
1 // ***************************************************************************
2 // BamWriter.h (c) 2009 Michael Str�mberg, Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides the basic functionality for producing BAM files
8 // ***************************************************************************
9 
10 #ifndef BAMWRITER_H
11 #define BAMWRITER_H
12 
13 #include "api/api_global.h"
14 #include "api/BamAux.h"
15 #include <string>
16 
17 namespace BamTools {
18 
19 class BamAlignment;
20 struct SamHeader;
21 
23 namespace Internal {
24  class BamWriterPrivate;
25 } // namespace Internal
27 
29 
30  // enums
31  public:
32  enum CompressionMode { Compressed = 0
33  , Uncompressed
34  };
35 
36  // ctor & dtor
37  public:
38  BamWriter(void);
39  ~BamWriter(void);
40 
41  // public interface
42  public:
43  // closes the current BAM file
44  void Close(void);
45  // returns a human-readable description of the last error that occurred
46  std::string GetErrorString(void) const;
47  // returns true if BAM file is open for writing
48  bool IsOpen(void) const;
49  // opens a BAM file for writing
50  bool Open(const std::string& filename,
51  const std::string& samHeaderText,
52  const RefVector& referenceSequences);
53  // opens a BAM file for writing
54  bool Open(const std::string& filename,
55  const SamHeader& samHeader,
56  const RefVector& referenceSequences);
57  // saves the alignment to the alignment archive
58  bool SaveAlignment(const BamAlignment& alignment);
59  // sets the output compression mode
60  void SetCompressionMode(const BamWriter::CompressionMode& compressionMode);
61 
62  // private implementation
63  private:
64  Internal::BamWriterPrivate* d;
65 };
66 
67 } // namespace BamTools
68 
69 #endif // BAMWRITER_H
The main BAM alignment data structure.
Definition: BamAlignment.h:32
Provides write access for generating BAM files.
Definition: BamWriter.h:28
#define API_EXPORT
Definition: api_global.h:18
Represents the SAM-formatted text header that is part of the BAM file header.
Definition: SamHeader.h:24
CompressionMode
This enum describes the compression behaviors for output BAM files.
Definition: BamWriter.h:32
Contains all BamTools classes & methods.
Definition: Sort.h:24
std::vector< RefData > RefVector
convenience typedef for vector of RefData entries
Definition: BamAux.h:74