Skip to content

Commit 712c278

Browse files
committed
Fix custom residues in config (#229)
* Fix specifying custom residues * Update changelog
1 parent 4aafa73 commit 712c278

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2424
### Fixed
2525

2626
- Correctly refer to input peak files by their full file path.
27+
- Specifying custom residues to retrain Casanovo is now possible.
2728

2829
## [3.3.0] - 2023-04-04
2930

casanovo/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Config:
5050
dropout=float,
5151
dim_intensity=int,
5252
max_length=int,
53+
residues=dict,
5354
n_log=int,
5455
tb_summarywriter=str,
5556
warmup_iters=int,

tests/unit_tests/test_config.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""Test configuration loading"""
2-
import pytest
3-
42
from casanovo.config import Config
53

64

@@ -17,11 +15,23 @@ def test_override(tmp_path):
1715
"""Test overriding the default"""
1816
yml = tmp_path / "test.yml"
1917
with yml.open("w+") as f_out:
20-
f_out.write("random_seed: 42\ntop_match: 3")
18+
f_out.write(
19+
"""random_seed: 42
20+
top_match: 3
21+
residues:
22+
W: 1
23+
O: 2
24+
U: 3
25+
T: 4
26+
"""
27+
)
2128

2229
config = Config(yml)
2330
assert config.random_seed == 42
2431
assert config["random_seed"] == 42
2532
assert not config.no_gpu
2633
assert config.top_match == 3
34+
assert len(config.residues) == 4
35+
for i, residue in enumerate("WOUT", 1):
36+
assert config["residues"][residue] == i
2737
assert config.file == str(yml)

0 commit comments

Comments
 (0)