More working in new split infraestructure

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1594 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
wcancino 2009-06-29 16:23:17 +00:00
commit d0d4b4bd0e
2 changed files with 15 additions and 6 deletions

View file

@ -253,7 +253,7 @@ edge phylotreeIND::choose_edge_fromside( int idx, bool side ) const
// select and edge from a side of a split
// true = inside
// false = outside
edge phylotreeIND::choose_edge_fromside_2( struct split_info &info, bool inside ) const
edge phylotreeIND::choose_edge_fromside_2( struct split_info *info, bool inside ) const
{
edge edgeaux;
bool chosen = false;
@ -261,20 +261,21 @@ edge phylotreeIND::choose_edge_fromside_2( struct split_info &info, bool inside
{
edgeaux = select_edge();
struct split_info *info2 = interior_edge[edgeaux];
if ( info == NULL ) return edgeaux;
if( is_internal(edgeaux) )
{
int taxon_map = splitstable[ taxon_id(edgeaux.target()) ].map_to_node;
if( inside)
chosen = ( taxon_map >= info.left && taxon_map <= info.right );
chosen = ( taxon_map >= info->left && taxon_map <= info->right );
else
chosen = ( taxon_map < info.left || taxon_map > info.right );
chosen = ( taxon_map < info->left || taxon_map > info->right );
}
else
{
if ( inside )
chosen = ( info.left <= info2->left && info.right >= info2->right );
chosen = ( info->left <= info2->left && info->right >= info2->right );
else
chosen = ( info.left > info2->right || info.right < info2->left );
chosen = ( info->left > info2->right || info->right < info2->left );
}
}
@ -371,6 +372,13 @@ void phylotreeIND::init()
}
bool phylotreeIND::split2(edge edgeaux)
{
if (is_internal(edgeaux)) return 0;
struct split_info *part_info = interior_edge[edgeaux];
return (part_info->side == 0);
}

View file

@ -111,7 +111,7 @@ class phylotreeIND
void mutate_branch_lenght ( float );
edge select_edge_outsidetree ( edge source_edge ) const;
edge choose_edge_fromside ( int id, bool side ) const;
edge choose_edge_fromside_2( struct split_info &info, bool inside ) const;
edge choose_edge_fromside_2( struct split_info *info, bool inside ) const;
edge choose_neighboor ( edge, node ) const;
@ -204,6 +204,7 @@ class phylotreeIND
inline bool splits_valid() const { return valid_splits; }
inline bool split ( edge edgeaux, node nodeaux ) const
{ return split_bits[ edgeaux.id() * TREE.number_of_nodes() + nodeaux.id() ]; }
bool split2(edge edgeaux);
void read_newick ( string newickstring );
void read_newick2 ( string newickstring );