Ah-ha: good question. As you've noted, there's two distinct places to
find out an individual's subpopulation: (a) as the subpopulation
property of metadata, and (b) as the population attribute of its
nodes. It is the latter that is stored in `individual_populations`.
ind = ts.individual(0)
metadata_pop = ind.metadata['subpopulation'] # this is (a)
for n_id in ind.nodes:
node = ts.node(n_id)
node_pop = node.population # this is (b)
assert node_pop == ts.individual_populations
And, SLiM always puts nodes (i.e., chromosomes) in the tree sequence,
but only puts in individuals when asked to. So, (a) is recorded at the
end of the simulation, or when the individual is remembered; and (b)
is recorded at birth. They'll differ if the individual is a migrant,
as you've observed. But, I think that it should be the opposite, as
you expect - that metadata should have the current location and
individual_populations should have the origin. Are you sure you've got
things the right way around?
> SLiM forward genetic simulation: http://messerlab.org/slim/
> You received this message because you are subscribed to the Google Groups "slim-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com
> To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/CADBWwQmLD3YWvQzaHBCU9Z3PYpFJO%3D4d-aSQs3G-VPf%2BNvrxiA%40mail.gmail.com