Skip to content

Commit 829b62b

Browse files
mstoclaude
andcommitted
style: fix formatting and clean up sync note
Collapse the multi-line `assert (... is True)` in the custom-delimiter test per ruff format, which had broken CI. Move the "keep signatures in sync with extract_umis_from_read_name" note out of the user-facing docstring and into an inline comment. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 28a7e67 commit 829b62b

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

fgpyo/platform/illumina.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,15 @@ def copy_umi_from_read_name(
100100
101101
`strict`, `read_name_delimiter`, and `umi_delimiter` are forwarded to
102102
[`extract_umis_from_read_name`][fgpyo.platform.illumina.extract_umis_from_read_name] — see
103-
that function for their semantics. If you change the signature of either function, update
104-
the other to keep them in sync.
103+
that function for their semantics.
105104
106105
Args:
107106
rec: The alignment record to update.
108107
strict: If `True` and UMI invalid, will throw an exception.
109-
Forwarded to `extract_umis_from_read_name`.
110108
remove_umi: If `True`, the UMI will be removed from the read name after copying.
111109
read_name_delimiter: The delimiter separating the components of the read name.
112-
Forwarded to `extract_umis_from_read_name`, and also used to strip the UMI
113-
segment when `remove_umi` is `True`.
110+
Also used to strip the UMI segment when `remove_umi` is `True`.
114111
umi_delimiter: The delimiter separating multiple UMIs.
115-
Forwarded to `extract_umis_from_read_name`.
116112
117113
Returns:
118114
`True` if the UMI was successfully extracted, False if otherwise.
@@ -121,6 +117,7 @@ def copy_umi_from_read_name(
121117
ValueError: If the read name does not end with a valid UMI.
122118
ValueError: If the record already has a populated `RX` SAM tag.
123119
"""
120+
# NB: Keep the signature of this function in sync with `extract_umis_from_read_name`.
124121
assert rec.query_name is not None, "Alignment record must have a query name"
125122

126123
umi = extract_umis_from_read_name(

tests/fgpyo/platform/test_illumina.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ def test_copy_umi_from_read_name_custom_read_name_delimiter() -> None:
153153
"""Test that a custom read_name_delimiter is used for both extraction and UMI removal."""
154154
builder = SamBuilder()
155155
read = builder.add_single(name="abc_def_ghi_AAAA+TTTT")
156-
assert (
157-
copy_umi_from_read_name(read, remove_umi=True, read_name_delimiter="_") is True
158-
)
156+
assert copy_umi_from_read_name(read, remove_umi=True, read_name_delimiter="_") is True
159157
assert read.get_tag("RX") == "AAAA-TTTT"
160158
assert read.query_name == "abc_def_ghi"
161159

0 commit comments

Comments
 (0)