BamTools 2.5.2
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 <string>
14#include "api/BamAux.h"
15#include "api/api_global.h"
16
17namespace BamTools {
18
19class BamAlignment;
20struct SamHeader;
21
23namespace Internal {
24class BamWriterPrivate;
25} // namespace Internal
27
28class API_EXPORT BamWriter
29{
30
31 // enums
32public:
34 {
35 Compressed = 0,
36 Uncompressed
37 };
38
39 // ctor & dtor
40public:
41 BamWriter();
42 ~BamWriter();
43
44 // public interface
45public:
46 // closes the current BAM file
47 void Close();
48 // returns a human-readable description of the last error that occurred
49 std::string GetErrorString() const;
50 // returns true if BAM file is open for writing
51 bool IsOpen() const;
52 // opens a BAM file for writing
53 bool Open(const std::string& filename, const std::string& samHeaderText,
54 const RefVector& referenceSequences);
55 // opens a BAM file for writing
56 bool Open(const std::string& filename, const SamHeader& samHeader,
57 const RefVector& referenceSequences);
58 // saves the alignment to the alignment archive
59 bool SaveAlignment(const BamAlignment& alignment);
60 // sets the output compression mode
61 void SetCompressionMode(const BamWriter::CompressionMode& compressionMode);
62
63 // private implementation
64private:
65 Internal::BamWriterPrivate* d;
66};
67
68} // namespace BamTools
69
70#endif // BAMWRITER_H
The main BAM alignment data structure.
Definition: BamAlignment.h:34
Provides write access for generating BAM files.
Definition: BamWriter.h:29
CompressionMode
This enum describes the compression behaviors for output BAM files.
Definition: BamWriter.h:34
Contains all BamTools classes & methods.
Definition: Sort.h:24
std::vector< RefData > RefVector
convenience typedef for vector of RefData entries
Definition: BamAux.h:75
Represents the SAM-formatted text header that is part of the BAM file header.
Definition: SamHeader.h:24