Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue when replacing names of a GenomicRangesList #123

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/genomicranges/GenomicRangesList.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def set_names(
or as a reference to the (in-place-modified) original.
"""
if names is not None:
_validate_optional_attrs(None, names, len(self))
_validate_optional_attrs(self.get_mcols(), names, len(self))

if not isinstance(names, ut.Names):
names = ut.Names(names)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_grl_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,13 @@ def test_create_grl_should_fail():
def test_empty_grl():
grl = GenomicRangesList.empty(n=100)
assert isinstance(grl, GenomicRangesList)


def test_grl_set_names():
grl = GenomicRangesList(ranges=[a, b], names=["a", "b"])

grl_replace_names = grl.set_names(["aa", "bb"])

assert grl_replace_names is not None
assert isinstance(grl_replace_names, GenomicRangesList)
assert list(grl.get_names()) == ["a", "b"]
Loading