Skip to content

Document example of using ts.simplify(filter=None).draw_svg() to the viz docs, for large trees #2604

Closed
tskit-dev/tutorials
#272

Description

@hyanwong

At the (not insubstantial) risk of adding more parameters to the drawing methods, I think it might be useful to provide an argument to restrict the tree to only a certain subset of sample nodes. Under the hood, this would presumably do a "simplify-edges-only" (see tskit-dev/what-is-an-arg-paper#92 (reply in thread). This would help if we need to visualise large trees, but don't want the node, site, mutation etc IDs to change. The edge IDs will change, of course, but I think that's inevitable, so just need documenting).

Alternatively, we could just implement simplify-edges-only and tell people to do that before plotting.

Activity

  1. hyanwong commented on Oct 17, 2022

    @hyanwong
    MemberAuthor

    Alternatively, we could just implement simplify-edges-only and tell people to do that before plotting.

    ISTR that @molpopgen said that he had a different use for this functionality too.

  2. jeromekelleher commented on Oct 17, 2022

    @jeromekelleher
    Member

    We'd have to implement simplify-edges-only anyway in order to do this, so presumably that's the first step?

    I use ts.simplify(subset).draw_svg(...) quite a bit at the moment and it works fine. Most of the time you're just following the node metadata anyway and the IDs don't matter so much.

  3. hyanwong commented on Oct 17, 2022

    @hyanwong
    MemberAuthor

    We'd have to implement simplify-edges-only anyway in order to do this, so presumably that's the first step?

    Yes, although we could embed this within the drawing code if it's only useful for that.

    I use ts.simplify(subset).draw_svg(...) quite a bit at the moment and it works fine. Most of the time you're just following the node metadata anyway and the IDs don't matter so much.

    Yes, although it's a hassle for looking at internal nodes, which often don't have metadata. And the fact that the sample IDs are always going to be 0..n even if you simplify for samples m .. m+n is bound to catch people out at some point in the future. Also I have found that the fact that the mutation IDs (which are plotted on the trees) change, and the empty sites are dropped, is confusing in the tutorials. That last point can be fixed using the filtering parameters in simplify, though.

  4. jeromekelleher commented on Oct 17, 2022

    @jeromekelleher
    Member

    Yes, although we could embed this within the drawing code if it's only useful for that.

    It's a major change that requires updates to the C code - we'd have to test it in isolation anyway, it would have to be added to the API.

  5. jeromekelleher commented on Oct 17, 2022

    @jeromekelleher
    Member

    I'm not sure we should do this, I think it would be better to help people understand how to pull out subsets by themselves. The edges-only thing is orthogonal.

  6. hyanwong commented on Oct 17, 2022

    @hyanwong
    MemberAuthor

    It's a major change that requires updates to the C code - we'd have to test it in isolation anyway, it would have to be added to the API.

    Yes, unless we use my hack in that discussion to implement it only in the (python) drawing code

    I'm not sure we should do this, I think it would be better to help people understand how to pull out subsets by themselves. The edges-only thing is orthogonal.

    If the edges-only-simplify is available, I think we should tell people to use that to pull out subsets for summary plotting. So it that simply option is to be implemented, I guess I agree, and we can close this (but presumably open a PR for that simplify functionality?)

  7. molpopgen commented on Oct 17, 2022

    @molpopgen
    Member

    Alternatively, we could just implement simplify-edges-only and tell people to do that before plotting.

    ISTR that @molpopgen said that he had a different use for this functionality too.

    The use case I have in mind would have a different name: SUPPRESS_NODE_REMAPPING, which would mean simplify everything but keep the output node table length the same as that of the input table.

  8. jeromekelleher commented on Oct 17, 2022

    @jeromekelleher
    Member

    Let's keep the simplify discussion in #2605

  9. hyanwong commented on Jan 12, 2023

    @hyanwong
    MemberAuthor

    Since we are implementing edges-only simplify, we don't need the additional functionality within the drawing functions, so we can change this to purely a documentation issue

  10. changed the title [-]Subset argument to tree drawing methods[/-] [+]Document example of using ts.simplify(filter=None).draw_svg() to the viz docs, for large trees[/+] on Jan 12, 2023
  11. added
    documentation
    Visualisation
    on Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Visualisationdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions