Skip to content

Reuse clean_taxon_name in metatraits_gtdb CURIE construction#576

Merged
realmarcin merged 1 commit into
masterfrom
chore/metatraits-gtdb-reuse-clean-taxon-name
Jun 16, 2026
Merged

Reuse clean_taxon_name in metatraits_gtdb CURIE construction#576
realmarcin merged 1 commit into
masterfrom
chore/metatraits-gtdb-reuse-clean-taxon-name

Conversation

@realmarcin

Copy link
Copy Markdown
Collaborator

Summary

Tidy-up: metatraits_gtdb built its GTDB CURIEs with an inline .replace(" ", "_") at both construction sites, duplicating the canonical logic in gtdb/utils.clean_taxon_name. This imports and reuses clean_taxon_name so the two GTDB-emitting transforms (gtdb and metatraits_gtdb) can't drift if the canonical cleaner ever changes.

Change

  • Import clean_taxon_name in metatraits_gtdb.
  • Synthetic node id: search_name.replace(" ", "_")clean_taxon_name(search_name).
  • subClassOf target: current_species.replace(' ', '_')clean_taxon_name(current_species).

Behaviour-identicalclean_taxon_name is the same space→underscore replacement. The prefix-stripping lookup-map code (replace("s__", "")) is unrelated and left unchanged.

Verification

  • ruff + codespell clean.
  • tests/test_gtdb.py + tests/test_metatraits.py: 45 passed.
  • No circular import (gtdb/utils.py has no imports).

🤖 Generated with Claude Code

metatraits_gtdb built its GTDB CURIEs with an inline `.replace(" ", "_")`
at both construction sites (synthetic node id and subClassOf target),
duplicating the canonical logic in gtdb/utils.clean_taxon_name. Import and
reuse it so the two transforms cannot drift if the canonical cleaner ever
changes. Behaviour is identical (clean_taxon_name is the same space->
underscore replacement); the prefix-stripping lookup-map code is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@realmarcin realmarcin merged commit d3fc7c4 into master Jun 16, 2026
3 checks passed
@realmarcin realmarcin deleted the chore/metatraits-gtdb-reuse-clean-taxon-name branch June 16, 2026 06:34
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