6.5 years ago by

Santiago de Compostela, Spain

we developed a tool years ago to calculate Fst using the ideas given by this example and migrating those formulas into perl. this is the perl code we use for calculate Fst depending on different population and population group sizes:

```
# GENETIC DIFFERENTIATION (FOR POPULATION GROUPS)
# HT eq groupHexp
# HS = sum( popHexp x popN ) / groupN
# Fst = ( HT - HS ) / HT
$HT = $Hexp{$group};
$HS = 0;
$Fst = 0;
if ($HT != 0) {
foreach $pop (@pops) { $HS += $Hexp{$pop} * $N{$pop}; }
$HS /= $N{$group}
$Fst = ( $HT - $HS ) / $HT;
}
```

where Hexp is the local expected heterozygosity of each subpopulation, HS is the sum of all Hexp multiplied by each population size, and HT is the expected heterozygosity for the entire group of populations considered, all of which you have to previously calculate.

In my opinion different sample sizes shouldn't be a big issue (unless one population is REALLY small). There are several estimators of Fst. You might refer to some very basic approach, such as the one ususally used to teach to undergad students. In that case I alway find useful this page by David McDonald at University of Wyoming. A useful discussion for you is here on biostars: Wright's Fst and Weir & Cockerham's Fst estimator - simple explanation of the difference

2.5kI think this should be an answer, not a comment. it may not be fulfilling all the question's needs completely, but it's still very informative. Giovanni's answer on that post linked is a great Fst reading.

11k@Jorge. I pasted my comment as an answer. I read on github that currently moderators cannot convert comments to anwsers, so I guessed I had to do it... Should I remove my comment now?

2.5kto be honest, neither do I! if a more experienced moderator finds it necessary I'm sure he'll do that for you without losing your upvotes. I've already changed my upvote to the answer instead of leaving it on the comment in case it helps in any way.

11kThanks, good answer!

3.0k