55from __future__ import annotations
66
77import hashlib
8- from dataclasses import dataclass , field
8+ from dataclasses import dataclass
99from pathlib import Path
10- from typing import Optional , Union
1110
1211import yaml
1312
1413
1514@dataclass
1615class ChainConfig :
1716 """Configuration for a single target chain."""
18- crop : Optional [list [str ]] = None
19- hotspots : Optional [list [int ]] = None
20- msa : Optional [Path ] = None
17+
18+ crop : list [str ] | None = None
19+ hotspots : list [int ] | None = None
20+ msa : Path | None = None
2121
2222
2323@dataclass
2424class PXDesignTargetConfig :
2525 """Target structure configuration."""
26+
2627 file : Path
27- chains : dict [str , Union [ ChainConfig , str ] ]
28+ chains : dict [str , ChainConfig | str ]
2829
2930 def __post_init__ (self ):
3031 if not Path (self .file ).exists ():
@@ -37,6 +38,7 @@ class PXDesignConfig:
3738 Complete PXDesign run configuration.
3839 Generates a YAML file that pxdesign CLI consumes.
3940 """
41+
4042 target : PXDesignTargetConfig
4143 binder_length : int
4244 n_samples : int = 1000
@@ -48,7 +50,7 @@ class PXDesignConfig:
4850 # BindMaster-specific (not written to YAML)
4951 gpu_device : int = 0
5052 conda_env : str = "bindmaster_pxdesign"
51- task_name : Optional [ str ] = None
53+ task_name : str | None = None
5254
5355 def get_task_name (self ) -> str :
5456 if self .task_name :
@@ -75,7 +77,7 @@ def to_yaml(self, output_path: Path) -> Path:
7577 "target" : {
7678 "file" : str (self .target .file ),
7779 "chains" : {},
78- }
80+ },
7981 }
8082
8183 for chain_id , chain_cfg in self .target .chains .items ():
@@ -99,9 +101,12 @@ def to_yaml(self, output_path: Path) -> Path:
99101 def to_cli_args (self ) -> list [str ]:
100102 """Generate the `pxdesign pipeline` CLI argument list."""
101103 args = [
102- "--preset" , self .preset ,
103- "--N_sample" , str (self .n_samples ),
104- "--dtype" , self .dtype ,
104+ "--preset" ,
105+ self .preset ,
106+ "--N_sample" ,
107+ str (self .n_samples ),
108+ "--dtype" ,
109+ self .dtype ,
105110 ]
106111 if self .use_fast_ln :
107112 args += ["--use_fast_ln" , "True" ]
0 commit comments