1 // ***************************************************************************
\r
2 // BamReader.h (c) 2009 Derek Barnett, Michael Str�mberg
\r
3 // Marth Lab, Department of Biology, Boston College
\r
4 // All rights reserved.
\r
5 // ---------------------------------------------------------------------------
\r
6 // Last modified: 30 March 2010 (DB)
\r
7 // ---------------------------------------------------------------------------
\r
8 // Uses BGZF routines were adapted from the bgzf.c code developed at the Broad
\r
10 // ---------------------------------------------------------------------------
\r
11 // Provides the basic functionality for reading BAM files
\r
12 // ***************************************************************************
\r
20 // BamTools includes
\r
23 namespace BamTools {
\r
27 // constructor / destructor
\r
35 // ----------------------
\r
36 // BAM file operations
\r
37 // ----------------------
\r
41 // performs random-access jump to reference, position
\r
42 bool Jump(int refID, int position = 0);
\r
43 // opens BAM file (and optional BAM index file, if provided)
\r
44 void Open(const std::string& filename, const std::string& indexFilename = "");
\r
45 // returns file pointer to beginning of alignments
\r
48 // ----------------------
\r
49 // access alignment data
\r
50 // ----------------------
\r
52 // retrieves next available alignment (returns success/fail)
\r
53 bool GetNextAlignment(BamAlignment& bAlignment);
\r
55 // ----------------------
\r
56 // access auxiliary data
\r
57 // ----------------------
\r
59 // returns SAM header text
\r
60 const std::string GetHeaderText(void) const;
\r
61 // returns number of reference sequences
\r
62 int GetReferenceCount(void) const;
\r
63 // returns vector of reference objects
\r
64 const BamTools::RefVector GetReferenceData(void) const;
\r
65 // returns reference id (used for BamReader::Jump()) for the given reference name
\r
66 int GetReferenceID(const std::string& refName) const;
\r
68 // ----------------------
\r
69 // BAM index operations
\r
70 // ----------------------
\r
72 // creates index for BAM file, saves to file (default = bamFilename + ".bai")
\r
73 bool CreateIndex(void);
\r
75 // private implementation
\r
77 struct BamReaderPrivate;
\r
78 BamReaderPrivate* d;
\r
81 } // namespace BamTools
\r
83 #endif // BAMREADER_H
\r