alphapulldown-input-parser 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (13) hide show
  1. {alphapulldown_input_parser-0.3.0/src/alphapulldown_input_parser.egg-info → alphapulldown_input_parser-0.4.0}/PKG-INFO +16 -2
  2. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/README.md +15 -1
  3. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/pyproject.toml +1 -1
  4. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser/parser.py +9 -26
  5. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0/src/alphapulldown_input_parser.egg-info}/PKG-INFO +16 -2
  6. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/test/test_parser.py +32 -2
  7. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/LICENSE +0 -0
  8. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/setup.cfg +0 -0
  9. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser/__init__.py +0 -0
  10. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/SOURCES.txt +0 -0
  11. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/dependency_links.txt +0 -0
  12. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/requires.txt +0 -0
  13. {alphapulldown_input_parser-0.3.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alphapulldown-input-parser
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Fold specification parser for AlphaPulldown
5
5
  Author-email: Kosinski Lab <alphapulldown@embl-hamburg.de>
6
6
  License: MIT
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
  Reusable parser for AlphaPulldown-style fold specifications. Install it with:
31
31
 
32
32
  ```bash
33
- pip install alphapulldown-input-parser
33
+ pip install "alphapulldown-input-parser>=0.4.0"
34
34
  ```
35
35
 
36
36
  or, for local development:
@@ -48,3 +48,17 @@ The package exposes two helpers:
48
48
 
49
49
  The parser is dependency-free and works across AlphaPulldown, the Snakemake
50
50
  pipeline, or any other tooling that consumes the same fold syntax.
51
+
52
+ As of `0.4.0`, AF3 JSON feature files support the same copy/range suffixes as
53
+ classic AlphaPulldown feature pickles. For example:
54
+
55
+ ```python
56
+ parse_fold(
57
+ ["P01258_af3_input.json:1-100:2"],
58
+ features_directory=["/path/to/features"],
59
+ protein_delimiter="+",
60
+ )
61
+ ```
62
+
63
+ This expands to two folding entries for the same AF3 JSON feature file, each
64
+ restricted to residues `1-100`.
@@ -3,7 +3,7 @@
3
3
  Reusable parser for AlphaPulldown-style fold specifications. Install it with:
4
4
 
5
5
  ```bash
6
- pip install alphapulldown-input-parser
6
+ pip install "alphapulldown-input-parser>=0.4.0"
7
7
  ```
8
8
 
9
9
  or, for local development:
@@ -21,3 +21,17 @@ The package exposes two helpers:
21
21
 
22
22
  The parser is dependency-free and works across AlphaPulldown, the Snakemake
23
23
  pipeline, or any other tooling that consumes the same fold syntax.
24
+
25
+ As of `0.4.0`, AF3 JSON feature files support the same copy/range suffixes as
26
+ classic AlphaPulldown feature pickles. For example:
27
+
28
+ ```python
29
+ parse_fold(
30
+ ["P01258_af3_input.json:1-100:2"],
31
+ features_directory=["/path/to/features"],
32
+ protein_delimiter="+",
33
+ )
34
+ ```
35
+
36
+ This expands to two folding entries for the same AF3 JSON feature file, each
37
+ restricted to residues `1-100`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alphapulldown-input-parser"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "Fold specification parser for AlphaPulldown"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -72,7 +72,8 @@ class RegionSelection:
72
72
  return cls(regions=None)
73
73
 
74
74
 
75
- # Either {"json_input": "/path/to.json"} or {"CHAIN_A": RegionSelection(...)}
75
+ # Either {"json_input": "/path/to.json", "regions": RegionSelection(...)?}
76
+ # or {"CHAIN_A": RegionSelection(...)}
76
77
  FoldEntry = Dict[str, Union[str, RegionSelection]]
77
78
 
78
79
 
@@ -312,39 +313,21 @@ def expand_fold_specification(
312
313
  tokens = [token.strip() for token in pf.split(":")]
313
314
  base_token = tokens[0] if tokens else ""
314
315
 
315
- # JSON inputs: support optional copy number, but no ranges.
316
+ # JSON inputs: support optional copy number and region ranges.
316
317
  if base_token.endswith(".json"):
317
318
  path_pf = Path(base_token)
318
319
  json_path: Optional[str] = None
319
320
  for json_key in (path_pf.name, path_pf.stem):
320
321
  json_path = index.json_path(json_key)
321
322
  if json_path:
322
- # Handle optional copy number for JSON inputs.
323
- if len(tokens) == 1:
324
- copies = 1
325
- else:
326
- extra_tokens = tokens[1:]
327
- # Ranges (e.g. "1-10") are not supported for JSON feature files.
328
- if any("-" in tok for tok in extra_tokens):
329
- _format_error(
330
- spec,
331
- msg="Region ranges are not supported for JSON feature files.",
332
- )
333
- if len(extra_tokens) != 1:
334
- _format_error(
335
- spec,
336
- msg="JSON feature files support only an optional copy number.",
337
- )
338
- try:
339
- copies = int(extra_tokens[0])
340
- except ValueError:
341
- _format_error(
342
- spec,
343
- msg="Copy number for JSON feature file must be an integer.",
344
- )
323
+ copies, region_tokens = _extract_copy_and_regions(tokens, spec)
324
+ regions = _parse_regions(region_tokens, spec)
345
325
 
346
326
  for _ in range(copies):
347
- formatted_folds.append({"json_input": json_path})
327
+ json_entry: FoldEntry = {"json_input": json_path}
328
+ if not regions.is_all:
329
+ json_entry["regions"] = regions
330
+ formatted_folds.append(json_entry)
348
331
  break
349
332
  if json_path:
350
333
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alphapulldown-input-parser
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Fold specification parser for AlphaPulldown
5
5
  Author-email: Kosinski Lab <alphapulldown@embl-hamburg.de>
6
6
  License: MIT
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
  Reusable parser for AlphaPulldown-style fold specifications. Install it with:
31
31
 
32
32
  ```bash
33
- pip install alphapulldown-input-parser
33
+ pip install "alphapulldown-input-parser>=0.4.0"
34
34
  ```
35
35
 
36
36
  or, for local development:
@@ -48,3 +48,17 @@ The package exposes two helpers:
48
48
 
49
49
  The parser is dependency-free and works across AlphaPulldown, the Snakemake
50
50
  pipeline, or any other tooling that consumes the same fold syntax.
51
+
52
+ As of `0.4.0`, AF3 JSON feature files support the same copy/range suffixes as
53
+ classic AlphaPulldown feature pickles. For example:
54
+
55
+ ```python
56
+ parse_fold(
57
+ ["P01258_af3_input.json:1-100:2"],
58
+ features_directory=["/path/to/features"],
59
+ protein_delimiter="+",
60
+ )
61
+ ```
62
+
63
+ This expands to two folding entries for the same AF3 JSON feature file, each
64
+ restricted to residues `1-100`.
@@ -232,10 +232,40 @@ def patch_feature_index(monkeypatch):
232
232
  ["dir1"],
233
233
  "+",
234
234
  {"pkl": {}, "json": {"protein1.json": "dir1/protein1.json"}},
235
+ [[{"json_input": "dir1/protein1.json", "regions": selection_ranges((1, 10))}]],
236
+ None,
237
+ None,
238
+ id="json_with_range",
239
+ ),
240
+ pytest.param(
241
+ ["protein1.json:2:1-10:20-30"],
242
+ ["dir1"],
243
+ "+",
244
+ {"pkl": {}, "json": {"protein1.json": "dir1/protein1.json"}},
245
+ [
246
+ [
247
+ {"json_input": "dir1/protein1.json", "regions": selection_ranges((1, 10), (20, 30))},
248
+ {"json_input": "dir1/protein1.json", "regions": selection_ranges((1, 10), (20, 30))},
249
+ ]
250
+ ],
251
+ None,
252
+ None,
253
+ id="json_with_copy_and_regions",
254
+ ),
255
+ pytest.param(
256
+ ["protein1.json:1-10:20-30:2"],
257
+ ["dir1"],
258
+ "+",
259
+ {"pkl": {}, "json": {"protein1.json": "dir1/protein1.json"}},
260
+ [
261
+ [
262
+ {"json_input": "dir1/protein1.json", "regions": selection_ranges((1, 10), (20, 30))},
263
+ {"json_input": "dir1/protein1.json", "regions": selection_ranges((1, 10), (20, 30))},
264
+ ]
265
+ ],
235
266
  None,
236
- FormatError,
237
267
  None,
238
- id="json_with_range_not_supported",
268
+ id="json_with_regions_and_copy",
239
269
  ),
240
270
  ],
241
271
  )