Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
gamgee::SamWriter Class Reference

utility class to write out a SAM/BAM/CRAM file to any stream More...

#include <sam_writer.h>

Public Member Functions

 SamWriter (const std::string &output_fname="-", const bool binary=true)
 Creates a new SamWriter using the specified output file name. More...
 
 SamWriter (const SamHeader &header, const std::string &output_fname="-", const bool binary=true)
 Creates a new SamWriter with the header extracted from a Sam record and using the specified output file name. More...
 
 SamWriter (const SamWriter &other)=delete
 a SamWriter cannot be copied safely, as it is iterating over a stream. More...
 
SamWriteroperator= (const SamWriter &other)=delete
 
 SamWriter (SamWriter &&other)=default
 a SamWriter can be moved More...
 
SamWriteroperator= (SamWriter &&other)=default
 
void add_record (const Sam &body)
 Adds a record to the file stream. More...
 
void add_header (const SamHeader &header)
 Adds a header to the file stream. More...
 

Detailed Description

utility class to write out a SAM/BAM/CRAM file to any stream

Todo:
add serialization option

Constructor & Destructor Documentation

gamgee::SamWriter::SamWriter ( const std::string &  output_fname = "-",
const bool  binary = true 
)
explicit

Creates a new SamWriter using the specified output file name.

Parameters
output_fnamefile to write to. The default is stdout (as defined by htslib)
binarywhether the output should be in BAM (true) or SAM format (false)
Note
the header is copied and managed internally
gamgee::SamWriter::SamWriter ( const SamHeader header,
const std::string &  output_fname = "-",
const bool  binary = true 
)
explicit

Creates a new SamWriter with the header extracted from a Sam record and using the specified output file name.

Parameters
headerSamHeader object to make a copy from
output_fnamefile to write to. The default is stdout (as defined by htslib)
binarywhether the output should be in BAM (true) or SAM format (false)
Note
the header is copied and managed internally
gamgee::SamWriter::SamWriter ( const SamWriter other)
delete

a SamWriter cannot be copied safely, as it is iterating over a stream.

gamgee::SamWriter::SamWriter ( SamWriter &&  other)
default

a SamWriter can be moved

Member Function Documentation

void gamgee::SamWriter::add_header ( const SamHeader header)

Adds a header to the file stream.

Parameters
headerthe header
Note
the header is a requirement to add records
void gamgee::SamWriter::add_record ( const Sam body)

Adds a record to the file stream.

Parameters
bodythe record
SamWriter& gamgee::SamWriter::operator= ( const SamWriter other)
delete
SamWriter& gamgee::SamWriter::operator= ( SamWriter &&  other)
default

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