Skip to content

Commit

Permalink
Fixed bug in reading (and printing) bootstrap support values
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaneguindon committed Aug 14, 2024
1 parent 1ece9fa commit e43719c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
24 changes: 17 additions & 7 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,21 @@ void Read_Branch_Support(char *s_d, char *s_a, t_edge *b, t_tree *tree)
p++;

i = 0;
if(p[i] == '(') i = Next_Matching_Char(p,'(',')',i);
i++;
if(p[i] == '[') i = Next_Matching_Char(p,'[',']',i);
i++;
if(p[i] != ':') b->support_val = atof((char *)p);
if(p[i] == '(')
{
i = Next_Matching_Char(p,'(',')',i);
i++;
}
if(p[i] == '[')
{
i = Next_Matching_Char(p,'[',']',i);
i++;
}

if(p[i] != ':')
{
b->support_val = atof((char *)(p+i));
}

Free(sub_tp);
}
Expand Down Expand Up @@ -6222,12 +6232,12 @@ void Collect_Edge_Support_Values(t_tree *tree)
{
if(tree->io->do_boot == YES)
{
tree->a_edges[i]->support_val = tree->a_edges[i]->bip_score;
tree->a_edges[i]->support_val = (phydbl)tree->a_edges[i]->bip_score;
}
else if(tree->io->do_tbe == YES)
{
int pminus1=MIN(tree->a_edges[i]->left->bip_size[tree->a_edges[i]->l_r], tree->a_edges[i]->rght->bip_size[tree->a_edges[i]->r_l])-1;
tree->a_edges[i]->support_val = 1-((tree->a_edges[i]->tdist_score)/(tree->io->n_boot_replicates*1.0))/pminus1;
tree->a_edges[i]->support_val = 1.-((tree->a_edges[i]->tdist_score)/(tree->io->n_boot_replicates*1.0))/pminus1;
}
else if(tree->io->do_alrt == YES)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ int main(int argc, char **argv)
/* Print the most likely tree in the output file */
if(!io->quiet) PhyML_Printf("\n\n. Printing the most likely tree in file '%s'.", Basename(io->out_tree_file));
if(io->n_data_sets == 1) rewind(io->fp_out_tree);

t_tree *dum;
dum = Read_Tree(&most_likely_tree);
dum->data = cdata;
Expand Down
6 changes: 4 additions & 2 deletions src/nexus.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,14 @@ int Read_Nexus_Format(char *token, nexparm *curr_parm, option *io)
{
io->datatype = NT;
io->mod->ns = 4;
io->mod->whichmodel = HKY85;
}

else if(!strcmp(curr_parm->value,"protein"))
{
io->datatype = AA;
io->mod->ns = 20;
io->mod->whichmodel = LG;
}

else if(!strcmp(curr_parm->value,"continuous"))
Expand All @@ -288,15 +290,15 @@ int Read_Nexus_Format(char *token, nexparm *curr_parm, option *io)
PhyML_Printf("\n== The 'missing' subcommand is not supported by PhyML. Please remove it from the NEXUS file.");
PhyML_Printf("\n== Note that the characters 'X', '?' and '-' will be considered as indels by default.");
PhyML_Printf("\n== Err. in file %s at line %d\n",__FILE__,__LINE__);
Exit("");
/* Exit(""); */
}

else if(!strcmp(curr_parm->name,"gap"))
{
PhyML_Printf("\n== The 'gap' subcommand is not supported by PhyML. Please remove it from the NEXUS file.");
PhyML_Printf("\n== Note that the characters 'X', '?' and '-' will be considered as indels by default.");
PhyML_Printf("\n== Err. in file %s at line %d\n",__FILE__,__LINE__);
Exit("");
/* Exit(""); */
}

else if(!strcmp(curr_parm->name,"symbols"))
Expand Down
4 changes: 2 additions & 2 deletions src/utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,6 +3277,7 @@ void Bootstrap(t_tree *tree)
else if(tree->io->do_tbe) Compare_Bip_Distance(tree, boot_tree);
else assert(FALSE);


Check_Br_Lens(boot_tree);
Br_Len_Involving_Invar(boot_tree);

Expand Down Expand Up @@ -3330,7 +3331,7 @@ void Br_Len_Involving_Invar(t_tree *tree)
return;
}

For(i,2*tree->n_otu-1) tree->a_edges[i]->l->v *= (1.0-tree->mod->ras->pinvar->v);
for(i=0;i<2*tree->n_otu-1;++i) tree->a_edges[i]->l->v *= (1.0-tree->mod->ras->pinvar->v);
}

//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -4226,7 +4227,6 @@ int Compare_Bip(t_tree *tree1, t_tree *tree2, int on_existing_edges_only)
}
out: ;
}

return n_edges - identical;
}

Expand Down

0 comments on commit e43719c

Please sign in to comment.