bug fixes in add_mutation_metadata_tables - #434
Conversation
|
Whoops, sorry - I seem to have missed this? I'll get this in. |
|
Hey @jeffspence - can you let me know what was the code that was wrong that you needed to fix with this? |
|
@petrelharp I triggered the errors in the fork of stdpopsim where I'm working on traits stuff (https://github.com/jeffspence/stdpopsim/tree/traits_into_slim_engine). Running the tests in A MWE that shows both of the issues is in the attached files. mwe.zip contains Let me know if any of that is unclear, or if I'm doing something trivially wrong. |
|
Thanks for this! I've got some tests in that should trigger these issues. I guess we need some more traits-related tests in here! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #434 +/- ##
==========================================
+ Coverage 96.69% 96.71% +0.01%
==========================================
Files 8 8
Lines 909 914 +5
Branches 179 181 +2
==========================================
+ Hits 879 884 +5
Misses 18 18
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
I've been trying to use
pyslimin the multi-trait addition to stdpopsim and was getting some errors related topyslim.add_mutation_metadata_tables. Digging into it, there were two separate things going on:tablesobject passed topyslim.add_mutation_metadata_tableshas multiple traits, that information is not passed intodefault_slim_metadata(), which then results in errors resulting from mismatching dimensions. Addingnum_traits=len(ts_metadata["SLiM"]["traits"])as a kwarg todefault_slim_metadata()fixes that.mut_idsis empty, thennp.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 extendts_metadata["SLiM_mutation_list"]in an if block deals with this, and shouldn't affect anything because ifmut_idsis empty, then there's nothing to add tots_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_allelesdocstring.