Skip to content

Commit

Permalink
Fix custom residues in config (#229)
Browse files Browse the repository at this point in the history
* Fix specifying custom residues

* Update changelog
  • Loading branch information
bittremieux committed Aug 16, 2023
1 parent 4aafa73 commit 712c278
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Fixed

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

## [3.3.0] - 2023-04-04

Expand Down
1 change: 1 addition & 0 deletions casanovo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Config:
dropout=float,
dim_intensity=int,
max_length=int,
residues=dict,
n_log=int,
tb_summarywriter=str,
warmup_iters=int,
Expand Down
16 changes: 13 additions & 3 deletions tests/unit_tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Test configuration loading"""
import pytest

from casanovo.config import Config


Expand All @@ -17,11 +15,23 @@ def test_override(tmp_path):
"""Test overriding the default"""
yml = tmp_path / "test.yml"
with yml.open("w+") as f_out:
f_out.write("random_seed: 42\ntop_match: 3")
f_out.write(
"""random_seed: 42
top_match: 3
residues:
W: 1
O: 2
U: 3
T: 4
"""
)

config = Config(yml)
assert config.random_seed == 42
assert config["random_seed"] == 42
assert not config.no_gpu
assert config.top_match == 3
assert len(config.residues) == 4
for i, residue in enumerate("WOUT", 1):
assert config["residues"][residue] == i
assert config.file == str(yml)

0 comments on commit 712c278

Please sign in to comment.