tskit-dev / pyslim

Tools for dealing with tree sequences coming to and from SLiM.
MIT License
27 stars 23 forks source link

switch to using `ts.samples(time=X)` in examples? #208

Closed petrelharp closed 2 years ago

petrelharp commented 2 years ago

This will be easier than doing ts.individuals_alive_at( ) because individuals might not be samples.

petrelharp commented 2 years ago

This sometimes doesn't it, actually, since we want to take a subsample of diploids. From the Tutorial:

alive_inds = rts.individuals_alive_at(0)
keep_indivs = np.random.choice(alive_inds, 100, replace=False)
keep_nodes = []
for i in keep_indivs:
  keep_nodes.extend(rts.individual(i).nodes)