veg / hyphy

HyPhy: Hypothesis testing using Phylogenies
http://www.hyphy.org
Other
217 stars 69 forks source link

Branch length optimization when the model has a global parameter #571

Closed halabikeren closed 6 years ago

halabikeren commented 7 years ago

Hi,

I see that when I conduct branch length optimization on a tree with a model that has a global parameter, all the branches receive the same length.

Example: I took the tutorial script basics.bf: basics.bf.txt The script uses the sane data provided in the tutorial.

When using the script with the setting of parameter mu as local, the estimated branch lengths vary: messages_local_mu.log.txt

When using the script with the setting of parameter mu as global, the estimated branch length are all the same: messages_global_mu.log.txt

I'm not sure I understand why. Could you please clarify on that?

Thanks! Keren

spond commented 7 years ago

Dear @halabikeren,

This is exactly as expected. When you declare mu as global, it will be shared by all branches in the tree, hence the resulting branch length estimates are the same. Declaring mu as local, on the other hand, creates a parameter mu per branch, i.e. tree myTree.a.mu, myTree.b.my, etc.

Best, Sergei

halabikeren commented 7 years ago

Thank you Sergei,

I'm afraid I'm lacking some basic understanding of model settings in HBL.

As per my understanding, when setting a model with a tree, the initial branch lengths of the tree are disregarded, and new branch lengths are calculated as the sum of the diagonal entries of their corresponding rate matrices.

However, when I try to verify this, I receive different outcome.

code in: test.bf.txt

input for code: data.seq.txt

output log in: messages.log.txt

As can be seen, regardless of the set mu value (1 or 2), the calculated branch lengths remain the same. I can see that the relations between the calculated branch lengths remain the same as the ones in the input tree, so this leads me to believe that I have some misunderstanding of the branch length calculation.

I would greatly appreciate a clarification of the branch lengths calculation process.

Thanks!