Skip to content

Apply NEXUS node labels to alignment rows - #3514

Merged
jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-nexus-alignment-labels
Nov 19, 2026
Merged

jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-nexus-alignment-labels

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

When as_nexus receives node_labels, the taxa block uses those names and the alignment matrix uses node IDs. DendroPy rejects a file produced this way because it cannot find the matrix labels in the taxa block. Build the sample labels once and use them in both sections. The tests parse the export with and without trees and compare the labels and bases.

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

rpinho added a commit to rpinho/tskit that referenced this pull request Nov 18, 2026

@jeromekelleher-bot jeromekelleher-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rpinho, this is a genuine bug: since node_labels was added to write_nexus in 1.0.3, using it together with alignments produces a NEXUS file whose MATRIX rows don't match the TAXLABELS, which readers like DendroPy reject. I've confirmed the new test fails on main and passes with this change, and the round-trip test via DendroPy is a nice way to check it.

A few small things before we merge:

  • Could you add :user:`rpinho` to the changelog entry, to match the other entries?
  • Please squash the two commits into one.
  • Please remove the Co-Authored-By: Claude ... and Claude-Session: ... lines from the commit message.

Otherwise LGTM.

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (b387b10) to head (84b1f5e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3514      +/-   ##
==========================================
- Coverage   91.72%   91.72%   -0.01%     
==========================================
  Files          37       37              
  Lines       30840    30839       -1     
  Branches     4922     4921       -1     
==========================================
- Hits        28287    28286       -1     
  Misses       2223     2223              
  Partials      330      330              
Flag Coverage Δ
C 82.32% <ø> (ø)
c-python 77.05% <ø> (ø)
python-tests 96.44% <100.00%> (-0.01%) ⬇️
python-tests-no-jit 33.26% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Python API 98.73% <100.00%> (-0.01%) ⬇️
Python C interface 91.21% <ø> (ø)
C library 91.27% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rpinho
rpinho force-pushed the fix-nexus-alignment-labels branch from f5baaf0 to 84b1f5e Compare November 19, 2026 13:21
@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I changed those.

@jeromekelleher
jeromekelleher added this pull request to the merge queue Nov 19, 2026
Merged via the queue into tskit-dev:main with commit c91ca20 Nov 19, 2026
17 checks passed
@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for looking into this.

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.

3 participants