Skip to content
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

Generic iterator class for trees and variants #2762

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hyanwong
Copy link
Member

@hyanwong hyanwong commented Jun 13, 2023

Description

Pull out the logic that iterates over trees and variants into a single base class, and allow this class to return a length.
Also allows left, right, copy to be passed to the trees() iterator (to match the variants() iterator), so that we can
iterate over a subset of the genome.

Also implements next() and prev() for trees, to match the variants iterator (they are handy anyway, right?)

Fixes #2625, #24

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

@hyanwong
Copy link
Member Author

BTW, this renders ts.aslist() a bit obsolete, as you can do ts.trees(copy=True), in the same way you do for variants.

Also allows left and right to be passed to the trees iterator.
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.

Make tqdm(ts.variants()) work better
1 participant