biopython / biopython/biopython

Add ambiguous=... argument to GC() and GC123() for consistency with gc_fraction()

Open
#5,307 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5.2k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
11

Description

Follow-up from the discussion on #1719 (comment: https://github.com/biopython/biopython/issues/1719#issuecomment-5571560702).

gc_fraction() already supports an ambiguous argument with three modes (remove, ignore, weighted) for handling ambiguous nucleotides when computing GC content. GC() and GC123() don't have an equivalent option, which makes their behavior inconsistent with the newer function.

Proposed change: add an ambiguous=... argument to GC() and GC123(), following the same convention and semantics already used in gc_fraction(). The default value would preserve each function's current behavior, so this would be backward compatible for existing callers.

I'd like to work on this. Before starting, I wanted to confirm the intended default: should it match gc_fraction()'s default ("remove"), or should it default to whatever GC()/GC123() currently do internally, to guarantee no change in behavior for anyone not passing the argument?

Contributor guide

Open the contributing guide

Research direction

Start by locating the GC(), GC123(), and gc_fraction() entry points and compare how each handles ambiguous nucleotides. Confirm the existing behavior and the three supported modes, then resolve which default preserves current GC() and GC123() results. Done means both functions accept the argument with matching semantics while existing callers remain backward compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.