Skip to content

a pyslim helper to find the metadata for a given mutation ID with SLiM 6 metadata is perhaps needed? #430

Description

@bhaller

Hi @petrelharp! It looks like the python code for recipe 19.13 needs updating due to the changes in mutation metadata in SLiM 6. I started poking around with it, and in the end I decided that maybe pyslim ought to have a helper function, or I'm just too clueless in Python. The issue is that where before the script used to loop over mutations and their metadata directly, now it needs to look up their metadata in the separate top-level mutation metadata table. That in itself is something I could no doubt figure out. The problem is that I guess that mutation metadata table ends up as an array in Python, and finding the element in that array that has a mutation ID equal to a given mutation ID (coming from a derived state) would be O(N) in the number of mutations, so the recipe algorithm will end up being O(N^N) I think. It feels like maybe pyslim ought to provide a hash table that indexes into the mutation metadata array, so that looking up metadata for a given mutation ID is O(1) instead. So I figured I'd open this issue and see what you think.

Of course (a) the SLiM recipe could make a hash table itself (somehow?), and serve as an example of how to do that; but this seems like it will be a thing that EVERYBODY will want to do, so (b) it should maybe be functionality built into pyslim. Do you agree? (If you think (a) is the better path, a pointer on how I might implement it would be useful to me. :->)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions