You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having thought some more about the two alternative Fst definitions, we definitely want to general definition of Fst in terms of expected pairwise coalescence times:
Fst= (Tt-Tw)/(Tt)
Where Tt is the average for a pairwise sample taken at random. For the case of two populations we assume that we are equally likely to sample from within and between species, i.e.
Tt=(Tb + Tw)/2
Substituting gives:
Fst= (Tb-Tw)/(Tb+Tw)
@GertjanBisschop wrote a simple implementation of this using BranchStat.divergence_matrix:
def Fst(div_entry):
A = np.mean((div_entry.diagonal()))
B = div_entry[1,0]
return (B-A)/(A+B)
@KLohse, can you take a look at the definition of Fst that we've just merged here please? Do we need to add an option to cover the two-population special case? What do you think the right behaviour is?
Ah! I implemented only pairwise Fst (but I think as you have described). We should extend it to be able to do Fst with an arbitrary number of populations. Would either of you, @GertjanBisschop or @KLohse, want to take a stab at this? To see what the indexes argument does, check out the documentation - it'd be great to have someone else see if it explains things well enough.
Hi,
Indeed, Fst is calculated as we described it.
I could definitely make sense out of it all. Indexes is well described in the documentation.
The only thing though is that at the moment Fst cannot be calculated if no indexes are specified.
(I get an error because in the the Fst function wants to enumerate all indexes, line 3287). This all makes sense, however because of the way the function is defined (indexes=None as standard), I assumed it would just work as divergence/diversity did when I didn’t specify any indexes.
Kind regards,
Gertjan
The only thing though is that at the moment Fst cannot be calculated if no indexes are specified.
Good point - the default should be to compute Fst between all the groups, i.e., a default of indexes=[list(range(len(sample_sets)))]? (once the ability to do this non-pairwise is added)
Activity
jeromekelleher commentedon Jun 12, 2019
@KLohse, can you take a look at the definition of Fst that we've just merged here please? Do we need to add an option to cover the two-population special case? What do you think the right behaviour is?
petrelharp commentedon Jun 12, 2019
Ah! I implemented only pairwise Fst (but I think as you have described). We should extend it to be able to do Fst with an arbitrary number of populations. Would either of you, @GertjanBisschop or @KLohse, want to take a stab at this? To see what the
indexesargument does, check out the documentation - it'd be great to have someone else see if it explains things well enough.GertjanBisschop commentedon Jun 12, 2019
petrelharp commentedon Jun 12, 2019
Good point - the default should be to compute Fst between all the groups, i.e., a default of
indexes=[list(range(len(sample_sets)))]? (once the ability to do this non-pairwise is added)jeromekelleher commentedon Aug 13, 2019
This has been implemented.