You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace intersect()'s eight mutually-exclusive booleans with a single mode parameter #238
intersect() in tests/integration/bedtools/utils/bedtools_wrapper.py takes eight mutually-exclusive booleans (loj, inverse, write_both, count, write_overlap, write_all_overlap, clip, reciprocal) and resolves them through two parallel if/elif chains — one picking the bedtools flags, a second picking the bed_format passed to bedtool_to_tuples:
Three problems follow from the shape rather than from any single branch. The exclusivity is encoded only in the elif ordering, so intersect(a, b, clip=True, reciprocal=True) silently honours one and drops the other — no caller does that today, which is exactly why it would go unnoticed. The two chains must stay in agreement by hand, and they already disagree in structure (write_both sets two flags but shares loj's output format). And each new bedtools mode costs a branch in both chains plus a parameter in the signature.
Suggested shape. One mode parameter over the named bedtools output modes, resolved through a single mapping from mode to (flags, bed_format). That collapses both chains, makes the exclusivity structural instead of positional, and reduces adding a mode to adding a row.
Raised as A7 in the round-1 review of #235 (.sdlc/reviews/issue-#109/review-1.md), where all five python reviewers flagged the chain. #235 took the in-scope half — it removed an empty elif clip: pass branch and the reciprocal shadowing it introduced, and corrected the clip docstring — and Style Guide §1 requires a refactor of this size be surfaced as a proposal rather than folded into an unrelated change, hence this issue.
Activity