vcfpp
Public Member Functions | Public Attributes | List of all members
vcfpp::BcfWriter Class Reference

Stream out variants to compressed/uncompressed VCF/BCF file or stdout. More...

#include <vcfpp.h>

Public Member Functions

 BcfWriter ()
 Construct an empty BcfWriter.
 
 BcfWriter (const std::string &fname, std::string version="VCF4.1")
 Open VCF/BCF file for writing. The format is infered from file's suffix. More...
 
 BcfWriter (const std::string &fname, const BcfHeader &h)
 Open VCF/BCF file for writing. The format is infered from file's suffix. More...
 
 BcfWriter (const std::string &fname, const std::string &version, const std::string &mode)
 Open VCF/BCF file for writing using given mode. More...
 
 BcfWriter (const std::string &fname, const BcfHeader &h, const std::string &mode)
 Open VCF/BCF file for writing using given mode. More...
 
void open (const std::string &fname)
 Open VCF/BCF file for writing. The format is infered from file's suffix. More...
 
void open (const std::string &fname, const std::string &mode)
 Open VCF/BCF file for writing using given mode. More...
 
void close ()
 close the BcfWriter object.
 
void initalHeader (std::string version="VCF4.1")
 initial a VCF header using the internal template given a specific version. VCF4.1 is the default
 
void initalHeader (const BcfHeader &h)
 initial a VCF header by pointing to header of another VCF
 
void copyHeader (const std::string &vcffile)
 copy header of given VCF
 
void writeLine (const std::string &vcfline)
 copy a string to a vcf line
 
bool writeHeader ()
 streams out the header
 
bool writeRecord (BcfRecord &v)
 streams out the given variant of BcfRecord type
 

Public Attributes

BcfHeader header
 header object initialized by initalHeader
 

Detailed Description

Stream out variants to compressed/uncompressed VCF/BCF file or stdout.

Constructor & Destructor Documentation

◆ BcfWriter() [1/4]

vcfpp::BcfWriter::BcfWriter ( const std::string &  fname,
std::string  version = "VCF4.1" 
)
inline

Open VCF/BCF file for writing. The format is infered from file's suffix.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files
versionThe output header is constructed with the internal template given a specific version

◆ BcfWriter() [2/4]

vcfpp::BcfWriter::BcfWriter ( const std::string &  fname,
const BcfHeader h 
)
inline

Open VCF/BCF file for writing. The format is infered from file's suffix.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files
hThe output header is pointing to the given BcfHeader object

◆ BcfWriter() [3/4]

vcfpp::BcfWriter::BcfWriter ( const std::string &  fname,
const std::string &  version,
const std::string &  mode 
)
inline

Open VCF/BCF file for writing using given mode.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files
versionThe output header is constructed with the internal template given a specific version
modeMode matching
[w]b .. compressed BCF
[w]bu .. uncompressed BCF
[w]z .. compressed VCF
[w] .. uncompressed VCF

◆ BcfWriter() [4/4]

vcfpp::BcfWriter::BcfWriter ( const std::string &  fname,
const BcfHeader h,
const std::string &  mode 
)
inline

Open VCF/BCF file for writing using given mode.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files
hThe output header is pointing to the given BcfHeader object
modeMode matching
[w]b .. compressed BCF
[w]bu .. uncompressed BCF
[w]z .. compressed VCF
[w] .. uncompressed VCF

Member Function Documentation

◆ open() [1/2]

void vcfpp::BcfWriter::open ( const std::string &  fname)
inline

Open VCF/BCF file for writing. The format is infered from file's suffix.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files

◆ open() [2/2]

void vcfpp::BcfWriter::open ( const std::string &  fname,
const std::string &  mode 
)
inline

Open VCF/BCF file for writing using given mode.

Parameters
fnameThe file name or "-" for stdin/stdout. For indexed files
modeMode matching
[w]b .. compressed BCF
[w]bu .. uncompressed BCF
[w]z .. compressed VCF
[w] .. uncompressed VCF

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