alphapulldown-input-parser 0.2.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.2.0/src/alphapulldown_input_parser.egg-info → alphapulldown_input_parser-0.4.0}/PKG-INFO +16 -2
  2. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/README.md +15 -1
  3. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/pyproject.toml +1 -1
  4. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser/parser.py +16 -5
  5. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0/src/alphapulldown_input_parser.egg-info}/PKG-INFO +16 -2
  6. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/test/test_parser.py +56 -0
  7. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/LICENSE +0 -0
  8. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/setup.cfg +0 -0
  9. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser/__init__.py +0 -0
  10. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/SOURCES.txt +0 -0
  11. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/dependency_links.txt +0 -0
  12. {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.4.0}/src/alphapulldown_input_parser.egg-info/requires.txt +0 -0
  13. {alphapulldown_input_parser-0.2.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.2.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.2.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
 
@@ -309,20 +310,30 @@ def expand_fold_specification(
309
310
  if not pf:
310
311
  continue
311
312
 
312
- if pf.endswith(".json"):
313
- path_pf = Path(pf)
313
+ tokens = [token.strip() for token in pf.split(":")]
314
+ base_token = tokens[0] if tokens else ""
315
+
316
+ # JSON inputs: support optional copy number and region ranges.
317
+ if base_token.endswith(".json"):
318
+ path_pf = Path(base_token)
314
319
  json_path: Optional[str] = None
315
320
  for json_key in (path_pf.name, path_pf.stem):
316
321
  json_path = index.json_path(json_key)
317
322
  if json_path:
318
- formatted_folds.append({"json_input": json_path})
323
+ copies, region_tokens = _extract_copy_and_regions(tokens, spec)
324
+ regions = _parse_regions(region_tokens, spec)
325
+
326
+ for _ in range(copies):
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)
319
331
  break
320
332
  if json_path:
321
333
  continue
322
334
  missing_features.append(path_pf.name)
323
335
  continue
324
336
 
325
- tokens = [token.strip() for token in pf.split(":")]
326
337
  if not tokens or not tokens[0]:
327
338
  _format_error(spec, msg="Protein token is empty.")
328
339
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alphapulldown-input-parser
3
- Version: 0.2.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`.
@@ -211,6 +211,62 @@ def patch_feature_index(monkeypatch):
211
211
  None,
212
212
  id="json_in_multiple_dirs",
213
213
  ),
214
+ pytest.param(
215
+ ["protein1.json:3"],
216
+ ["dir1"],
217
+ "+",
218
+ {"pkl": {}, "json": {"protein1.json": "dir1/protein1.json"}},
219
+ [
220
+ [
221
+ {"json_input": "dir1/protein1.json"},
222
+ {"json_input": "dir1/protein1.json"},
223
+ {"json_input": "dir1/protein1.json"},
224
+ ]
225
+ ],
226
+ None,
227
+ None,
228
+ id="json_with_copy_number",
229
+ ),
230
+ pytest.param(
231
+ ["protein1.json:1-10"],
232
+ ["dir1"],
233
+ "+",
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
+ ],
266
+ None,
267
+ None,
268
+ id="json_with_regions_and_copy",
269
+ ),
214
270
  ],
215
271
  )
216
272
  def test_parse_fold(