Skip to content

specify samples by population name #1697

@petrelharp

Description

@petrelharp

It'd be nice to do e.g.

ts.samples("popA")

where "popA" is the name of a population, rather than the index.
Currently we end up doing things like this:

pop_names = [p.metadata['name'] for p in ts.populations()]
sample_sets = [ts.samples(pop_names.index(n)) for n in ["popA", "popB"]]
ts.divergence(
        sample_sets,
        indexes=[(0, 0), (0, 1), (1, 1)]
)

However, this does mean that name is maybe "no longer metadata" since we're using it...

Metadata

Metadata

Assignees

Labels

Python APIIssue is about the Python APIenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions