From e43719c25b8eb55fb9c4f86274c449a16eb2f1ac Mon Sep 17 00:00:00 2001 From: Stephane Guindon Date: Wed, 14 Aug 2024 12:09:36 +0200 Subject: [PATCH] Fixed bug in reading (and printing) bootstrap support values --- src/io.c | 24 +++++++++++++++++------- src/main.c | 2 +- src/nexus.c | 6 ++++-- src/utilities.c | 4 ++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/io.c b/src/io.c index 09b21544..b18d654c 100644 --- a/src/io.c +++ b/src/io.c @@ -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); } @@ -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) { diff --git a/src/main.c b/src/main.c index 9f226a57..9dca7347 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/nexus.c b/src/nexus.c index eb9ba137..22976d9d 100644 --- a/src/nexus.c +++ b/src/nexus.c @@ -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")) @@ -288,7 +290,7 @@ 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")) @@ -296,7 +298,7 @@ int Read_Nexus_Format(char *token, nexparm *curr_parm, option *io) 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")) diff --git a/src/utilities.c b/src/utilities.c index dc94178b..984fa884 100644 --- a/src/utilities.c +++ b/src/utilities.c @@ -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); @@ -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); } ////////////////////////////////////////////////////////////// @@ -4226,7 +4227,6 @@ int Compare_Bip(t_tree *tree1, t_tree *tree2, int on_existing_edges_only) } out: ; } - return n_edges - identical; }