Add extant sequence reconstruction (-esr) and gap-aware ASR/ESR (-gap-asr, -gap-esr) - #223
Open
trongnhanuit wants to merge 60 commits into
Open
trongnhanuit wants to merge 60 commits into
trongnhanuit wants to merge 60 commits into
Conversation
…eversible implementations of computeLikelihoodBranch
…responding output file
…ase: given a treefile and a single alignment
…equence even if users specify -blfix
…R2 + rate model from the original model
…s don't contain any gap
… while some others are non-gapped
# Conflicts: # alignment/alignment.cpp # alignment/alignment.h # tree/discordance.cpp # tree/phylokernelnew.h # tree/phylokernelnonrev.h # tree/phylosupertree.cpp # tree/phylosupertree.h # tree/phylotreesse.cpp # utils/tools.cpp
The ESR feature's Alignment::convertToBin()/SuperAlignment::convertToBin() compiled and merged cleanly but relied on pre-refactor APIs and an incomplete metadata copy: - addPattern(pat, site) / countConstSite() no longer exist on master; addPattern() now appends to site_pattern internally instead of writing by index, and countConstSites() (plural) replaces countConstSite(). - convertToBin()'s metadata copy was missing char_partition/tree_len and used a manual seq_names loop instead of direct assignment, unlike the established initAlignmentCopy() convention used by convertToCodonOrAA/convertCodonToAA/convertCodonToDNA. - SuperAlignment::convertToBin() crashed (SIGABRT) on any partition model under -gap-asr/-gap-esr: it called the (now pattern-populating) Alignment::convertToBin() on the destination SuperAlignment, then SuperAlignment::buildPattern() (via init()) asserted the pattern list was still empty before building its own unrelated partition-presence pattern. Clear the leftover patterns before init(), matching the never-pre-populate convention used by SuperAlignment::extractSubAlignment(). - runPhyloAnalysisAfterReadingAln() referenced an undeclared model_info; thread it through from the caller as an optional parameter, matching the ModelCheckpoint plumbing already present on runPhyloAnalysis(). Verified with a 9-alignment x 4-feature x 2-binary comparison (DNA/AA/codon, standard/mixture/partition models, -asr/-gap-asr/-esr/-gap-esr) against a nhan_esr baseline build: all 72 cases now pass with matching reconstructed states and log-likelihoods. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…der on binary data when reconstructing gapped-ASR/ESR
…conducting -gap-asr/esr
…d_seq_reconstruction
…hem after that run is done
…afe numeric scaling (rare cases)
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.
Summary
-esr / --extant: marginal extant (tip) sequence reconstruction — the leaf-node analogue of -asr. Each tip's own data is masked and its states are predicted from the rest of the tree.
-gap-asr / --gap-ancestral and -gap-esr / --gap-extant: adds a gap/non-gap posterior (p_gap) alongside the character-state reconstruction. The alignment is recoded as binary presence/absence, a second fixed-topology analysis runs on that binary data, and the two posteriors are merged in the output.
🤖 Generated with Claude Code