yat  0.21pre
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
theplu::yat::omic::InBamFile Class Reference

#include <yat/omic/BamFile.h>

Inheritance diagram for theplu::yat::omic::InBamFile:
theplu::yat::omic::BamFile< InBamFile >

Public Types

typedef hts_idx_t index_type
 

Public Member Functions

 InBamFile (void)
 Default constructor.
 
 InBamFile (const std::string &fn)
 
virtual ~InBamFile (void)
 destructor
 
void build_index (void) const
 
const BamHeaderheader (void) const
 
const index_typeindex (void) const
 
uint64_t n_mapped (int tid) const
 
uint64_t n_unmapped (int tid) const
 
uint64_t n_no_coordinate (void) const
 
void open (const std::string &fn)
 Open an input bam file. More...
 
bool read (BamRead &read)
 read the next BamRead More...
 
bool read (BamRead &read, hts_itr_t *iter)
 read the next BamRead More...
 
void close (void)
 close file
 
bool have_index (void) const
 
bool is_open (void) const
 

Protected Member Functions

void build_index_base (void) const
 
void open_base (const std::string &fn, const std::string &mode, const void *aux)
 
void open_base (const std::string &fn, const std::string &mode)
 
const std::string & filename (void) const
 filename of bam file More...
 

Protected Attributes

samFile * sf_
 

Detailed Description

This class supports reading from a bam file.

Since
New in yat 0.10

Member Typedef Documentation

◆ index_type

Struct describing bam index.

See also
hts_idx_t in htslib
Since
New in yat 0.13
See also
function index(void) const

Constructor & Destructor Documentation

◆ InBamFile()

theplu::yat::omic::InBamFile::InBamFile ( const std::string &  fn)
explicit

Create an input file

Parameters
fnstring specifying the filename
See also
open(const std::string&)

Member Function Documentation

◆ build_index()

void theplu::yat::omic::InBamFile::build_index ( void  ) const
Since
New in yat 0.15

◆ build_index_base()

void theplu::yat::omic::BamFile< InBamFile >::build_index_base ( void  ) const
protectedinherited
Since
New in yat 0.15

◆ filename()

const std::string& theplu::yat::omic::BamFile< InBamFile >::filename ( void  ) const
inlineprotectedinherited

filename of bam file

The filename is set in open_base().

◆ have_index()

bool theplu::yat::omic::BamFile< InBamFile >::have_index ( void  ) const
inherited
Returns
true if file has an index file
Since
New in yat 0.15

◆ header()

const BamHeader& theplu::yat::omic::InBamFile::header ( void  ) const
Returns
header

◆ index()

const index_type* theplu::yat::omic::InBamFile::index ( void  ) const
Returns
index associated with BamFile

First time this function is called an index file is loaded from disk. If bam file is named 'foo.bam', the index file should be named 'foo.bam.bai'. If no such file exists or this bam file reads from stdin, this function throws.

◆ is_open()

bool theplu::yat::omic::BamFile< InBamFile >::is_open ( void  ) const
inherited
Returns
true iff open

◆ n_mapped()

uint64_t theplu::yat::omic::InBamFile::n_mapped ( int  tid) const
Returns
number of mapped reads in segment tid

◆ n_no_coordinate()

uint64_t theplu::yat::omic::InBamFile::n_no_coordinate ( void  ) const
Returns
number of reads with no coordinate

◆ n_unmapped()

uint64_t theplu::yat::omic::InBamFile::n_unmapped ( int  tid) const

Typically unmapped reads have same coordinate as its mate.

Returns
number of unmapped reads with segment tid

◆ open()

void theplu::yat::omic::InBamFile::open ( const std::string &  fn)

Open an input bam file.

Open a bam file named fn. If fn is "-", stdin is used.

Parameters
fnstring specifying the filename

◆ open_base() [1/2]

void theplu::yat::omic::BamFile< InBamFile >::open_base ( const std::string &  fn,
const std::string &  mode,
const void *  aux 
)
protectedinherited

open a bam file named fn with mode mode

See also
sam_open in htslib
Note
aux is ignored when compiling against htslib
Deprecated:
Provided for backward compatibility with the yat 0.17 API. Use open_base(2) instead.

◆ open_base() [2/2]

void theplu::yat::omic::BamFile< InBamFile >::open_base ( const std::string &  fn,
const std::string &  mode 
)
protectedinherited

open a bam file named fn with mode mode

See also
sam_open in htslib
Since
New in yat 0.18

◆ read() [1/2]

bool theplu::yat::omic::InBamFile::read ( BamRead read)

read the next BamRead

Returns
true on success

◆ read() [2/2]

bool theplu::yat::omic::InBamFile::read ( BamRead read,
hts_itr_t *  iter 
)

read the next BamRead

This function is used in BamReadIterator. Typically it is more convenient to read bams via a BamReadIterator than through this function directly.

Returns
true on success

Member Data Documentation

◆ sf_

samFile* theplu::yat::omic::BamFile< InBamFile >::sf_
protectedinherited

bam file handler


The documentation for this class was generated from the following file:

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14