本文整理汇总了C++中Site::get_path_state方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::get_path_state方法的具体用法?C++ Site::get_path_state怎么用?C++ Site::get_path_state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::get_path_state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_skipped_boundaries
void Basic_alignment::check_skipped_boundaries(Sequence *sequence)
{
vector<Site> *sites = sequence->get_sites();
// First, find 'Match/Skipped' and 'Skipped/Matched' boundaries and update the counts
//
for(unsigned int i=0;i<sites->size();i++)
{
Site *tsite = &sites->at(i);
if( tsite->has_bwd_edge() )
{
Edge *edge = tsite->get_first_bwd_edge();
while( tsite->has_next_bwd_edge() )
{
Edge *another = tsite->get_next_bwd_edge();
if( another->get_start_site_index() > edge->get_start_site_index() )
edge = another;
}
Site *psite = &sites->at( edge->get_start_site_index() );
if( ( psite->get_path_state()==Site::matched || psite->get_path_state()==Site::start_site )
&& ( tsite->get_path_state()==Site::xskipped || tsite->get_path_state()==Site::yskipped ) )
{
edge->increase_branch_count_as_skipped_edge();
}
}
if( tsite->has_fwd_edge() )
{
Edge *edge = tsite->get_first_fwd_edge();
while( tsite->has_next_fwd_edge() )
{
Edge *another = tsite->get_next_fwd_edge();
if( another->get_start_site_index() < edge->get_start_site_index() )
edge = another;
}
Site *nsite = &sites->at( edge->get_end_site_index() );
if( ( tsite->get_path_state()==Site::xskipped || tsite->get_path_state()==Site::yskipped )
&& ( nsite->get_path_state()==Site::matched || nsite->get_path_state()==Site::ends_site ) )
{
edge->increase_branch_count_as_skipped_edge();
}
}
}
// Then, see if any pair of boundaries (covering a skipped gap) is above the limit. Delete the range.
//
bool non_skipped = true;
int skip_start = -1;
for(unsigned int i=1;i<sites->size();i++)
{
Site *tsite = &sites->at(i);
int tstate = tsite->get_path_state();
if( non_skipped && ( tstate == Site::xskipped || tstate == Site::yskipped ) )
{
if( tsite->has_bwd_edge() )
{
Edge *edge = tsite->get_first_bwd_edge();
while( tsite->has_next_bwd_edge() )
{
Edge *another = tsite->get_next_bwd_edge();
if( another->get_start_site_index() > edge->get_start_site_index() )
edge = another;
}
if(edge->get_branch_count_as_skipped_edge()>max_allowed_match_skip_branches)
{
skip_start = i;
}
}
non_skipped = false;
}
if(!non_skipped && skip_start>=0 && tstate == Site::matched)
{
int edge_ind = -1;
if( tsite->has_bwd_edge() )
{
Edge *edge = tsite->get_first_bwd_edge();
if(edge->get_branch_count_as_skipped_edge()>max_allowed_match_skip_branches)
edge_ind = edge->get_index();
while( tsite->has_next_bwd_edge() )
{
edge = tsite->get_next_bwd_edge();
if(edge->get_branch_count_as_skipped_edge()>max_allowed_match_skip_branches)
edge_ind = edge->get_index();
//.........这里部分代码省略.........
示例2: create_ancestral_edges
void Basic_alignment::create_ancestral_edges(Sequence *sequence)
{
vector<Site> *sites = sequence->get_sites();
vector<int> left_child_index;
vector<int> right_child_index;
// First create an index for the child's sites in the parent
//
for(unsigned int i=0;i<sites->size();i++)
{
Site_children *offspring = sites->at(i).get_children();
Site *lsite;
Site *rsite;
if(offspring->left_index>=0)
{
lsite = left->get_site_at(offspring->left_index);
left_child_index.push_back(i);
}
if(offspring->right_index>=0)
{
rsite = right->get_site_at(offspring->right_index);
right_child_index.push_back(i);
}
}
if(Settings::noise>4)
{
stringstream ss;
ss<<"Child sequence site indeces:"<<endl;
for(unsigned int i=0;i<left_child_index.size();i++)
ss<<left_child_index.at(i)<<" ";
ss<<endl;
for(unsigned int i=0;i<right_child_index.size();i++)
ss<<right_child_index.at(i)<<" ";
ss<<endl;
Log_output::write_out(ss.str(),5);
}
// Then copy the edges of child sequences in their parent.
// Additionally, create edges for cases where skipped gap is flanked by a new gap.
//
Edge_history prev(-1,-1);
for(unsigned int i=1;i<sites->size();i++)
{
Site *psite = &sites->at(i);
int pstate = psite->get_path_state();
Site_children *offspring = psite->get_children();
// left sequence is matched
if(offspring->left_index>=0)
{
Site *tsite = left->get_site_at(offspring->left_index);
if( tsite->has_bwd_edge() )
{
Edge *child = tsite->get_first_bwd_edge();
this->transfer_child_edge(sequence, child, &left_child_index, left_branch_length );
while( tsite->has_next_bwd_edge() )
{
child = tsite->get_next_bwd_edge();
this->transfer_child_edge(sequence, child, &left_child_index, left_branch_length );
}
}
// these create edges to/from skipped sites flanked by gaps.
if( (pstate == Site::matched || pstate == Site::ends_site ) && prev.left_skip_site_index >= 0 && edges_for_skipped_flanked_by_gaps)
{
// edge from the skipped site to the *next* site
// as no better info is available, *this* edge is "copied" to one coming to the current site
Edge query(prev.left_skip_site_index,prev.left_skip_site_index+1);
int ind = left->get_fwd_edge_index_at_site(prev.left_skip_site_index,&query);
if(ind>=0)
{
Edge *child = &left->get_edges()->at(ind);
Edge edge( left_child_index.at(prev.left_skip_site_index), i );
this->transfer_child_edge(sequence, edge, child, left_branch_length );
}
prev.left_skip_site_index = -1;
}
else if(pstate == Site::xskipped && ( prev.path_state == Site::xgapped || prev.path_state == Site::ygapped ) && edges_for_skipped_flanked_by_gaps)
{
// the same here: use this as a template for an extra edge
Edge query(offspring->left_index-1, offspring->left_index);
int ind = left->get_bwd_edge_index_at_site(offspring->left_index,&query);
if(ind>=0)
{
//.........这里部分代码省略.........