Skip to content

Consider ordering requirements for individual table. #1138

Closed

Description

@benjeffery

#1125 adds parents to the individual table. Currently there are no sorting requirements on the individual table.

@jeromekelleher and I discussed this and thought that enforcing that parents come before children in the table would presumably be useful and also ensure that there are no loops in the pedigree. Thoughts @petrelharp?

Activity

  1. added this to the Python 0.3.5 milestone on Jan 25, 2021
  2. petrelharp commented on Jan 25, 2021

    @petrelharp
    Contributor

    Hm. It would presumably be useful. But it would also totally mess up how SLiM use the individual table. That's fine as long as we don't require this for simplify_tables, but it's a bit awkward to have these caveats about this algorithm not needing that sortedness property, etcetera. On the other hand, I see how this would make developing pedigree algorithms much easier and more efficient! So, I guess my suggestions are:

    • we should at least have canonicalise put individual parents before children, and
    • we could either add it to the list of standard sortedness requirements, but ensure simplify doesn't require it, or
    • allow pedigree algorithms to require the property (which can be checked with two passes through the table).

    Those two options aren't very different, as they're both introducing an extra property to keep track of; the question is just whether it's default or not. We could wait until someone starts developing pedigree algorithms to see how useful it is?

  3. jeromekelleher commented on Jan 25, 2021

    @jeromekelleher
    Member

    That's good to know, thanks @petrelharp. I think we could add the ordering to the standard tree sequence requirements without breaking simplify cleanly enough by adding a CHECK_INDIVIDUAL_ORDERING to the list of flags for check_integrity here. Simplify won't need to provide this flag, as all it'll be doing is remapping IDs.

    That would mean that individual IDs in SLiM would need to be rejiggered at the end before output so that the output file is a valid tree sequence, but that could be done efficiently with some version of canonicalise/subset or whatever. If the original IDs are important, then I guess these could be tracked via metadata or something.

    I thought that parents-being-before-children would have mapped very naturally to forward simulations - SLiM must be using the individual table quite differently then?

    (which can be checked with two passes through the table).

    It's just one pass, isn't it? All we're saying is basically there's no forward references: at row j, the parent values must be < j.

  4. petrelharp commented on Jan 25, 2021

    @petrelharp
    Contributor

    That would mean that individual IDs in SLiM would need to be rejiggered at the end before output so that the output file is a valid tree sequence, but that could be done efficiently with some version of canonicalise/subset or whatever. If the original IDs are important, then I guess these could be tracked via metadata or something.

    Well, SLiM uses ordering in the output tables to ensure that if the tables are read back in to SLiM, everything is in the same internal state it was before. This is a very useful property to have, for reproducibility. You're right: it might actually be that parents would come before children naturally; and if not then I think we could deal with this by reordering using the SLiM IDs in metadata. But individual ordering has been a difficult can of worms before, so I'm not enthusiastic about rejiggering it. It probably wouldn't be too bad, though.

    It's just one pass, isn't it? All we're saying is basically there's no forward references: at row j, the parent values must be < j.

    You're right. =) It's sorting to ensure this property that requires two passes.

  5. benjeffery commented on Mar 4, 2021

    @benjeffery
    MemberAuthor

    Closed by #1199

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions