Closed aabiddanda closed 1 year ago
Hi @aabiddanda! This is a good idea, so I agree we need to export an API function for this. And I think your choice to put this at demes.Graph.rename_demes()
is a good one. Actually, there's already an implementation of this function hiding in the ms conversion code (see below). Perhaps you'd like to move the existing code and make the ms converter use the new function instead? The assert should be changed to raise a ValueError instead, and the function probably needs its own set of tests (it looks like I was a bit lazy with the existing tests, and just tested the function that calls the renaming code).
Patch coverage: 100.00
% and no project coverage change.
Comparison is base (
392c6a0
) 99.81% compared to head (8339d52
) 99.81%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@grahamgower great spot on this lurking already in the codebase! I'll move this code to the appropriate place and implement some tests explicitly targeting this functionality to pass codecov
shortly.
@grahamgower should the changelog be changed as well? I don't think that this necessarily constitutes a new version per-se but to maintain that it is a new feature in a to-be-released version? Let me know if this would be easier to handle closer to when you are thinking about releasing another version.
Don't worry about the changelog - I'll update that when I do the next release.
I encountered a need for this feature when looking to develop a
snakemake
workflow that expected specific deme labels for post-processing of simulations. The method is fairly straightforward and implements the type-checks. I will update the tests for this as well if it is a useful feature for others to have or if alternative spec-checks should be performed.