Using Phaghorn or other R package to calculate tree likelihoods

29 Views Asked by At

I am trying to calculate the maximum likelihood for certain trees using R. I have done this by hand, and I would like to test them now using packages in R.

I would like to calculate the likelihoods given the following:

Tree file (nwk): ((A:2,B:3)E:2,(C:1,D:5)F:3)R;

Locations file (csv): A,France B,Germany C,Germany D,France

Rate matrix (string input): '-1, 1; 1, -1'

So far, I have written code to read the tree, read the rate string and convert to matrix (given nrow=2). I have also written code to normalize the rate matrix based on the frequencies (in this example frequencies are just 0,5 for France and Germany. We can assume equal frequencies), to get the Q matrix.

I now would like to use a package to calculate the maximum likelihood for this tree given the tree, the locations, and the Q matrix.

I have tried using pml and ace, but I was not able to get it to work.

0

There are 0 best solutions below