BoPeng/simuPOP

Non-operator form of stat function for Fst

Closed this issue · 3 comments

Hi Bo,

I'm trying to calculate Fst among subpopulations outside of an evolve() simulator, in the non-operator form. I keep getting 'None' returned. Please let me know if I'm doing something wrong (code below), or if the structure / Fst stat function is one of the few operators that doesn't have a non-operator form.

Thank you!
Natalie


import simuPOP as sim

# initialize a population with two wild subpopulations & 3 loci
pop = sim.Population(size=[200,200], loci=3)

# initialize sex and genotype frequencies
sim.initSex(pop) 
sim.initGenotype(pop, loci = range(3), freq = [0.5,0.5]) # set all starting allele frequencies to 0.5

# get fst between two subpops
print(sim.stat(pop, structure=range(3), subPops=[0,1], vars = ['F_st']))

On a related note, what I'm more broadly trying to do is calculate Fst in the same population over time, getting Fst between original and final subpop pairings. I assume there isn't a way to calculate Fst among subpopulations of two population objects so instead I saved a copy of the initial population object as Time Zero, and then planned to merge it with the final generation of the the population. Then calculate Fst. That's where I'm getting stuck! Any guidance would be much appreciated.

Please check the manual on how stat works http://simupop.sourceforge.net/manual_svn/build/userGuide_ch5_sec11.html

Basically the results are saved in the population object and you are supposed to retrieve them through pop.dvars().

Thank you!