Skip to content

bug fixes in add_mutation_metadata_tables - #434

Open
jeffspence wants to merge 2 commits into
tskit-dev:mainfrom
jeffspence:main
Open

bug fixes in add_mutation_metadata_tables#434
jeffspence wants to merge 2 commits into
tskit-dev:mainfrom
jeffspence:main

Conversation

@jeffspence

@jeffspence jeffspence commented Aug 19, 2026

Copy link
Copy Markdown

I've been trying to use pyslim in the multi-trait addition to stdpopsim and was getting some errors related to pyslim.add_mutation_metadata_tables . Digging into it, there were two separate things going on:

  1. If the tables object passed to pyslim.add_mutation_metadata_tables has multiple traits, that information is not passed into default_slim_metadata(), which then results in errors resulting from mismatching dimensions. Adding num_traits=len(ts_metadata["SLiM"]["traits"]) as a kwarg to default_slim_metadata() fixes that.
  2. if mut_ids is empty, then np.array(mut_ids, dtype="int") only has one dimension (of length 0), but subsequent code assumes that it is 2 dimensional. Wrapping the code to extend ts_metadata["SLiM_mutation_list"] in an if block deals with this, and shouldn't affect anything because if mut_ids is empty, then there's nothing to add to ts_metadata["SLiM_mutation_list"] anyway.

I didn't write any tests for these because I'm not sure where to start (and a bunch of the tests are currently failing independent of the code changes proposed in this PR) but I'd be happy to do that with a bit of guidance.

Edit: I also found a missing word in the convert_alleles docstring.

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.

1 participant