-
Notifications
You must be signed in to change notification settings - Fork 77
How to skip empty regions at the start and end of a tree seq #2600
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
Comments
This also makes me think that a |
Good idea, how about for tree in ts.trees(skip_missing=True):
... we define a tree as |
This would clash with seeking methods, but I don't think we need them anyway if we use |
Sure. I was simply thinking of an attribute that returned @property
def last(self)
return self.index == self.tree_sequence.num_trees - 1 |
I meant it would clash with the method called first Anyway, like I say, I don't think we need it. |
Ah, ISWYM - I forgot that existed. |
Actually, I think this particular definition is a bad idea, because of the Given that it's not obvious, I suspect a convenience function, |
tree.num_edges = 0 is a good definition, and an |
We decided at a group meeting that in the absence of current user demand, we can suggest the following in documentation, which is possibly clearer than a specific parameter anyway for tree in ts.trees():
if tree.num_edges == 0:
continue
# Do stuff |
Note that |
Uh oh!
There was an error while loading. Please reload this page.
We are about to make a change to tsinfer so that the regions before the last site and after the last site in a tree sequence have no topology. I imagine that this could be quite confusing for people looping through the trees, as sometimes (if the first site is not at position 0), the first tree will have num_roots == num_samples, and will not have any topology.
I suspect it would be useful to be able to skip these empty regions at the start and end of a tree sequence when using the
trees()
iterator. Have we any suggestions for a nice interface to do this? At the moment I'm doing something like this:But I think that might be a bit advanced for normal users to have to do regularly?
The text was updated successfully, but these errors were encountered: