natsel_zhang – a branch-site test

This is the hypothesis test presented in Zhang et al. It evaluates the hypothesis that a set of sites have undergone positive natural selection on a pre-specified set of lineages.

For this model class, there are groups of branches for which all positions are evolving neutrally but some proportion of those neutrally evolving sites change to adaptively evolving on so-called foreground edges. For the current example, we’ll define the Chimpanzee and Human branches as foreground and everything else as background. The following table defines the parameter scopes.

Note

Our implementation is not as parametrically succinct as that of Zhang et al, we have 1 additional bin probability.

Getting the posterior probabilities of site-class membership

Getting all the statistics in tabular form