Input Module¶
This module handles typed options and molecular-system input processing.
Typed Runner Options¶
config
¶
Strict, source-aware loading for runner options YAML.
InputValidationError
¶
Bases: ValueError
Base class for actionable errors raised before backend execution.
Source code in src/cofolder/modules/input/config.py
System¶
system
¶
System configuration management for Boltz predictions.
This module provides the System class for managing molecular system configurations, including proteins, ligands, and their properties.
SystemChain
dataclass
¶
One expanded chain from a system sequence entry.
Source code in src/cofolder/modules/input/system.py
System
¶
Manage molecular system configuration for Boltz predictions.
The System class provides methods to load, update, query, and save molecular system definitions from dictionaries or YAML files. System configurations typically define proteins, ligands, MSAs, and other molecular components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
dict
|
Pre-loaded system dictionary containing molecular definitions. |
None
|
system_path
|
str
|
Path to YAML file to load the system configuration from. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both system and system_path are provided, or if neither is provided. |
Examples:
>>> # Load from dictionary
>>> system_dict = {"sequences": [{"protein": {"id": "A"}}]}
>>> sys = System(system=system_dict)
Source code in src/cofolder/modules/input/system.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
update_system
¶
Update system configuration at a specific path or key.
Modifies the system dictionary either by navigating a specific path through nested structures, or by searching for a parent key and optionally a sub-key within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
any
|
The value to set at the specified location. |
required |
path
|
list
|
Path to the target location as a list of keys/indices. Example: ["sequences", 0, "protein", "fasta"] |
None
|
parent_key
|
str
|
Top-level or nested key to search for and update. |
None
|
sub_key
|
str
|
Sub-key within the parent_key dictionary to update. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the path traversal fails due to type mismatch. |
KeyError
|
If the parent_key is not found in the system. |
Notes
Either path or parent_key must be provided, but not both. The path parameter creates nested structures if they don't exist.
Source code in src/cofolder/modules/input/system.py
delete_system_key
¶
Delete specific keys from the system configuration at a given path or key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
list
|
Path to the target dictionary/list as a list of keys/indices. Example: ["sequences", 0, "ligand"] |
None
|
parent_key
|
str
|
Top-level or nested key to search for and delete keys in. |
None
|
sub_key
|
str
|
Sub-key within the parent_key dictionary to target. |
None
|
keys_to_delete
|
list of str
|
List of keys to delete from the target dictionary. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If path traversal fails due to type mismatch. |
KeyError
|
If parent_key is not found in the system. |
Source code in src/cofolder/modules/input/system.py
find_value
¶
Retrieve a value by path or by recursively searching for a key.
Supports two modes of retrieval: direct path navigation or recursive key search throughout the nested structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Key name to search for recursively throughout the system. |
None
|
path
|
list
|
Specific path to the value as a list of keys/indices. |
None
|
Returns:
| Type | Description |
|---|---|
any or None
|
The value found at the specified location, or None if not found. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If path navigation fails or if the key appears multiple times. |
Examples:
Notes
When using key search, if the key appears multiple times in the system, a ValueError is raised. Use path instead for disambiguation.
Source code in src/cofolder/modules/input/system.py
iter_system_chains
¶
Yield chains in backend order, expanding list-valued id fields.