Skip to content

Commit 5770253

Browse files
munkyukim86claude
andcommitted
fix: GC% 파라미터 현실화 — GC_OPT_MID 42.5→60.0 (analysis 004)
벤치마크(n=49) 결과 balanced profile 출력 GC% 평균 60.1%. N. benthamiana 고발현 코돈 테이블의 3rd-position GC bias가 원인. 게놈 평균(42.5%) 대신 실제 출력 범위(55-65%)로 파라미터 현실화. - scoring.py: GC_OPT_MIN/MAX/MID 41/44/42.5 → 55/65/60 - cli/main.py: --gc-min/--gc-max default 40/55 → 55/65 - reverse_translator.py: balanced docstring 45-55% → 55-65% - test_scoring.py: GC 기준값 42.5→60.0 업데이트 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c912385 commit 5770253

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎src/factorforge/cli/main.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def list_engines():
113113
type=click.Choice(["feasibility_best", "gc_target", "high_cai"], case_sensitive=False),
114114
help="DP objective",
115115
)
116-
@click.option("--gc-min", type=float, default=40.0, help="Minimum target GC percentage")
117-
@click.option("--gc-max", type=float, default=55.0, help="Maximum target GC percentage")
116+
@click.option("--gc-min", type=float, default=55.0, help="Minimum target GC percentage")
117+
@click.option("--gc-max", type=float, default=65.0, help="Maximum target GC percentage")
118118
@click.option("--template", "construct_template", help="Construct template name")
119119
@click.option("--output", "-o", help="Output file")
120120
@click.option("--format", "output_format", default="fasta", help="Output format (fasta, genbank)")

‎src/factorforge/engines/v2/rules/reverse_translator.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ def _balanced_translate(self, protein_seq: str, **kwargs: Any) -> str:
370370
Balanced profile: CAI first, GC balanced
371371
372372
- Preferred codon ratio: 70%
373-
- Target GC: 45-55%
373+
- Target GC: 55-65% (benchmark analysis 004: avg output 60.1%)
374374
"""
375-
target_gc_min = kwargs.get("target_gc_min", 45)
376-
target_gc_max = kwargs.get("target_gc_max", 55)
375+
target_gc_min = kwargs.get("target_gc_min", 55)
376+
target_gc_max = kwargs.get("target_gc_max", 65)
377377
preferred_ratio = kwargs.get("preferred_ratio", 0.7)
378378
max_attempts = kwargs.get("max_gc_attempts", 10)
379379
if max_attempts < 1:

‎src/factorforge/engines/v2/scoring.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111

1212
logger = logging.getLogger(__name__)
1313

14-
# Optimal GC range for N. benthamiana
15-
GC_OPT_MIN = 41.0
16-
GC_OPT_MAX = 44.0
17-
GC_OPT_MID = 42.5
14+
# Optimal GC range for N. benthamiana codon-optimized sequences.
15+
# Benchmark (analysis 004, n=49): balanced profile output average GC% = 60.1%
16+
# (range 55-71%). The genome-wide average (~42%) reflects all genes, not the
17+
# high-expression codon table which exhibits 3rd-position GC bias.
18+
GC_OPT_MIN = 55.0
19+
GC_OPT_MAX = 65.0
20+
GC_OPT_MID = 60.0
1821

1922
# ViennaRNA availability cache
2023
_vienna_available: bool | None = None

‎tests/engines/v2/test_scoring.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TestCompositeScore:
4444

4545
def test_perfect_cai_perfect_gc(self):
4646
"""Perfect CAI and optimal GC should produce a high score."""
47-
score = calculate_composite_score(cai=1.0, gc=42.5, profile="balanced")
47+
score = calculate_composite_score(cai=1.0, gc=60.0, profile="balanced")
4848
assert score > 0.9
4949

5050
def test_zero_cai(self):
@@ -60,10 +60,10 @@ def test_gc_far_from_optimum(self):
6060

6161
def test_high_cai_profile_weights(self):
6262
"""High-CAI profile weights CAI more heavily."""
63-
# Same inputs, different profiles
64-
score_hcai = calculate_composite_score(cai=0.95, gc=60.0, profile="high_cai")
65-
score_gc = calculate_composite_score(cai=0.95, gc=60.0, profile="gc_target")
66-
# High-CAI should be higher because it weights CAI at 0.8
63+
# Use GC off-optimal so gc_target (w_gc=0.7) is penalized more than high_cai (w_gc=0.1)
64+
score_hcai = calculate_composite_score(cai=0.95, gc=42.5, profile="high_cai")
65+
score_gc = calculate_composite_score(cai=0.95, gc=42.5, profile="gc_target")
66+
# High-CAI should be higher because it weights CAI at 0.8 vs gc_target's 0.1
6767
assert score_hcai > score_gc
6868

6969
def test_gc_target_profile_custom_gc(self):

0 commit comments

Comments
 (0)