Skip to content

Commit 20f1856

Browse files
committed
Add clarification comments to soft clip anchor checking
Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
1 parent ec998c3 commit 20f1856

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/alignment.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ function check_alignment_anchors(anchors)
219219
end
220220
end
221221

222-
# Check if a soft clip has anything but hard clips and start anchors between them and
223-
# the end of the alignment
222+
# Soft clips must be at either end of the alignment, or alternatively can have hard
223+
# clips between them and the ends of the alignment. Check to make sure this is true.
224224
for i in 3:lastindex(anchors)
225225
if anchors[i].op == OP_SOFT_CLIP
226226
# Check if this is the last operation, which is valid
@@ -242,8 +242,8 @@ function check_alignment_anchors(anchors)
242242
prev_valid = prev_valid && (anchor.op == OP_START || anchor.op == OP_HARD_CLIP)
243243
end
244244

245-
# Check for invalid operations
246-
if !(next_valid || prev_valid)
245+
# Check if this soft clip is a valid starting clip or a valid ending clip
246+
if !(next_valid || prev_valid) # Alternatively: !next_valid && !prev_valid
247247
error("OP_SOFT_CLIP may only have OP_HARD_CLIP operations between it and the ends of the alignment")
248248
end
249249
end

0 commit comments

Comments
 (0)