Skip to content

Conversation

@hyanwong
Copy link
Member

Description

Extend the functionality of Tree.unroot, tskit.all_trees etc to allow trees with spans other than 1. Passing **kwargs means that we can also extends this if (for example) we want to be able to set node/root times on the generated trees. Also document that a new ts is created for each new tree, and change the API section titles "Metadata" and "Combinatorics" so they aren't confused with the pages of those names.

@AdminBot-tskit
Copy link
Collaborator

📖 Docs for this PR can be previewed here

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a useful thing to have. I'd be hesitant about invoking kwargs here though, we don't want to end up in matplotlib territory.

Combinatorics API
*****************

The combinatorics API deals with tree topologies, allowing them to be enumerated and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enumerate means "count". I would say "allowing them to be counted, listed and generated; see sec_..."



def all_trees(num_leaves):
def all_trees(num_leaves, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this - why not just have span=None here? If we don't expect to have lots of parameters, then it's just making it hard for users to know where parameters come from. It's the same amount of typing, for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I um-ed and ah-ed about putting it in. The argument for doing so is that we might want to add other features such as specifying branch length or node labels, which we would simply add to the underlying to_tsk_tree() method, and then get all the rest for free. But I could explicitly specify span for the time being (and repeat the docstring description for all the methods that call to_tsk_tree())

@hyanwong
Copy link
Member Author

OK, I think I've addressed all the comments now @jeromekelleher - just took the basic option of setting span=1 for all the functions - that way at least it's clearly documented (and I can't see any other default value would be sensible).

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more issues.

@hyanwong
Copy link
Member Author

Done, thanks @jeromekelleher

@hyanwong
Copy link
Member Author

Closing and reopening to force a travis rebuild

@mergify mergify bot merged commit 64f1c62 into tskit-dev:main Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants