fix: pass marginal flag to all infer_ancestral_sequences calls#602
Merged
Conversation
Three call sites in TreeTime._run() pass **seq_kwargs to infer_ancestral_sequences without mapping marginal_sequences to the marginal parameter. The function defaults marginal=False, silently falling back to joint reconstruction in later iterations. - Add explicit marginal=seq_kwargs['marginal_sequences'] to the post-reroot call (input mode) and both iteration-loop calls, matching the pattern already used in the initial call - Add regression test that records every marginal argument and asserts none are False when branch_length_mode='marginal' Fixes #601
Member
|
this seems correct. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TreeTime._run()builds aseq_kwargsdict containingmarginal_sequences: Truewhenbranch_length_mode='marginal'. The first call toinfer_ancestral_sequencescorrectly maps this to themarginalparameter, but three later call sites pass only**seq_kwargs. Sinceinfer_ancestral_sequenceshasmarginal=Falseas default and does not consumemarginal_sequencesfrom**kwargs, those calls silently fall back to joint reconstruction in all iterations after the first.This PR adds
marginal=seq_kwargs['marginal_sequences']to the three affected call sites, matching the pattern already used in the initial call at line 238. A regression test monkeypatchesinfer_ancestral_sequencesto record everymarginalargument value and asserts that none areFalsewhen marginal mode is requested. Without the fix, the test fails at call #5; with the fix, all calls correctly use marginal reconstruction.Work items
marginal=argument to the post-rerootinfer_ancestral_sequencescall (input branch-length mode)marginal=argument to both iteration-loopinfer_ancestral_sequencescallstest_marginal_mode_used_in_all_iterations