-
Notifications
You must be signed in to change notification settings - Fork 74
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
Make tqdm(ts.variants()) work better #2625
Comments
Should be straightforward, we just have to abstract the code for the variants function into an iterator class (which returns the right len), a bit like the current TreeIterator class. |
Just revisiting this. The |
I don't think the |
Sorry, I mean that the code that produces the TreeIterator wrapper could generalised to provide a wrapper that would work (subclassed, presumably) for the Variants. But only if there was a generalised way to deal with |
Breakpoints are stored on the tree sequence object, and are accessible from Python, so I think that could be used to get a count of the trees in the interval for |
Yeah, this does it, I think: ts._check_genomic_range(left, right)
breaks = ts.breakpoints(as_array=True)
left_index = breaks.searchsorted(left, side="right")
right_index = breaks.searchsorted(right, side="left")
num_trees = right_index - left_index + 1 |
It would be nice if this would pull out the overall length of the iter. Should be easy enough?
The text was updated successfully, but these errors were encountered: