vg
tools for working with variation graphs
Public Member Functions | Private Attributes | List of all members
vg::io::VGAlignmentEmitter Class Reference

#include <alignment_emitter.hpp>

Inheritance diagram for vg::io::VGAlignmentEmitter:
vg::io::AlignmentEmitter

Public Member Functions

 VGAlignmentEmitter (const string &filename, const string &format, size_t max_threads)
 
 ~VGAlignmentEmitter ()
 Finish and drstroy a VGAlignmentEmitter. More...
 
virtual void emit_extra_message (const std::string &tag, std::string &&data)
 Emit some extra type-tagged data, if the backing format supports it. More...
 
virtual void emit_singles (vector< Alignment > &&aln_batch)
 Emit a batch of Alignments. More...
 
virtual void emit_mapped_singles (vector< vector< Alignment >> &&alns_batch)
 
virtual void emit_pairs (vector< Alignment > &&aln1_batch, vector< Alignment > &&aln2_batch, vector< int64_t > &&tlen_limit_batch)
 Emit a batch of pairs of Alignments. More...
 
virtual void emit_mapped_pairs (vector< vector< Alignment >> &&alns1_batch, vector< vector< Alignment >> &&alns2_batch, vector< int64_t > &&tlen_limit_batch)
 
- Public Member Functions inherited from vg::io::AlignmentEmitter
virtual void emit_single (Alignment &&aln)
 Emit a single Alignment. More...
 
virtual void emit_mapped_single (vector< Alignment > &&alns)
 Emit a single Alignment with secondaries. All secondaries must have is_secondary set already. More...
 
virtual void emit_pair (Alignment &&aln1, Alignment &&aln2, int64_t tlen_limit=0)
 
virtual void emit_mapped_pair (vector< Alignment > &&alns1, vector< Alignment > &&alns2, int64_t tlen_limit=0)
 
virtual ~AlignmentEmitter ()=default
 Allow destruction through base class pointer. More...
 

Private Attributes

unique_ptr< ofstream > out_file
 If we are doing output to a file, this will hold the open file. Otherwise (for stdout) it will be empty. More...
 
vg::io::StreamMultiplexer multiplexer
 
vector< unique_ptr< vg::io::ProtobufEmitter< Alignment > > > proto
 We also keep ProtobufEmitters, one per thread, if we are doing protobuf output. More...
 

Detailed Description

Emit Alignments to a stream in GAM or JSON format. Thread safe.

TODO: Split into Protobuf and JSON versions?

Constructor & Destructor Documentation

◆ VGAlignmentEmitter()

vg::io::VGAlignmentEmitter::VGAlignmentEmitter ( const string &  filename,
const string &  format,
size_t  max_threads 
)

Create a VGAlignmentEmitter writing to the given file (or "-") in the given non-HTS format ("JSON", "GAM").

◆ ~VGAlignmentEmitter()

vg::io::VGAlignmentEmitter::~VGAlignmentEmitter ( )

Finish and drstroy a VGAlignmentEmitter.

Member Function Documentation

◆ emit_extra_message()

void vg::io::VGAlignmentEmitter::emit_extra_message ( const std::string &  tag,
std::string &&  data 
)
virtual

Emit some extra type-tagged data, if the backing format supports it.

Reimplemented from vg::io::AlignmentEmitter.

◆ emit_mapped_pairs()

void vg::io::VGAlignmentEmitter::emit_mapped_pairs ( vector< vector< Alignment >> &&  alns1_batch,
vector< vector< Alignment >> &&  alns2_batch,
vector< int64_t > &&  tlen_limit_batch 
)
virtual

Emit the mappings of a batch of pairs of Alignments. All secondaries must have is_secondary set already.

Implements vg::io::AlignmentEmitter.

◆ emit_mapped_singles()

void vg::io::VGAlignmentEmitter::emit_mapped_singles ( vector< vector< Alignment >> &&  alns_batch)
virtual

Emit a batch of Alignments with secondaries. All secondaries must have is_secondary set already.

Implements vg::io::AlignmentEmitter.

◆ emit_pairs()

void vg::io::VGAlignmentEmitter::emit_pairs ( vector< Alignment > &&  aln1_batch,
vector< Alignment > &&  aln2_batch,
vector< int64_t > &&  tlen_limit_batch 
)
virtual

Emit a batch of pairs of Alignments.

Implements vg::io::AlignmentEmitter.

◆ emit_singles()

void vg::io::VGAlignmentEmitter::emit_singles ( vector< Alignment > &&  aln_batch)
virtual

Emit a batch of Alignments.

Implements vg::io::AlignmentEmitter.

Member Data Documentation

◆ multiplexer

vg::io::StreamMultiplexer vg::io::VGAlignmentEmitter::multiplexer
private

This holds a StreamMultiplexer on the output stream, for sharing it between threads.

◆ out_file

unique_ptr<ofstream> vg::io::VGAlignmentEmitter::out_file
private

If we are doing output to a file, this will hold the open file. Otherwise (for stdout) it will be empty.

◆ proto

vector<unique_ptr<vg::io::ProtobufEmitter<Alignment> > > vg::io::VGAlignmentEmitter::proto
private

We also keep ProtobufEmitters, one per thread, if we are doing protobuf output.


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