alphapulldown-input-parser 0.2.0__tar.gz → 0.3.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.
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/PKG-INFO +1 -1
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/pyproject.toml +1 -1
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser/parser.py +32 -4
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser.egg-info/PKG-INFO +1 -1
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/test/test_parser.py +26 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/LICENSE +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/README.md +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/setup.cfg +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser/__init__.py +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser.egg-info/SOURCES.txt +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser.egg-info/dependency_links.txt +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser.egg-info/requires.txt +0 -0
- {alphapulldown_input_parser-0.2.0 → alphapulldown_input_parser-0.3.0}/src/alphapulldown_input_parser.egg-info/top_level.txt +0 -0
|
@@ -309,20 +309,48 @@ def expand_fold_specification(
|
|
|
309
309
|
if not pf:
|
|
310
310
|
continue
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
tokens = [token.strip() for token in pf.split(":")]
|
|
313
|
+
base_token = tokens[0] if tokens else ""
|
|
314
|
+
|
|
315
|
+
# JSON inputs: support optional copy number, but no ranges.
|
|
316
|
+
if base_token.endswith(".json"):
|
|
317
|
+
path_pf = Path(base_token)
|
|
314
318
|
json_path: Optional[str] = None
|
|
315
319
|
for json_key in (path_pf.name, path_pf.stem):
|
|
316
320
|
json_path = index.json_path(json_key)
|
|
317
321
|
if json_path:
|
|
318
|
-
|
|
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
|
+
)
|
|
345
|
+
|
|
346
|
+
for _ in range(copies):
|
|
347
|
+
formatted_folds.append({"json_input": json_path})
|
|
319
348
|
break
|
|
320
349
|
if json_path:
|
|
321
350
|
continue
|
|
322
351
|
missing_features.append(path_pf.name)
|
|
323
352
|
continue
|
|
324
353
|
|
|
325
|
-
tokens = [token.strip() for token in pf.split(":")]
|
|
326
354
|
if not tokens or not tokens[0]:
|
|
327
355
|
_format_error(spec, msg="Protein token is empty.")
|
|
328
356
|
|
|
@@ -211,6 +211,32 @@ 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
|
+
None,
|
|
236
|
+
FormatError,
|
|
237
|
+
None,
|
|
238
|
+
id="json_with_range_not_supported",
|
|
239
|
+
),
|
|
214
240
|
],
|
|
215
241
|
)
|
|
216
242
|
def test_parse_fold(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|