-
Notifications
You must be signed in to change notification settings - Fork 79
Allow span to be set when generating trees #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
📖 Docs for this PR can be previewed here |
jeromekelleher
left a comment
There was a problem hiding this 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.
docs/python-api.rst
Outdated
| Combinatorics API | ||
| ***************** | ||
|
|
||
| The combinatorics API deals with tree topologies, allowing them to be enumerated and |
There was a problem hiding this comment.
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_..."
python/tskit/combinatorics.py
Outdated
|
|
||
|
|
||
| def all_trees(num_leaves): | ||
| def all_trees(num_leaves, **kwargs): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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())
1120b8d to
e306584
Compare
|
OK, I think I've addressed all the comments now @jeromekelleher - just took the basic option of setting |
jeromekelleher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more issues.
e306584 to
77489cb
Compare
|
Done, thanks @jeromekelleher |
|
Closing and reopening to force a travis rebuild |
77489cb to
20c0402
Compare
Description
Extend the functionality of
Tree.unroot,tskit.all_treesetc to allow trees with spans other than 1. Passing**kwargsmeans 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.