treetime icon indicating copy to clipboard operation
treetime copied to clipboard

Binary Sequence Alignement

Open adrienlemeur opened this issue 2 years ago • 3 comments

Hello, Do you consider adding binary alignement / models ? Thanks,

Adrien

adrienlemeur avatar Jun 08 '23 13:06 adrienlemeur

this is possible in a script when using TreeTime as a library. But it is currently not exposed to the command line. If this is an option for you, I can give you a few pointers.

rneher avatar Jun 16 '23 07:06 rneher

Oh thank you ! I was afraid that treetime was a C library but I should be fine with Python ! Is is straightforward ?

adrienlemeur avatar Jun 19 '23 13:06 adrienlemeur

when you use TreeTime as a library, you set it up like this (for ancestral sequence reconstruction, time trees follow a similar pattern with with TreeTime instead of TreeAnc):

https://github.com/neherlab/treetime_examples/blob/master/scripts/ancestral_sequence_inference.py#L15

Instead of Jukes-Cantor, you can feed the gtr argument a GTR model. to make a binary model, you should be able to do

from treetime import GTR

myGTR = GTR.custom(alphabet=['a', 'b'])

see the constructor here:

https://github.com/neherlab/treetime/blob/master/treetime/gtr.py#L278

rneher avatar Jul 07 '23 15:07 rneher