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

#include <yat/omic/BamFile.h>

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

Classes

class  error
 Error thrown from OutBamFile::write(const BamRead&) at failure. More...
 

Public Member Functions

 OutBamFile (void)
 
 OutBamFile (const std::string &, const BamHeader &header)
 Create an output bam file. More...
 
 OutBamFile (const std::string &, const BamHeader &header, unsigned int compression)
 Create an output bam file. More...
 
void build_index (void) const
 
void open (const std::string &fn, const BamHeader &hdr)
 Open an output bam file. More...
 
void open (const std::string &fn, const BamHeader &hdr, unsigned int compression)
 Open an output bam file. More...
 
void write (const BamRead &read)
 write a read to output file 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 writing to a bam file.

Since
New in yat 0.10

Constructor & Destructor Documentation

◆ OutBamFile() [1/3]

theplu::yat::omic::OutBamFile::OutBamFile ( void  )

Create an output bam file

◆ OutBamFile() [2/3]

theplu::yat::omic::OutBamFile::OutBamFile ( const std::string &  ,
const BamHeader header 
)

Create an output bam file.

Equivalent to default constructor followed by a call to open(2).

See also
open(const std::string&, const BamHeader&)

◆ OutBamFile() [3/3]

theplu::yat::omic::OutBamFile::OutBamFile ( const std::string &  ,
const BamHeader header,
unsigned int  compression 
)

Create an output bam file.

Equivalent to default constructor followed by a call to open(3).

See also
open(const std::string&, const BamHeader&, unsigned int)
Since
yat 0.12

Member Function Documentation

◆ build_index()

void theplu::yat::omic::OutBamFile::build_index ( void  ) const
Since
New in yat 0.15
Exceptions
iffile is open (
See also
is_open())

◆ build_index_base()

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

◆ filename()

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

filename of bam file

The filename is set in open_base().

◆ have_index()

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

◆ is_open()

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

◆ open() [1/2]

void theplu::yat::omic::OutBamFile::open ( const std::string &  fn,
const BamHeader hdr 
)

Open an output bam file.

Opens an output bam file and writes the header contained in hdr. If fn is "-", stdout is used.

Parameters
fnstring specifying the filename
hdrheader

◆ open() [2/2]

void theplu::yat::omic::OutBamFile::open ( const std::string &  fn,
const BamHeader hdr,
unsigned int  compression 
)

Open an output bam file.

Opens an output bam file and writes the header contained in hdr. If fn is "-", stdout is used.

Parameters
fnstring specifying the filename
hdrheader
compressiona number [0,9] indicating level of compression. 9 gives highest compression and 0 indicates no compression (suitable for piping between applications).
Since
yat 0.12

◆ open_base() [1/2]

void theplu::yat::omic::BamFile< OutBamFile >::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< OutBamFile >::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

◆ write()

void theplu::yat::omic::OutBamFile::write ( const BamRead read)

write a read to output file

Exceptions
OutBamFile::errorif write failed
Since
yat 0.12

Member Data Documentation

◆ sf_

samFile* theplu::yat::omic::BamFile< OutBamFile >::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