Skip to content

Add extant sequence reconstruction (-esr) and gap-aware ASR/ESR (-gap-asr, -gap-esr) - #223

Open
trongnhanuit wants to merge 60 commits into
iqtree:masterfrom
trongnhanuit:gap_asr_esr
Open

trongnhanuit wants to merge 60 commits into
iqtree:masterfrom
trongnhanuit:gap_asr_esr

Conversation

@trongnhanuit

Copy link
Copy Markdown
Member

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

…eversible implementations of computeLikelihoodBranch
…ase: given a treefile and a single alignment
trongnhanuit and others added 30 commits September 18, 2026 09:31
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant