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

Restrict genome coordinates #70

Open
hyanwong opened this issue Jul 24, 2024 · 0 comments
Open

Restrict genome coordinates #70

hyanwong opened this issue Jul 24, 2024 · 0 comments

Comments

@hyanwong
Copy link
Contributor

It's relatively common to want to restrict the genome coordinate space to show e.g. positions 1000...2000. One way we do this in the draw_svg() command is to look to see if the first and last trees are "empty" (i.e. have num_edges==0), and if so, change the X-coordinates to go from the left of the first non-empty tree to the right of the last non-empty tree. Coupled with the change in #69, that means it's possible to do

ts_arg = ts_arg.keep_intervals([[1000, 2000]], simplify=False)
# Now plot, without showing all the unreferenced nodes

The nice thing about this is that it only shows the "useful" sections of the tree sequence (e.g. in inferred tree sequences we often trim the flanking regions away, which cover telomeres etc).

An alternative, which we also have in draw_svg, is an x_lim parameter (under the hood, I think this simply does keep_intervals(..., simplify=False) before displaying).

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

No branches or pull requests

1 participant