Closed mufernando closed 4 years ago
Well, let's see:
ind_pops = np.array([i.population for i in ts.individuals()])
gives you the population for each individual - is that what you need?
solved. see commit 380068157345bdd0e444ec81a85fd3de6a638708
see https://github.com/mufernando/greatapes_sims/commit/cc6c9cd0c24c53b42e70aade88612e38edf95e28
because we can have more than one subpopulation per tree sequence and we want to calculate some stats to each subpop individually, I need to subset my genotype matrix. it is possible to get the indices belonging to a population for each haploid genome using tskit with
ts.samples(population=i)
, but not for diploid genomes. If I were to treat the genotype matrix with ploidy=2, I wouldn't be able to do the subsetting this way.ploidy should not matter for the stats we are using so far (pi and dxy), but could be an issue with other stats.