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.
This pull request refactors the way assembly accession-based paths are generated and used within the ensembl-metadata-api codebase.
Key Changes:
Introduced format_accession_path Utility:
Added a new function, format_accession_path, in src/ensembl/production/metadata/api/factories/utils.py.
This function takes an assembly accession (e.g., GCF_043381705.1) and converts it to a standardized path format (e.g., GCF/043/381/705/1).
It validates the accession format and raises errors for invalid formats.
Refactored Path Construction in Adaptors:
Updated genome.py and vep.py adaptors to use format_accession_path for path handling.
Replaced previous logic that constructed paths using the scientific name and accession, resulting in more consistent and structured paths.
Paths that previously looked like Saccharomyces_cerevisiae_S288c/GCA_000146045.2/... now look like GCA/000/146/045/2/....
Updated Tests:
Introduced new tests for the path generation to cover previous releases.
Updated existing tests to work with the change in expected data.
Updated ensembl_release.label data to match current standard and all associated tests
Adjusted tests in test_utils.py to match the new path format.
Added unit tests to validate the new format_accession_path utility, including tests for valid, invalid, and edge case inputs.