1 #ifndef theplu_yat_omic_bam_file
2 #define theplu_yat_omic_bam_file
25 #include "BamHeader.h"
27 #include "config_bam.h"
29 #include "yat/utility/Exception.h"
30 #include "yat/utility/yat_assert.h"
32 #include YAT_SAM_HEADER
34 #include <boost/utility.hpp>
50 template<
typename Derived>
53 typedef Derived derived_type;
84 void open_base(
const std::string& fn,
const std::string& mode,
87 #ifndef YAT_HAVE_HTSLIB
94 typedef samfile_t samFile;
107 const std::string&
filename(
void)
const {
return filename_; }
109 std::string filename_;
150 explicit InBamFile(
const std::string& fn);
196 void open(
const std::string& fn);
220 uint64_t get_idx_stat(
int tid,
bool return_mapped)
const;
261 unsigned int compression);
289 unsigned int compression);
310 virtual ~error(
void)
throw();
324 template<
class Derived>
329 template<
class Derived>
336 template<
class Derived>
351 template<
class Derived>
358 template<
class Derived>
360 const std::string& mode,
366 YAT_ASSERT(aux==NULL);
367 sf_ = sam_open(fn.c_str(), mode.c_str());
369 sf_ = samopen(fn.c_str(), mode.c_str(), aux);
372 std::ostringstream ss;
373 ss <<
"failed open '" << fn <<
"'";
void write(const BamRead &read)
write a read to output file
virtual ~InBamFile(void)
destructor
const BamRead & read(void) const
uint64_t n_no_coordinate(void) const
void open_base(const std::string &fn, const std::string &mode, const void *aux)
Definition: BamFile.h:359
const std::string & filename(void) const
filename of bam file
Definition: BamFile.h:107
Error thrown from OutBamFile::write(const BamRead&) at failure.
Definition: BamFile.h:303
BamFile(void)
Definition: BamFile.h:325
Class holding a bam query.
Definition: BamRead.h:53
void open(const std::string &fn)
Open an input bam file.
bool is_open(void) const
Definition: BamFile.h:352
Class used for all runtime error detected within yat library.
Definition: Exception.h:38
uint64_t n_unmapped(int tid) const
samFile * sf_
Definition: BamFile.h:100
virtual ~error(void)
Destructor.
InBamFile(void)
Default constructor.
Class to report errors associated with IO operations.
Definition: Exception.h:109
const BamHeader & header(void) const
void close(void)
close file
Definition: BamFile.h:337
virtual ~BamFile(void)
Destructor.
Definition: BamFile.h:330
Definition: BamFile.h:233
void open(const std::string &fn, const BamHeader &hdr)
Open an output bam file.
const index_type * index(void) const
Definition: BamFile.h:118
hts_idx_t index_type
Definition: BamFile.h:133
error(const BamRead &)
Constructor.
uint64_t n_mapped(int tid) const
bool read(BamRead &read)
read the next BamRead