Skip to content

Take the taxonomy ID from the source's taxon db_xref - #1174

Open
josemduarte wants to merge 2 commits into
biojava:masterfrom
josemduarte:jd/issue-617
Open

josemduarte wants to merge 2 commits into
biojava:masterfrom
josemduarte:jd/issue-617

Conversation

@josemduarte

Copy link
Copy Markdown
Contributor

Fixes #617.

Problem

The taxonomy ID was taken from the wrong db_xref:

  • AbstractSequence (proxy readers) used the first db_xref of the source feature. When the source lists another reference first, e.g. a culture collection (ATCC:700721 before taxon:272620), that became the taxonomy ID.
  • GenbankReader used GenbankSequenceParser.getDatabaseReferences(), which is overwritten on every db_xref and so holds only the last one in the file. For 152970917.gb that is a CDS GeneID:5340071.

Change

Both now take the db_xref whose database is taxon from the source feature, and set no taxonomy if there is none. getDatabaseReferences() itself is unchanged.

Testing

  • First commit adds the failing tests, using the existing fixture 152970917.gb: a new GenbankReaderTest.testTaxonomyFromTaxonDbXref, and GenbankProxySequenceReaderTest now requires the ID to start with taxon: (it used to check only that the part after the colon is a number, which ATCC:700721 happened to pass).
  • All 533 biojava-core tests pass.

🤖 Generated with Claude Code

josemduarte and others added 2 commits December 4, 2026 19:10
)

152970917.gb lists db_xref "ATCC:700721" before "taxon:272620" in its
source feature. The proxy reader takes the first db_xref (ATCC:700721),
and GenbankReader takes the last db_xref of the whole file (a CDS
GeneID), so neither gives the taxon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbstractSequence used the first db_xref of the source feature, which can
be a culture collection. GenbankReader used the parser's database
references, which keep only the last db_xref of the file. Both now look
for the db_xref whose database is "taxon" in the source feature, and set
no taxonomy if there is none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

AbstractSequence not always getting correct taxonomy ID

1 participant