vg
tools for working with variation graphs
|
#include <sampler.hpp>
Public Member Functions | |
Sampler (PathPositionHandleGraph *x, int seed=0, bool forward_only=false, bool allow_Ns=false, const vector< string > &source_paths={}, const vector< double > &source_path_ploidies={}, const vector< pair< string, double >> &transcript_expressions={}, const vector< tuple< string, string, size_t >> &haplotype_transcripts={}) | |
Alignment | sample_read () |
pair< Alignment, Alignment > | sample_read_pair () |
void | set_source_paths (const vector< string > &source_paths, const vector< double > &source_path_ploidies, const vector< pair< string, double >> &transcript_expressions, const vector< tuple< string, string, size_t >> &haplotype_transcripts) |
pos_t | position (void) |
string | sequence (size_t length) |
Alignment | alignment (size_t length) |
Alignment | alignment_to_graph (size_t length) |
Get an alignment against the whole graph. More... | |
Alignment | alignment_to_path (const string &source_path, size_t length) |
Get an alignment against the currently set source_path. More... | |
Alignment | alignment_with_error (size_t length, double base_error, double indel_error) |
vector< Alignment > | alignment_pair (size_t read_length, size_t fragment_length, double fragment_std_dev, double base_error, double indel_error) |
size_t | node_length (id_t id) |
char | pos_char (pos_t pos) |
map< pos_t, char > | next_pos_chars (pos_t pos) |
Alignment | mutate (const Alignment &aln, double base_error, double indel_error) |
vector< Edit > | mutate_edit (const Edit &edit, const pos_t &position, double base_error, double indel_error, const string &bases, vg::uniform_real_distribution< double > &rprob, vg::uniform_int_distribution< int > &rbase) |
string | alignment_seq (const Alignment &aln) |
bool | is_valid (const Alignment &aln) |
Public Member Functions inherited from vg::AbstractReadSampler | |
virtual | ~AbstractReadSampler ()=default |
AbstractReadSampler (PathPositionHandleGraph &graph) | |
Make a new sampler using the given graph. More... | |
Public Attributes | |
LRUCache< id_t, Node > | node_cache |
LRUCache< id_t, vector< Edge > > | edge_cache |
mt19937 | rng |
int64_t | nonce |
bool | forward_only |
bool | no_Ns |
vector< string > | source_paths |
vg::discrete_distribution | path_sampler |
size_t | total_seq_length = 0 |
Public Attributes inherited from vg::AbstractReadSampler | |
bool | multi_position_annotations = false |
size_t | max_tries = 100 |
What limit should we use for retry loops before giving up or failing? More... | |
std::unique_ptr< std::function< bool(const path_handle_t &)> > | annotation_path_filter |
Additional Inherited Members | |
Protected Member Functions inherited from vg::AbstractReadSampler | |
void | annotate_with_path_positions (Alignment &aln) |
Protected Attributes inherited from vg::AbstractReadSampler | |
PathPositionHandleGraph & | graph |
The graph being simulated against. More... | |
Generate Alignments (with or without mutations, and in pairs or alone) from an PathPositionHandleGraph index.
|
inline |
Make a Sampler to sample from the given graph. If sampling from particular paths, source_paths should contain their names, and source_path_ploidies should either be empty or contain a ploidy value for each source path.
Alignment vg::Sampler::alignment | ( | size_t | length | ) |
Get an alignment against the whole graph, or against the source path if one is selected.
vector< Alignment > vg::Sampler::alignment_pair | ( | size_t | read_length, |
size_t | fragment_length, | ||
double | fragment_std_dev, | ||
double | base_error, | ||
double | indel_error | ||
) |
string vg::Sampler::alignment_seq | ( | const Alignment & | aln | ) |
Alignment vg::Sampler::alignment_to_graph | ( | size_t | length | ) |
Get an alignment against the whole graph.
Alignment vg::Sampler::alignment_to_path | ( | const string & | source_path, |
size_t | length | ||
) |
Get an alignment against the currently set source_path.
Alignment vg::Sampler::alignment_with_error | ( | size_t | length, |
double | base_error, | ||
double | indel_error | ||
) |
bool vg::Sampler::is_valid | ( | const Alignment & | aln | ) |
Return true if the alignment is semantically valid against the PathPositionHandleGraph index we wrap, and false otherwise. Checks from_lengths on mappings to make sure all node bases are accounted for. Won't accept alignments with internal jumps between graph locations or regions; all skipped bases need to be accounted for by deletions.
vector< Edit > vg::Sampler::mutate_edit | ( | const Edit & | edit, |
const pos_t & | position, | ||
double | base_error, | ||
double | indel_error, | ||
const string & | bases, | ||
vg::uniform_real_distribution< double > & | rprob, | ||
vg::uniform_int_distribution< int > & | rbase | ||
) |
Mutate the given edit, producing a vector of edits that should replace it. Position is the position of the start of the edit, and is updated to point to the next base after the mutated edit.
size_t vg::Sampler::node_length | ( | id_t | id | ) |
char vg::Sampler::pos_char | ( | pos_t | pos | ) |
pos_t vg::Sampler::position | ( | void | ) |
Alignment vg::Sampler::sample_read | ( | ) |
string vg::Sampler::sequence | ( | size_t | length | ) |
void vg::Sampler::set_source_paths | ( | const vector< string > & | source_paths, |
const vector< double > & | source_path_ploidies, | ||
const vector< pair< string, double >> & | transcript_expressions, | ||
const vector< tuple< string, string, size_t >> & | haplotype_transcripts | ||
) |
Make a path sampling distribution based on relative lengths (weighted by ploidy) or on transcript expressions. (At most one of source_paths and expressions should be non-empty.) If providing a transcript expression profile, can optionally provide a non-empty vector of haplotype transcripts to translate between the embedded path names and the transcript names in the expression profile.
bool vg::Sampler::forward_only |
bool vg::Sampler::no_Ns |
int64_t vg::Sampler::nonce |
vg::discrete_distribution vg::Sampler::path_sampler |
mt19937 vg::Sampler::rng |
vector<string> vg::Sampler::source_paths |
size_t vg::Sampler::total_seq_length = 0 |