vg
tools for working with variation graphs
|
Classes | |
class | AlignmentEmitter |
class | BlockedGzipInputStream |
class | BlockedGzipOutputStream |
class | ConvertedHashGraph |
class | fdinbuf |
class | fdistream |
class | fdostream |
class | fdoutbuf |
class | GafAlignmentEmitter |
struct | hFILE_cppstream |
class | JSONStreamHelper |
class | MessageEmitter |
class | MessageIterator |
class | NullAlignmentEmitter |
class | ProtobufEmitter |
class | ProtobufIterator |
class | Registry |
class | streaminbuf |
class | streamistream |
class | StreamMultiplexer |
class | TSVAlignmentEmitter |
class | VGAlignmentEmitter |
class | VPKG |
Typedefs | |
using | handle_t = handlegraph::handle_t |
using | nid_t = handlegraph::nid_t |
using | path_handle_t = handlegraph::path_handle_t |
using | step_handle_t = handlegraph::step_handle_t |
using | edge_t = handlegraph::edge_t |
using | HandleGraph = handlegraph::HandleGraph |
using | message_consumer_function_t = function< void(const string &)> |
This is the type of a function that can be fed a series of messages. More... | |
using | message_sender_function_t = function< void(const message_consumer_function_t &)> |
This is the type of a function that can be given a message consumer to feed messages to. More... | |
using | load_function_t = function< void *(const message_sender_function_t &)> |
This is the type of a function that can allocate and load an object of unspecified type from a message source. More... | |
using | save_function_t = function< void(const void *, const message_consumer_function_t &)> |
This is the type of a function that can serialize an object of unspecified type to a message consumer. More... | |
using | bare_load_function_t = function< void *(istream &)> |
This is the type of a function that can load an object of unspecified type from a bare input stream. More... | |
using | bare_load_function_with_filename_t = function< void *(istream &, const string &)> |
Like above, but keep track of an optional (can be empty) filename (ie where stream comes from) More... | |
using | bare_save_function_t = function< void(const void *, ostream &)> |
This is the type of a function that can save an object of unspecified type to a bare output stream. More... | |
Functions | |
void | load_proto_to_graph (vg::MutablePathMutableHandleGraph *destination, const vg::io::message_sender_function_t &for_each_message) |
void | load_proto_to_graph (vg::MutablePathMutableHandleGraph *destination, const function< void(const function< void(Graph &)> &)> &chunk_sender) |
bool | register_libvg_io () |
void | register_loader_params_json () |
void | register_loader_saver_distance_index () |
void | register_loader_saver_gbwt () |
void | register_loader_saver_gbwtgraph () |
void | register_loader_saver_gbz () |
void | register_loader_saver_gbzgraph () |
void | register_loader_saver_gcsa () |
void | register_loader_saver_gfa () |
void | register_loader_saver_hash_graph () |
void | register_loader_saver_lcp () |
void | register_loader_saver_minimizer () |
void | register_loader_saver_packed_graph () |
void | register_loader_saver_r_index () |
void | register_loader_saver_snarl_manager () |
void | register_loader_saver_vg () |
void | register_loader_saver_xg () |
void | save_handle_graph (HandleGraph *graph, ostream &os) |
void | save_handle_graph (HandleGraph *graph, const string &dest_path) |
bool | valid_output_format (const string &fmt_string) |
template<class T > | |
unique_ptr< T > | new_output_graph (const string &fmt_string) |
unique_ptr< AlignmentEmitter > | get_non_hts_alignment_emitter (const string &filename, const string &format, const map< string, int64_t > &path_length, size_t max_threads, const HandleGraph *graph, const handlegraph::NamedNodeBackTranslation *translate_through) |
bool | get_next_record_from_gaf (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, htsFile *fp, kstring_t &s_buffer, gafkluge::GafRecord &record) |
bool | get_next_interleaved_record_pair_from_gaf (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, htsFile *fp, kstring_t &s_buffer, gafkluge::GafRecord &record1, gafkluge::GafRecord &record2) |
size_t | gaf_unpaired_for_each (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const string &filename, function< void(Alignment &)> lambda) |
size_t | gaf_unpaired_for_each (const HandleGraph &graph, const string &filename, function< void(Alignment &)> lambda) |
size_t | gaf_paired_interleaved_for_each (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const string &filename, function< void(Alignment &, Alignment &)> lambda) |
size_t | gaf_paired_interleaved_for_each (const HandleGraph &graph, const string &filename, function< void(Alignment &, Alignment &)> lambda) |
size_t | gaf_unpaired_for_each_parallel (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const string &filename, function< void(Alignment &)> lambda, uint64_t batch_size) |
size_t | gaf_unpaired_for_each_parallel (const HandleGraph &graph, const string &filename, function< void(Alignment &)> lambda, uint64_t batch_size) |
size_t | gaf_paired_interleaved_for_each_parallel (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const string &filename, function< void(Alignment &, Alignment &)> lambda, uint64_t batch_size) |
size_t | gaf_paired_interleaved_for_each_parallel (const HandleGraph &graph, const string &filename, function< void(Alignment &, Alignment &)> lambda, uint64_t batch_size) |
size_t | gaf_paired_interleaved_for_each_parallel_after_wait (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const string &filename, function< void(Alignment &, Alignment &)> lambda, function< bool(void)> single_threaded_until_true, uint64_t batch_size) |
size_t | gaf_paired_interleaved_for_each_parallel_after_wait (const HandleGraph &graph, const string &filename, function< void(Alignment &, Alignment &)> lambda, function< bool(void)> single_threaded_until_true, uint64_t batch_size) |
gafkluge::GafRecord | alignment_to_gaf (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const Alignment &aln, const handlegraph::NamedNodeBackTranslation *translate_through, bool cs_cigar, bool base_quals, bool frag_links) |
gafkluge::GafRecord | alignment_to_gaf (const HandleGraph &graph, const Alignment &aln, const handlegraph::NamedNodeBackTranslation *translate_through, bool cs_cigar, bool base_quals, bool frag_links) |
void | gaf_to_alignment (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, const gafkluge::GafRecord &gaf, Alignment &aln) |
Convert a GAF alignment into a vg Alignment. The alignment must be in node ID space. More... | |
void | gaf_to_alignment (const HandleGraph &graph, const gafkluge::GafRecord &gaf, Alignment &aln) |
Convert a GAF alignment into a vg Alignment. The alignment must be in node ID space. More... | |
short | quality_char_to_short (char c) |
char | quality_short_to_char (short i) |
void | alignment_quality_short_to_char (Alignment &alignment) |
string | string_quality_short_to_char (const string &quality) |
void | alignment_quality_char_to_short (Alignment &alignment) |
string | string_quality_char_to_short (const string &quality) |
void | mergeGraphs (Graph &graph, const Graph &part) |
Graph | inputStream (const string &filename) |
void | outputStream (const Graph &g) |
bool | edit_is_match (const Edit &e) |
bool | edit_is_sub (const Edit &e) |
bool | edit_is_insertion (const Edit &e) |
bool | edit_is_deletion (const Edit &e) |
bool | edit_is_empty (const Edit &e) |
pair< Edit, Edit > | cut_edit_at_to (const Edit &e, size_t to_off) |
pair< Edit, Edit > | cut_edit_at_from (const Edit &e, size_t from_off) |
Edit | reverse_complement_edit (const Edit &e) |
bool | operator== (const Edit &e1, const Edit &e2) |
hFILE * | hfile_wrap (std::istream &input) |
Wrap a C++ input stream as an hFILE* that can be read by BGZF. More... | |
hFILE * | hfile_wrap (std::ostream &output) |
Wrap a C++ output stream as an hFILE* that can be written by BGZF. More... | |
auto | wrap_bare_loader (function< void *(istream &)> istream_loader) -> load_function_t |
void | with_function_calling_stream (const message_consumer_function_t &emit_message, const function< void(ostream &)> &use_stream) |
auto | wrap_bare_saver (function< void(const void *, ostream &)> ostream_saver) -> save_function_t |
void | finish (std::ostream &out, bool compressed) |
template<typename T > | |
size_t | unpaired_for_each_parallel (function< bool(T &)> get_read_if_available, function< void(T &)> lambda, uint64_t batch_size=DEFAULT_PARALLEL_BATCHSIZE) |
template<typename T > | |
size_t | paired_for_each_parallel_after_wait (function< bool(T &, T &)> get_pair_if_available, function< void(T &, T &)> lambda, function< bool(void)> single_threaded_until_true, uint64_t batch_size=DEFAULT_PARALLEL_BATCHSIZE) |
bool | get_next_record_pair_from_gaf (function< size_t(nid_t)> node_to_length, function< string(nid_t, bool)> node_to_sequence, htsFile *fp, kstring_t &s_buffer, gafkluge::GafRecord &mate1, gafkluge::GafRecord &mate2) |
template<typename Item > | |
auto | emit_to (ostream &out) -> std::function< void(const Item &)> |
template<typename T > | |
bool | write (std::ostream &out, size_t count, const std::function< T &(size_t)> &lambda, bool compressed=true) |
template<typename T > | |
bool | write (std::ostream &out, size_t count, const std::function< T(size_t)> &lambda, bool compressed=true) |
template<typename T > | |
bool | write_buffered (std::ostream &out, std::vector< T > &buffer, size_t buffer_limit, bool compressed=true) |
template<typename T > | |
void | write_to_file (const T &item, const string &filename) |
Write a single message to a file. More... | |
template<typename T > | |
void | for_each (std::istream &in, const std::function< void(int64_t, T &)> &lambda) |
template<typename T > | |
void | for_each (std::istream &in, const std::function< void(T &)> &lambda) |
template<typename T > | |
void | for_each_parallel_impl (std::istream &in, const std::function< void(T &, T &)> &lambda2, const std::function< void(T &)> &lambda1, const std::function< bool(void)> &single_threaded_until_true, size_t batch_size) |
template<typename T > | |
void | for_each_interleaved_pair_parallel (std::istream &in, const std::function< void(T &, T &)> &lambda2, size_t batch_size=256) |
template<typename T > | |
void | for_each_interleaved_pair_parallel_after_wait (std::istream &in, const std::function< void(T &, T &)> &lambda2, const std::function< bool(void)> &single_threaded_until_true, size_t batch_size=256) |
template<typename T > | |
void | for_each_parallel (std::istream &in, const std::function< void(T &)> &lambda1, size_t batch_size=256) |
Variables | |
const uint64_t | DEFAULT_PARALLEL_BATCHSIZE = 512 |
template<typename Item > | |
std::function< void(const Item &)> | emit_to (ostream &out) |
using vg::io::bare_load_function_t = typedef function<void*(istream&)> |
This is the type of a function that can load an object of unspecified type from a bare input stream.
using vg::io::bare_load_function_with_filename_t = typedef function<void*(istream&, const string&)> |
Like above, but keep track of an optional (can be empty) filename (ie where stream comes from)
using vg::io::bare_save_function_t = typedef function<void(const void*, ostream&)> |
This is the type of a function that can save an object of unspecified type to a bare output stream.
typedef handlegraph::edge_t vg::io::edge_t |
using vg::io::load_function_t = typedef function<void*(const message_sender_function_t&)> |
This is the type of a function that can allocate and load an object of unspecified type from a message source.
using vg::io::message_consumer_function_t = typedef function<void(const string&)> |
This is the type of a function that can be fed a series of messages.
using vg::io::message_sender_function_t = typedef function<void(const message_consumer_function_t&)> |
This is the type of a function that can be given a message consumer to feed messages to.
typedef handlegraph::nid_t vg::io::nid_t |
using vg::io::save_function_t = typedef function<void(const void*, const message_consumer_function_t&)> |
This is the type of a function that can serialize an object of unspecified type to a message consumer.
void vg::io::alignment_quality_char_to_short | ( | Alignment & | alignment | ) |
void vg::io::alignment_quality_short_to_char | ( | Alignment & | alignment | ) |
gafkluge::GafRecord vg::io::alignment_to_gaf | ( | const HandleGraph & | graph, |
const Alignment & | aln, | ||
const handlegraph::NamedNodeBackTranslation * | translate_through = nullptr , |
||
bool | cs_cigar = true , |
||
bool | base_quals = true , |
||
bool | frag_links = true |
||
) |
Convert an alignment to GAF. The alignment must be in node ID space. If translate_through is set, output will be in segment name space.
gafkluge::GafRecord vg::io::alignment_to_gaf | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const Alignment & | aln, | ||
const handlegraph::NamedNodeBackTranslation * | translate_through = nullptr , |
||
bool | cs_cigar = true , |
||
bool | base_quals = true , |
||
bool | frag_links = true |
||
) |
Convert an alignment to GAF. The alignment must be in node ID space. If translate_through is set, output will be in segment name space.
bool vg::io::edit_is_deletion | ( | const Edit & | e | ) |
bool vg::io::edit_is_empty | ( | const Edit & | e | ) |
bool vg::io::edit_is_insertion | ( | const Edit & | e | ) |
bool vg::io::edit_is_match | ( | const Edit & | e | ) |
bool vg::io::edit_is_sub | ( | const Edit & | e | ) |
auto vg::io::emit_to | ( | ostream & | out | ) | -> std::function<void(const Item&)> |
void vg::io::finish | ( | std::ostream & | out, |
bool | compressed = true |
||
) |
Write the EOF marker to the given stream, so that readers won't complain that it might be truncated when they read it in. Internal EOF markers MAY exist, but a file SHOULD have exactly one EOF marker at its end. Needs to know if the output stream is compressed or not. Note that uncompressed streams don't actually have nonempty EOF markers.
void vg::io::for_each | ( | std::istream & | in, |
const std::function< void(int64_t, T &)> & | lambda | ||
) |
void vg::io::for_each | ( | std::istream & | in, |
const std::function< void(T &)> & | lambda | ||
) |
void vg::io::for_each_interleaved_pair_parallel | ( | std::istream & | in, |
const std::function< void(T &, T &)> & | lambda2, | ||
size_t | batch_size = 256 |
||
) |
void vg::io::for_each_interleaved_pair_parallel_after_wait | ( | std::istream & | in, |
const std::function< void(T &, T &)> & | lambda2, | ||
const std::function< bool(void)> & | single_threaded_until_true, | ||
size_t | batch_size = 256 |
||
) |
void vg::io::for_each_parallel | ( | std::istream & | in, |
const std::function< void(T &)> & | lambda1, | ||
size_t | batch_size = 256 |
||
) |
void vg::io::for_each_parallel_impl | ( | std::istream & | in, |
const std::function< void(T &, T &)> & | lambda2, | ||
const std::function< void(T &)> & | lambda1, | ||
const std::function< bool(void)> & | single_threaded_until_true, | ||
size_t | batch_size | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each | ( | const HandleGraph & | graph, |
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each_parallel | ( | const HandleGraph & | graph, |
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda, | ||
uint64_t | batch_size | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each_parallel | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda, | ||
uint64_t | batch_size | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each_parallel_after_wait | ( | const HandleGraph & | graph, |
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda, | ||
function< bool(void)> | single_threaded_until_true, | ||
uint64_t | batch_size | ||
) |
size_t vg::io::gaf_paired_interleaved_for_each_parallel_after_wait | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const string & | filename, | ||
function< void(Alignment &, Alignment &)> | lambda, | ||
function< bool(void)> | single_threaded_until_true, | ||
uint64_t | batch_size | ||
) |
void vg::io::gaf_to_alignment | ( | const HandleGraph & | graph, |
const gafkluge::GafRecord & | gaf, | ||
Alignment & | aln | ||
) |
Convert a GAF alignment into a vg Alignment. The alignment must be in node ID space.
void vg::io::gaf_to_alignment | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const gafkluge::GafRecord & | gaf, | ||
Alignment & | aln | ||
) |
Convert a GAF alignment into a vg Alignment. The alignment must be in node ID space.
size_t vg::io::gaf_unpaired_for_each | ( | const HandleGraph & | graph, |
const string & | filename, | ||
function< void(Alignment &)> | lambda | ||
) |
size_t vg::io::gaf_unpaired_for_each | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const string & | filename, | ||
function< void(Alignment &)> | lambda | ||
) |
size_t vg::io::gaf_unpaired_for_each_parallel | ( | const HandleGraph & | graph, |
const string & | filename, | ||
function< void(Alignment &)> | lambda, | ||
uint64_t | batch_size | ||
) |
size_t vg::io::gaf_unpaired_for_each_parallel | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
const string & | filename, | ||
function< void(Alignment &)> | lambda, | ||
uint64_t | batch_size | ||
) |
bool vg::io::get_next_interleaved_record_pair_from_gaf | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
htsFile * | fp, | ||
kstring_t & | s_buffer, | ||
gafkluge::GafRecord & | record1, | ||
gafkluge::GafRecord & | record2 | ||
) |
bool vg::io::get_next_record_from_gaf | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
htsFile * | fp, | ||
kstring_t & | s_buffer, | ||
gafkluge::GafRecord & | record | ||
) |
bool vg::io::get_next_record_pair_from_gaf | ( | function< size_t(nid_t)> | node_to_length, |
function< string(nid_t, bool)> | node_to_sequence, | ||
htsFile * | fp, | ||
kstring_t & | s_buffer, | ||
gafkluge::GafRecord & | mate1, | ||
gafkluge::GafRecord & | mate2 | ||
) |
unique_ptr< AlignmentEmitter > vg::io::get_non_hts_alignment_emitter | ( | const string & | filename, |
const string & | format, | ||
const map< string, int64_t > & | path_length, | ||
size_t | max_threads, | ||
const HandleGraph * | graph = nullptr , |
||
const handlegraph::NamedNodeBackTranslation * | translate_through = nullptr |
||
) |
Get an AlignmentEmitter that can emit to the given file (or "-") in the given format. A table of contig lengths is required for HTSlib formats. Automatically applies per-thread buffering, but needs to know how many OMP threads will be in use.
If you want a generalization of this that supports hts, look for get_alignment_emitter in hts_alignment_emitter.hpp
hFILE * vg::io::hfile_wrap | ( | std::istream & | input | ) |
Wrap a C++ input stream as an hFILE* that can be read by BGZF.
Make the base struct, making sure it knows how big we are
hFILE * vg::io::hfile_wrap | ( | std::ostream & | output | ) |
Wrap a C++ output stream as an hFILE* that can be written by BGZF.
Make the base struct, making sure it knows how big we are
Graph vg::io::inputStream | ( | const string & | filename | ) |
void vg::io::load_proto_to_graph | ( | vg::MutablePathMutableHandleGraph * | destination, |
const function< void(const function< void(Graph &)> &)> & | chunk_sender | ||
) |
Call the given function with a callback which it can call with a series of Protobuf Graph objects, possibly in multiple threads. The Protobuf Graph objects may have dangling edges.
Resolves all the dangling edges and writes all the graph data into the given MutablePathMutableHandleGraph, with the destination graph being protected from concurrent modification.
void vg::io::load_proto_to_graph | ( | vg::MutablePathMutableHandleGraph * | destination, |
const vg::io::message_sender_function_t & | for_each_message | ||
) |
unique_ptr<T> vg::io::new_output_graph | ( | const string & | fmt_string | ) |
void vg::io::outputStream | ( | const Graph & | g | ) |
|
inline |
short vg::io::quality_char_to_short | ( | char | c | ) |
char vg::io::quality_short_to_char | ( | short | i | ) |
bool vg::io::register_libvg_io | ( | ) |
Register libvg types with libvgio. Must be called by library users before doing IO. Does not magically statically call itself. TODO: work out a way it can. Returns true on success.
void vg::io::register_loader_params_json | ( | ) |
void vg::io::register_loader_saver_distance_index | ( | ) |
void vg::io::register_loader_saver_gbwt | ( | ) |
void vg::io::register_loader_saver_gbwtgraph | ( | ) |
void vg::io::register_loader_saver_gbz | ( | ) |
void vg::io::register_loader_saver_gbzgraph | ( | ) |
void vg::io::register_loader_saver_gcsa | ( | ) |
void vg::io::register_loader_saver_gfa | ( | ) |
void vg::io::register_loader_saver_hash_graph | ( | ) |
void vg::io::register_loader_saver_lcp | ( | ) |
void vg::io::register_loader_saver_minimizer | ( | ) |
void vg::io::register_loader_saver_packed_graph | ( | ) |
void vg::io::register_loader_saver_r_index | ( | ) |
void vg::io::register_loader_saver_snarl_manager | ( | ) |
void vg::io::register_loader_saver_vg | ( | ) |
void vg::io::register_loader_saver_xg | ( | ) |
|
inline |
|
inline |
Save a handle graph. Todo: should this be somewhere else (ie in vgio with new types registered?)
string vg::io::string_quality_char_to_short | ( | const string & | quality | ) |
string vg::io::string_quality_short_to_char | ( | const string & | quality | ) |
|
inline |
|
inline |
void vg::io::with_function_calling_stream | ( | const message_consumer_function_t & | emit_message, |
const function< void(ostream &)> & | use_stream | ||
) |
This calls the given stream-using callback with a stream that, when written to, calls the given emit_message function. The emit_message function and the stream-using callback will run in different threads.
load_function_t vg::io::wrap_bare_loader | ( | bare_load_function_t | istream_loader | ) |
We also have an adapter that takes a function from an istream& to a void* object, and runs that in a thread to adapt it to the message consuming shape of interface. It captures the wrapped function by value.
save_function_t vg::io::wrap_bare_saver | ( | function< void(const void *, ostream &)> | ostream_saver | ) |
We have an adapter that takes a function of void* and ostream&, and adapts that to a message consumer destination.
bool vg::io::write | ( | std::ostream & | out, |
size_t | count, | ||
const std::function< T &(size_t)> & | lambda, | ||
bool | compressed = true |
||
) |
Write objects. count should be equal to the number of objects to write. count is written before the objects, but if it is 0, it is not written. To get the objects, calls lambda with the index of the object to retrieve. If not all objects are written, return false, otherwise true. Needs to know whether to BGZF-compress the output or not.
bool vg::io::write | ( | std::ostream & | out, |
size_t | count, | ||
const std::function< T(size_t)> & | lambda, | ||
bool | compressed = true |
||
) |
Write objects. count should be equal to the number of objects to write. count is written before the objects, but if it is 0, it is not written. To get the objects, calls lambda with the index of the object to retrieve. If not all objects are written, return false, otherwise true. This implementation takes a function that returns actual objects and not references. Needs to know whether to BGZF-compress the output or not.
bool vg::io::write_buffered | ( | std::ostream & | out, |
std::vector< T > & | buffer, | ||
size_t | buffer_limit, | ||
bool | compressed = true |
||
) |
Start, continue, or finish a buffered stream of objects. If the length of the buffer is greater than the limit, writes the buffer out. Otherwise, leaves the objects in the buffer. Must be called with a buffer limit of 0 after all the objects have been produced, to flush the buffer. When called with a buffer limit of 0, automatically appends an EOF marker. Returns true unless an error occurs. Needs to know whether to BGZF-compress the output or not.
void vg::io::write_to_file | ( | const T & | item, |
const string & | filename | ||
) |
Write a single message to a file.
const uint64_t vg::io::DEFAULT_PARALLEL_BATCHSIZE = 512 |
std::function<void(const Item&)> vg::io::emit_to(ostream &out) |
Produce an std::function that can be invoked with Protobuf objects and save them to the given stream. Easy way to get a dumping callback to feed to something that wants a callback. The passed stream must outlive the resulting function.