feat(rename_labels_template): add rename_labels_template function and…#376
Merged
fangliu117 merged 1 commit intodevfrom Aug 3, 2025
Merged
feat(rename_labels_template): add rename_labels_template function and…#376fangliu117 merged 1 commit intodevfrom
fangliu117 merged 1 commit intodevfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new rename labels template functionality that allows renaming categorical labels in AnnData objects using a CSV mapping file. The implementation includes both the main template function and comprehensive unit tests.
- Adds a platform-agnostic rename labels template converted from NIDAP
- Implements CSV-based label mapping functionality with proper error handling
- Provides comprehensive unit tests covering I/O workflows, error validation, and function calls
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/spac/templates/rename_labels_template.py | Main template implementation with JSON parameter parsing, CSV mapping loading, and label renaming logic |
| tests/templates/test_rename_labels_template.py | Comprehensive unit tests including mock data generation, I/O workflows, error validation, and function call verification |
Comments suppressed due to low confidence (2)
src/spac/templates/rename_labels_template.py:70
- [nitpick] The variable name 'dict_list' is ambiguous. Consider renaming to 'mapping_records' to better describe that it contains records for label mapping.
dict_list = rename_list.to_dict('records')
tests/templates/test_rename_labels_template.py:130
- [nitpick] The function name 'side_effect_rename' is unclear. Consider renaming to 'mock_rename_implementation' to better indicate it's simulating the real rename function behavior.
def side_effect_rename(adata, src_annotation, dest_annotation,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
… unit tests