vg
tools for working with variation graphs
Classes | Typedefs | Functions | Variables
vg::io Namespace Reference

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< AlignmentEmitterget_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, Editcut_edit_at_to (const Edit &e, size_t to_off)
 
pair< Edit, Editcut_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)
 

Typedef Documentation

◆ bare_load_function_t

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.

◆ bare_load_function_with_filename_t

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)

◆ bare_save_function_t

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.

◆ edge_t

◆ handle_t

◆ HandleGraph

◆ load_function_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.

◆ message_consumer_function_t

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.

◆ message_sender_function_t

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.

◆ nid_t

◆ path_handle_t

◆ save_function_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.

◆ step_handle_t

Function Documentation

◆ alignment_quality_char_to_short()

void vg::io::alignment_quality_char_to_short ( Alignment alignment)

◆ alignment_quality_short_to_char()

void vg::io::alignment_quality_short_to_char ( Alignment alignment)

◆ alignment_to_gaf() [1/2]

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.

◆ alignment_to_gaf() [2/2]

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.

◆ cut_edit_at_from()

pair< Edit, Edit > vg::io::cut_edit_at_from ( const Edit e,
size_t  from_off 
)

◆ cut_edit_at_to()

pair< Edit, Edit > vg::io::cut_edit_at_to ( const Edit e,
size_t  to_off 
)

◆ edit_is_deletion()

bool vg::io::edit_is_deletion ( const Edit e)

◆ edit_is_empty()

bool vg::io::edit_is_empty ( const Edit e)

◆ edit_is_insertion()

bool vg::io::edit_is_insertion ( const Edit e)

◆ edit_is_match()

bool vg::io::edit_is_match ( const Edit e)

◆ edit_is_sub()

bool vg::io::edit_is_sub ( const Edit e)

◆ emit_to()

template<typename Item >
auto vg::io::emit_to ( ostream &  out) -> std::function<void(const Item&)>

◆ finish()

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.

◆ for_each() [1/2]

template<typename T >
void vg::io::for_each ( std::istream &  in,
const std::function< void(int64_t, T &)> &  lambda 
)

◆ for_each() [2/2]

template<typename T >
void vg::io::for_each ( std::istream &  in,
const std::function< void(T &)> &  lambda 
)

◆ for_each_interleaved_pair_parallel()

template<typename T >
void vg::io::for_each_interleaved_pair_parallel ( std::istream &  in,
const std::function< void(T &, T &)> &  lambda2,
size_t  batch_size = 256 
)

◆ for_each_interleaved_pair_parallel_after_wait()

template<typename T >
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 
)

◆ for_each_parallel()

template<typename T >
void vg::io::for_each_parallel ( std::istream &  in,
const std::function< void(T &)> &  lambda1,
size_t  batch_size = 256 
)

◆ for_each_parallel_impl()

template<typename T >
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 
)

◆ gaf_paired_interleaved_for_each() [1/2]

size_t vg::io::gaf_paired_interleaved_for_each ( const HandleGraph graph,
const string &  filename,
function< void(Alignment &, Alignment &)>  lambda 
)

◆ gaf_paired_interleaved_for_each() [2/2]

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 
)

◆ gaf_paired_interleaved_for_each_parallel() [1/2]

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 
)

◆ gaf_paired_interleaved_for_each_parallel() [2/2]

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 
)

◆ gaf_paired_interleaved_for_each_parallel_after_wait() [1/2]

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 
)

◆ gaf_paired_interleaved_for_each_parallel_after_wait() [2/2]

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 
)

◆ gaf_to_alignment() [1/2]

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.

◆ gaf_to_alignment() [2/2]

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.

◆ gaf_unpaired_for_each() [1/2]

size_t vg::io::gaf_unpaired_for_each ( const HandleGraph graph,
const string &  filename,
function< void(Alignment &)>  lambda 
)

◆ gaf_unpaired_for_each() [2/2]

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 
)

◆ gaf_unpaired_for_each_parallel() [1/2]

size_t vg::io::gaf_unpaired_for_each_parallel ( const HandleGraph graph,
const string &  filename,
function< void(Alignment &)>  lambda,
uint64_t  batch_size 
)

◆ gaf_unpaired_for_each_parallel() [2/2]

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 
)

◆ get_next_interleaved_record_pair_from_gaf()

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 
)

◆ get_next_record_from_gaf()

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 
)

◆ get_next_record_pair_from_gaf()

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 
)

◆ get_non_hts_alignment_emitter()

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_wrap() [1/2]

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_wrap() [2/2]

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

◆ inputStream()

Graph vg::io::inputStream ( const string &  filename)

◆ load_proto_to_graph() [1/2]

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.

◆ load_proto_to_graph() [2/2]

void vg::io::load_proto_to_graph ( vg::MutablePathMutableHandleGraph destination,
const vg::io::message_sender_function_t for_each_message 
)

Read all string messages supplied by the given message sender as Protobuf Graph objects, and create the specified graph in the destination graph.

Paths need to be cached until the end for ranks to be respected.

◆ mergeGraphs()

void vg::io::mergeGraphs ( Graph graph,
const Graph part 
)

◆ new_output_graph()

template<class T >
unique_ptr<T> vg::io::new_output_graph ( const string &  fmt_string)

◆ operator==()

bool vg::io::operator== ( const Edit e1,
const Edit e2 
)

◆ outputStream()

void vg::io::outputStream ( const Graph g)

◆ paired_for_each_parallel_after_wait()

template<typename T >
size_t vg::io::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 
)
inline

◆ quality_char_to_short()

short vg::io::quality_char_to_short ( char  c)

◆ quality_short_to_char()

char vg::io::quality_short_to_char ( short  i)

◆ register_libvg_io()

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.

◆ register_loader_params_json()

void vg::io::register_loader_params_json ( )

◆ register_loader_saver_distance_index()

void vg::io::register_loader_saver_distance_index ( )

◆ register_loader_saver_gbwt()

void vg::io::register_loader_saver_gbwt ( )

◆ register_loader_saver_gbwtgraph()

void vg::io::register_loader_saver_gbwtgraph ( )

◆ register_loader_saver_gbz()

void vg::io::register_loader_saver_gbz ( )

◆ register_loader_saver_gbzgraph()

void vg::io::register_loader_saver_gbzgraph ( )

◆ register_loader_saver_gcsa()

void vg::io::register_loader_saver_gcsa ( )

◆ register_loader_saver_gfa()

void vg::io::register_loader_saver_gfa ( )

◆ register_loader_saver_hash_graph()

void vg::io::register_loader_saver_hash_graph ( )

◆ register_loader_saver_lcp()

void vg::io::register_loader_saver_lcp ( )

◆ register_loader_saver_minimizer()

void vg::io::register_loader_saver_minimizer ( )

◆ register_loader_saver_packed_graph()

void vg::io::register_loader_saver_packed_graph ( )

◆ register_loader_saver_r_index()

void vg::io::register_loader_saver_r_index ( )

◆ register_loader_saver_snarl_manager()

void vg::io::register_loader_saver_snarl_manager ( )

◆ register_loader_saver_vg()

void vg::io::register_loader_saver_vg ( )

◆ register_loader_saver_xg()

void vg::io::register_loader_saver_xg ( )

◆ reverse_complement_edit()

Edit vg::io::reverse_complement_edit ( const Edit e)

◆ save_handle_graph() [1/2]

void vg::io::save_handle_graph ( HandleGraph graph,
const string &  dest_path 
)
inline

◆ save_handle_graph() [2/2]

void vg::io::save_handle_graph ( HandleGraph graph,
ostream &  os 
)
inline

Save a handle graph. Todo: should this be somewhere else (ie in vgio with new types registered?)

◆ string_quality_char_to_short()

string vg::io::string_quality_char_to_short ( const string &  quality)

◆ string_quality_short_to_char()

string vg::io::string_quality_short_to_char ( const string &  quality)

◆ unpaired_for_each_parallel()

template<typename T >
size_t vg::io::unpaired_for_each_parallel ( function< bool(T &)>  get_read_if_available,
function< void(T &)>  lambda,
uint64_t  batch_size = DEFAULT_PARALLEL_BATCHSIZE 
)
inline

◆ valid_output_format()

bool vg::io::valid_output_format ( const string &  fmt_string)
inline

◆ with_function_calling_stream()

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.

◆ wrap_bare_loader()

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.

◆ wrap_bare_saver()

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.

◆ write() [1/2]

template<typename T >
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.

◆ write() [2/2]

template<typename T >
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.

◆ write_buffered()

template<typename T >
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.

◆ write_to_file()

template<typename T >
void vg::io::write_to_file ( const T &  item,
const string &  filename 
)

Write a single message to a file.

Variable Documentation

◆ DEFAULT_PARALLEL_BATCHSIZE

const uint64_t vg::io::DEFAULT_PARALLEL_BATCHSIZE = 512

◆ emit_to

template<typename Item >
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.