sjspielman / pyvolve

Python library to simulate evolutionary sequence data
Other
78 stars 23 forks source link

Error in LG exchangeabilities #13

Closed dschrempf closed 5 years ago

dschrempf commented 5 years ago

Hello, I tried to use pyvolve with the LG model. I noticed that the LG matrix is incorrect (number of substitutions per unit time is 0.9...). After one hour of debugging I noticed that there is an error in your exchangeabilities. When assigning and printing

e_lg = np.array(pyvolve.empirical_matrices.lg_matrix)
print(e_lg)

at least one entry in e_lg is wrong: instead of 10.649107, I read 0.649107. Please correct me, if this is my mistake! I use pyvolve 0.8.9, installed with pip3.

Thank you, Dominik

sjspielman commented 5 years ago

Dear Dominik,

There should be no error here, but there's always a chance. A couple things -

  1. Note that the order of amino acids is alphabetical based on single letter codes in pyvolve, i.e. ACDEF...

  2. The matrices you see when printing out in the code above are unscaled. Matrices are always scaled to consider # substitutions/per unit time = 1 before simulation once the state frequencies are specified. So, what you are printing out above is indeed not correct per unit time, but this isn't the final matrix used to simulate.

If you still think there's a bug, let me know and I'll look into it further.

Best, Stephanie

dschrempf commented 5 years ago

Dear Stephanie,

thanks for your answer.

The exchangeability of the LG matrix in PAML order from V to I (index 19, 9) is 10.649107.

The exchangeability in your pyvolve.empirical_matrices.lg_matrix in alphabetical order from V to I (index 17, 7) is 0.649107.

I hope that this helps and sincerely apologize if this is my error, but I do not think so.

sjspielman commented 5 years ago

Dominik,

Thanks - I will address this immediately and release a new version (here and via pip) within the next couple of minutes.

-Stephanie

sjspielman commented 5 years ago

New release made, please re-download.