feat: emit reconstructed ancestral sequences from timetree - #939
Merged
Conversation
- Add the reconstructed nucleotide FASTA output to the timetree command, the v1 equivalent of v0's ancestral_sequences.fasta, reusing the ancestral command's marginal reconstruction rather than a second code path. - Drive tip output with the already-threaded separated flags: --include-leaves emits reconstructed tips, --impute-missing-data resolves ambiguous tip states, --reconstruct-tip-states enables both. - Refresh marginal posteriors before reconstruction so emitted sequences reflect the final branch lengths, matching the ancestral command's ordering. - Name the rerooted root before serialization: rerooting introduces a fresh root the load-time naming pass never saw, so every internal node carries a NODE_<n> name across the FASTA, augur node data, and tree outputs, matching v0 and the ancestral command.
- Assert internal-only emission with named nodes, exact leaf echo under --include-leaves, and ambiguous-tip resolution under --reconstruct-tip-states. - Smoke-cover --reconstruct-tip-states and the separated --include-leaves/--impute-missing-data on the CLI.
- Resolve the tip-state-flags-not-wired and ancestral-sequences-FASTA-unimplemented issues, now delivered. - Mark both feature-inventory rows implemented. - Narrow the unnamed-rerooted-root issue and its ticket to the clock command, since timetree now names nodes after its pipeline.
7 tasks
Base automatically changed from
fix/ancestral-marginal-tip-reconstruction
to
rust
August 31, 2026 17:39
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.
Resolve:
Update:
Depends on: #938, #937
The
timetreecommand accepted--include-leaves,--impute-missing-data, and the--reconstruct-tip-statesalias but emitted no sequences, so the flags were inert and TreeTime v0'sancestral_sequences.fastahad no v1 counterpart undertimetree.timetreenow writes a reconstructed nucleotide FASTA, selected with--output-reconstructed-nuc-fasta[src] and produced by default under--output-all[src]. It reuses the marginal reconstruction theancestralcommand runs rather than a second sequence path: after the pipeline settles the tree, a refreshed marginal pass materializes each node's flag-aware sequence and emits it [src]. Rerooting leaves a fresh unnamed root, so every unnamed internal node is named once before serialization, matching v0 and theancestralcommand across the FASTA, the augur node data, and the tree outputs [src]. Thetimetreestep's produced-output set in the pipeline resolver gains the reconstructed FASTA so a later step can chain it [src].Reusing the
ancestralreconstruction keepstimetreesequence output on the same numerically validated path: internal-node sequences come from the marginal MAP states already used for the tree mutations, non-imputed tips echo their observed input exactly, and--impute-missing-dataresolves ambiguous tip states to the marginal argmax as approved in the tip-reconstruction decision. Refreshing the marginal posteriors before reconstruction ties the emitted sequences to the final branch lengths, the same ordering theancestralcommand uses.Work items
--output-all[src]--output-reconstructed-nuc-fastapath flag totimetree[src]resolve_outputsmapping so the pipeline can chain it [src]NODE_<n>names [src]Possible improvements