tskit icon indicating copy to clipboard operation
tskit copied to clipboard

Add `individuals=` argument to everything.

Open grahamgower opened this issue 2 years ago • 6 comments

Reasoning: #2047. See also #464.

Presumably we also want a get_individuals_associated with_sample_nodes() function.

grahamgower avatar Dec 09 '21 19:12 grahamgower

It'd be helpful to list out the functions that we want here. Anyone fancy going through the API and see where it makes sense to add individuals? (I suppose a first pass would be "everywhere we use samples"?)

We also want to think about whether we update things like sample_sets in the stats methods to accept individuals, and how we might go about doing that.

jeromekelleher avatar Dec 10 '21 09:12 jeromekelleher

See also #1697

jeromekelleher avatar Dec 10 '21 11:12 jeromekelleher

Does it make sense to deprecate arguments named "samples" and replace them with "sample_nodes" and "sample_individuals"?

molpopgen avatar Dec 11 '21 23:12 molpopgen

It does, but I hate to churn everyone's code like that...

petrelharp avatar Dec 12 '21 09:12 petrelharp

It does, but I hate to churn everyone's code like that...

We can raise FutureWarning when samples is used for a release or 2, then remove it. I think that'd be plenty of lead time. I think it's best to get the clean interface that we want.

molpopgen avatar Dec 12 '21 11:12 molpopgen

Does it make sense to deprecate arguments named "samples" and replace them with "sample_nodes" and "sample_individuals"?

I don't know if I'm such a fan of this - I don't mind deprecating obscure features that we're pretty sure no one uses, but this is core functionality. Personally I like be able to run old code without having to make a special env...

In a lot of cases I think it's probably fine to change the current signature from

def simplify(self, samples=None,  *, ...)

with

def simplify(self, sample_nodes=None,  *,  samples=None, ...)

and do the standard "samples is an alias for sample_nodes" thing. Then we're not going to break any code. It's not such a big deal to carry around a few parameter aliases (there's quite a few of them around already).

jeromekelleher avatar Dec 13 '21 09:12 jeromekelleher