vg
tools for working with variation graphs
|
#include <phased_genome.hpp>
Classes | |
class | Haplotype |
struct | HaplotypeNode |
class | iterator |
Public Member Functions | |
PhasedGenome (const SnarlManager &snarl_manager) | |
Constructor. More... | |
~PhasedGenome () | |
PhasedGenome (PhasedGenome &phased_genome) | |
overloaded constructor More... | |
PhasedGenome (PhasedGenome &&other)=delete | |
move assignment ctor More... | |
PhasedGenome & | operator= (PhasedGenome &&phased_genome)=delete |
move assignment operator More... | |
PhasedGenome & | operator= (PhasedGenome &phased_genome) |
copy assignment operator More... | |
template<typename NodeTraversalIterator > | |
int | add_haplotype (NodeTraversalIterator first, NodeTraversalIterator last) |
void | build_indices () |
size_t | num_haplotypes () |
iterator | begin (int which_haplotype) |
iterator | end (int which_haplotype) |
vector< id_t > | get_haplotypes_with_snarl (const Snarl *snarl_to_find) |
Check which haplotypes a snarl is found in. More... | |
void | print_phased_genome () |
Prints out the haplotypes, and node values. More... | |
void | swap_alleles (const Snarl &site, int haplotype_1, int haplotype_2) |
template<typename NodeTraversalIterator > | |
void | set_allele (const Snarl &site, NodeTraversalIterator first, NodeTraversalIterator last, int which_haplotype) |
vector< NodeTraversal > | get_allele (const Snarl &site, int which_haplotype) |
int32_t | optimal_score_on_genome (const multipath_alignment_t &multipath_aln, VG &graph) |
double | read_log_likelihood (const multipath_alignment_t &multipath_aln, double log_base) |
Private Member Functions | |
void | build_site_indices_internal (const Snarl *snarl) |
void | insert_left (NodeTraversal node_traversal, HaplotypeNode *haplo_node) |
Insert a node traversal to the left of this haplotype node and update indices. More... | |
void | insert_right (NodeTraversal node_traversal, HaplotypeNode *haplo_node) |
Insert a node traversal to the right of this haplotype node and update indices. More... | |
void | remove (HaplotypeNode *haplo_node) |
Remove this haplotype node from its haplotype and update indices. More... | |
void | swap_label (const Snarl &site, Haplotype &haplotype_1, Haplotype &haplotype_2) |
Update a subsite's location in indices after swapping its parent allele. More... | |
Private Attributes | |
const SnarlManager * | snarl_manager |
vector< Haplotype * > | haplotypes |
All haplotypes in the genome (generally 2 per chromosome) More... | |
unordered_map< int64_t, list< HaplotypeNode * > > | node_locations |
Index of where nodes from the graph occur in the phased genome. More... | |
unordered_map< int64_t, const Snarl * > | site_starts |
Index of which nodes are starts of Snarls. More... | |
unordered_map< int64_t, const Snarl * > | site_ends |
Index of which nodes are ends of Snarls. More... | |
A collection of haplotypes that represent all of the chromosomes of a genome (including phasing) as walks through a variation graph. Designed for fast editing at a site level, so it maintains indices of sites for that purpose.
vg::PhasedGenome::PhasedGenome | ( | const SnarlManager & | snarl_manager | ) |
vg::PhasedGenome::~PhasedGenome | ( | ) |
vg::PhasedGenome::PhasedGenome | ( | PhasedGenome & | phased_genome | ) |
overloaded constructor
|
delete |
move assignment ctor
int vg::PhasedGenome::add_haplotype | ( | NodeTraversalIterator | first, |
NodeTraversalIterator | last | ||
) |
Build a haplotype in place from an iterator that returns NodeTraversal objects from its dereference operator (allows construction without instantiating the haplotype elsewhere) returns the numerical id of the new haplotype
note: the haplotype must have at least one node
PhasedGenome::iterator vg::PhasedGenome::begin | ( | int | which_haplotype | ) |
Unidirectional iterator starting at the left telomere and moving to the right. Requires a haplotype id as input
void vg::PhasedGenome::build_indices | ( | ) |
Construct the site ends, node locations, and haplotype site location indices. This method is intended to be called one time after building haplotypes. After this, the are maintained automatically during edit operations.
|
private |
PhasedGenome::iterator vg::PhasedGenome::end | ( | int | which_haplotype | ) |
Iterator representing the past-the-last position of the given haplotype, with the last position being the right telomere node.
vector< NodeTraversal > vg::PhasedGenome::get_allele | ( | const Snarl & | site, |
int | which_haplotype | ||
) |
Check which haplotypes a snarl is found in.
|
inlineprivate |
Insert a node traversal to the left of this haplotype node and update indices.
|
inlineprivate |
Insert a node traversal to the right of this haplotype node and update indices.
size_t vg::PhasedGenome::num_haplotypes | ( | ) |
|
delete |
move assignment operator
PhasedGenome & vg::PhasedGenome::operator= | ( | PhasedGenome & | phased_genome | ) |
copy assignment operator
int32_t vg::PhasedGenome::optimal_score_on_genome | ( | const multipath_alignment_t & | multipath_aln, |
VG & | graph | ||
) |
Returns the score of the highest scoring alignment contained in the multipath alignment that is restricted to the phased genome's paths through the variation graph.
Note: assumes that multipath_alignment_t has 'start' field filled in
void vg::PhasedGenome::print_phased_genome | ( | ) |
Prints out the haplotypes, and node values.
double vg::PhasedGenome::read_log_likelihood | ( | const multipath_alignment_t & | multipath_aln, |
double | log_base | ||
) |
Returns the sum of the log-likelihoods of all of the alignments expressed in a multipath alignment, given a
|
inlineprivate |
Remove this haplotype node from its haplotype and update indices.
void vg::PhasedGenome::set_allele | ( | const Snarl & | site, |
NodeTraversalIterator | first, | ||
NodeTraversalIterator | last, | ||
int | which_haplotype | ||
) |
Set the allele at a site with an iterator that yields its node sequence. The allele should be provided in the order indicated by the Snarl (i.e. from start to end) and it should not include the boundary nodes of the Snarl.
Note: This method does not check that the allele path takes only edges that are actually included in the graph, so client must ensure this itself.
void vg::PhasedGenome::swap_alleles | ( | const Snarl & | site, |
int | haplotype_1, | ||
int | haplotype_2 | ||
) |
Swap the allele from between two haplotypes, maintaining all indices. If a nested site is being swapped, this method should be called only once for the top-most site. Child sites are swapped along with the top-most site automatically.
|
private |
Update a subsite's location in indices after swapping its parent allele.
|
private |
All haplotypes in the genome (generally 2 per chromosome)
|
private |
Index of where nodes from the graph occur in the phased genome.
|
private |
Index of which nodes are ends of Snarls.
|
private |
Index of which nodes are starts of Snarls.
|
private |