czty commited on
Commit
6169243
·
verified ·
1 Parent(s): daf20b7

BioOcto code and data release (snapshot 2026-11-27, resumed)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Biomanus-V2/Experiment1/.sync_stage_group2/build_test_103_group2_cases.py +84 -0
  2. Biomanus-V2/Experiment1/.sync_stage_group2/test_smoke.py +260 -0
  3. Biomanus-V2/Experiment1/.sync_stage_group2/validators.py +223 -0
  4. Biomanus-V2/Experiment1/.sync_stage_group2/verify_test_103_group2_repeat.py +65 -0
  5. Biomanus-V2/Experiment1/.sync_stage_group3/build_test_103_group3_cases.py +115 -0
  6. Biomanus-V2/Experiment1/.sync_stage_group3/test_smoke.py +274 -0
  7. Biomanus-V2/Experiment1/.sync_stage_group3/validators.py +234 -0
  8. Biomanus-V2/Experiment1/.sync_stage_group3/verify_native_group_repeat.py +65 -0
  9. Biomanus-V2/Experiment1/.sync_stage_group5/build_test_103_group5_cases.py +88 -0
  10. Biomanus-V2/Experiment1/.sync_stage_group5/test_smoke.py +288 -0
  11. Biomanus-V2/Experiment1/.sync_stage_group5/validators.py +249 -0
  12. Biomanus-V2/Experiment1/.sync_stage_group6/build_test_103_group6_cases.py +78 -0
  13. Biomanus-V2/Experiment1/.sync_stage_group6/test_smoke.py +302 -0
  14. Biomanus-V2/Experiment1/.sync_stage_group6/validators.py +260 -0
  15. Biomanus-V2/Experiment1/CURATION_GUIDE.md +13 -0
  16. Biomanus-V2/Experiment1/DATASET_CARD.md +37 -0
  17. Biomanus-V2/Experiment1/EXPERIMENT_DESIGN.md +78 -0
  18. Biomanus-V2/Experiment1/README.md +123 -0
  19. Biomanus-V2/Experiment1/SAMPLE_EXPANSION_PLAN.md +43 -0
  20. Biomanus-V2/Experiment1/SECOND_BATCH_FIXTURES.md +60 -0
  21. Biomanus-V2/Experiment1/configs/backend_deepseek_v4_flash.json +9 -0
  22. Biomanus-V2/Experiment1/configs/development_pinned_envs.json +30 -0
  23. Biomanus-V2/Experiment1/configs/experiment.json +38 -0
  24. Biomanus-V2/Experiment1/configs/strict_core.json +38 -0
  25. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/arvados-cwl-runner.json +31 -0
  26. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/arvados-python-client.json +35 -0
  27. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/auspice.json +31 -0
  28. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/cnvkit.json +31 -0
  29. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/cooler.json +31 -0
  30. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/crispresso2.json +36 -0
  31. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/delly.json +31 -0
  32. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/dxpy.json +31 -0
  33. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/ensembl-vep.json +33 -0
  34. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/genomepy.json +31 -0
  35. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/gofasta.json +31 -0
  36. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kalign2.json +31 -0
  37. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kmer-jellyfish.json +31 -0
  38. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kraken2.json +33 -0
  39. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/lastz.json +31 -0
  40. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/libdeflate.json +34 -0
  41. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/multiqc-bcbio.json +31 -0
  42. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/phyml.json +31 -0
  43. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/pytabix.json +32 -0
  44. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/rseqc.json +48 -0
  45. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/sage-proteomics.json +31 -0
  46. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/sambamba.json +31 -0
  47. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/samtools.json +60 -0
  48. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/seqfu.json +31 -0
  49. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/snakemake-minimal.json +31 -0
  50. Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/t_coffee.json +31 -0
Biomanus-V2/Experiment1/.sync_stage_group2/build_test_103_group2_cases.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build seven native-validated cases from the callable Test-103 pool."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import hashlib
7
+ import json
8
+ from pathlib import Path
9
+
10
+ from build_test_batch1_cases import ENV_ROOT, OUT_ROOT, ROOT, base
11
+ from promote_second_batch_cases import attach_execution_plan, attach_generation_interface, validator
12
+
13
+
14
+ PROBE_ROOTS = {
15
+ "hmmer": ROOT / "runs/test_103_native_curation/group2_probe_v1/hmmer",
16
+ "kallisto": ROOT / "runs/test_103_native_curation/group2_probe_v1/kallisto",
17
+ "picard": ROOT / "runs/test_103_native_curation/group2_probe_v1/picard",
18
+ "bamtools": ROOT / "runs/test_103_native_curation/group2_probe_v1/bamtools",
19
+ "deeptools": ROOT / "runs/test_103_native_curation/group2_probe_v1/deeptools",
20
+ "raxml": ROOT / "runs/test_103_native_curation/group2_probe_v2/raxml",
21
+ "subread": ROOT / "runs/test_103_native_curation/group2_probe_v2/subread",
22
+ }
23
+ REVIEW_JSON = ROOT / "data/curation/test_103_group2_native_review.json"
24
+ REVIEW_MD = ROOT / "reports/test_103_group2_native_review.md"
25
+
26
+
27
+ def build_cases() -> list[dict]:
28
+ cases = []
29
+ env = ENV_ROOT / "hmmer-3.4-h7d74f8d_5"
30
+ case = base("hmmer", "3.4", "h7d74f8d_5", "build_protein_hmm")
31
+ case.update({"fixture_bindings": {"alignment_file": "data/fixtures/proteins_multi.faa"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/hmmbuild'} --amino --informat afa '{{output_hmm}}' '{{alignment_file}}' && {env / 'bin/hmmstat'} '{{output_hmm}}' > '{{output_stats}}'"]}, "outputs": {"output_hmm": "hmmer/model.hmm", "output_stats": "hmmer/stats.txt"}, "validators": [validator("hmm_nonempty", "output_hmm", "nonempty"), validator("stats_nonempty", "output_stats", "nonempty"), validator("model_row", "output_stats", "regex", pattern=r"^1\s+proteins_multi")], "semantic_oracle": {"kind": "normalized_noncomment_text_equal", "target": "output_stats"}})
32
+ attach_generation_interface(case, "hmmbuild", None, [{"name": "alignment_file", "value_type": "path", "required": True, "native_binding": "positional"}, {"name": "output_hmm", "value_type": "path", "required": True, "native_binding": "positional"}, {"name": "output_stats", "value_type": "path", "required": True, "native_binding": "hmmstat stdout"}], "Build an amino-acid HMM from aligned FASTA, then report deterministic model statistics.")
33
+ attach_execution_plan(case, [{"command": ["hmmbuild", "--amino", "--informat", "afa", "{output_hmm}", "{alignment_file}"]}, {"command": ["hmmstat", "{output_hmm}"], "capture_stdout_to": "output_stats"}]); cases.append(case)
34
+
35
+ env = ENV_ROOT / "kallisto-0.52.0-h13ff97a_0"
36
+ case = base("kallisto", "0.52.0", "h13ff97a_0", "build_transcript_index")
37
+ case.update({"fixture_bindings": {"transcripts_fasta": "data/fixtures/reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/kallisto"), "index", "-i", "{output_index}", "{transcripts_fasta}"]}, "outputs": {"output_index": "kallisto/transcripts.idx"}, "validators": [validator("index_nonempty", "output_index", "nonempty")], "semantic_oracle": {"kind": "binary_equal", "target": "output_index"}})
38
+ attach_generation_interface(case, "kallisto", "index", [{"name": "transcripts_fasta", "value_type": "path", "required": True, "native_binding": "positional"}, {"name": "output_index", "value_type": "path", "required": True, "native_binding": "-i"}]); attach_execution_plan(case, [{"command": ["kallisto", "index", "-i", "{output_index}", "{transcripts_fasta}"]}]); cases.append(case)
39
+
40
+ env = ENV_ROOT / "picard-2.18.7-py36_0"
41
+ case = base("picard", "2.18.7", "py36_0", "sort_sam")
42
+ case.update({"fixture_bindings": {"input_bam": "data/fixtures/second_batch_alignments.unsorted.bam"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/picard'} SortSam INPUT='{{input_bam}}' OUTPUT='{{output_bam}}' SORT_ORDER=coordinate CREATE_INDEX=true VALIDATION_STRINGENCY=SILENT && {env / 'bin/picard'} ViewSam I='{{output_bam}}' ALIGNMENT_STATUS=All PF_STATUS=All > '{{output_sam}}'"]}, "outputs": {"output_bam": "picard/sorted.bam", "output_bai": "picard/sorted.bai", "output_sam": "picard/sorted.sam"}, "validators": [validator("bam_nonempty", "output_bam", "nonempty"), validator("bai_nonempty", "output_bai", "nonempty"), validator("sam_valid", "output_sam", "sam")], "semantic_oracle": {"kind": "sam_records_equal", "target": "output_sam"}, "runner_notes": "output_bai derives from output_bam."})
43
+ attach_generation_interface(case, "picard", "SortSam", [{"name": "input_bam", "value_type": "path", "required": True, "native_binding": "INPUT="}, {"name": "output_bam", "value_type": "path", "required": True, "native_binding": "OUTPUT="}, {"name": "output_sam", "value_type": "path", "required": True, "native_binding": "ViewSam stdout"}], "Sort coordinate order, create an index, then render SAM records for the semantic oracle.")
44
+ attach_execution_plan(case, [{"command": ["picard", "SortSam", {"format": "INPUT={input_bam}"}, {"format": "OUTPUT={output_bam}"}, "SORT_ORDER=coordinate", "CREATE_INDEX=true", "VALIDATION_STRINGENCY=SILENT"]}, {"command": ["picard", "ViewSam", {"format": "I={output_bam}"}, "ALIGNMENT_STATUS=All", "PF_STATUS=All"], "capture_stdout_to": "output_sam"}]); cases.append(case)
45
+
46
+ env = ENV_ROOT / "raxml-8.2.13-h7b50bb2_3"
47
+ case = base("raxml", "8.2.13", "h7b50bb2_3", "infer_protein_tree")
48
+ case.update({"fixture_bindings": {"alignment_file": "data/fixtures/test_phylo4.phy"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"mkdir -p '{{output_dir}}' && {env / 'bin/raxmlHPC'} -s '{{alignment_file}}' -n fixture -m PROTGAMMALG -p 1 -N 1 -w '{{output_dir}}'"]}, "outputs": {"output_dir": "raxml", "best_tree": "raxml/RAxML_bestTree.fixture", "info_file": "raxml/RAxML_info.fixture"}, "validators": [validator("tree_nonempty", "best_tree", "nonempty"), validator("newick_tree", "best_tree", "regex", pattern=r"^\("), validator("info_nonempty", "info_file", "nonempty")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "best_tree"}, "runner_notes": "best_tree and info_file derive from output_dir and fixed run name."})
49
+ attach_generation_interface(case, "raxmlHPC", None, [{"name": "alignment_file", "value_type": "path", "required": True, "native_binding": "-s"}, {"name": "output_dir", "value_type": "path", "required": True, "native_binding": "-w"}], "PROTGAMMALG, parsimony seed 1, and one search are fixed.")
50
+ attach_execution_plan(case, [{"make_directories": ["output_dir"], "command": ["raxmlHPC", "-s", "{alignment_file}", "-n", "fixture", "-m", "PROTGAMMALG", "-p", "1", "-N", "1", "-w", "{output_dir}"]}]); cases.append(case)
51
+
52
+ env = ENV_ROOT / "subread-2.1.1-h577a1d6_0"
53
+ case = base("subread", "2.1.1", "h577a1d6_0", "count_features")
54
+ case.update({"fixture_bindings": {"annotation_gtf": "data/fixtures/test_gene_model.gtf", "input_bam": "data/fixtures/second_batch_alignments.bam", "input_bai": "data/fixtures/second_batch_alignments.bam.bai"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/featureCounts"), "-T", "1", "-p", "--countReadPairs", "-a", "{annotation_gtf}", "-o", "{output_counts}", "{input_bam}"]}, "outputs": {"output_counts": "subread/counts.txt", "output_summary": "subread/counts.txt.summary"}, "validators": [validator("counts_nonempty", "output_counts", "nonempty"), validator("gene_a_count", "output_counts", "regex", pattern=r"^geneA\t.*\t12$")], "semantic_oracle": {"kind": "featurecounts_table_equal", "target": "output_counts"}, "runner_notes": "input_bai is an implicit sidecar; output_summary derives from output_counts."})
55
+ attach_generation_interface(case, "featureCounts", None, [{"name": "annotation_gtf", "value_type": "path", "required": True, "native_binding": "-a"}, {"name": "input_bam", "value_type": "path", "required": True, "native_binding": "positional"}, {"name": "output_counts", "value_type": "path", "required": True, "native_binding": "-o"}], "Count paired fragments with one thread.")
56
+ attach_execution_plan(case, [{"command": ["featureCounts", "-T", "1", "-p", "--countReadPairs", "-a", "{annotation_gtf}", "-o", "{output_counts}", "{input_bam}"]}]); cases.append(case)
57
+
58
+ env = ENV_ROOT / "bamtools-2.5.3-he132191_0"
59
+ case = base("bamtools", "2.5.3", "he132191_0", "bam_to_sam")
60
+ case.update({"fixture_bindings": {"input_bam": "data/fixtures/second_batch_alignments.bam"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/bamtools"), "convert", "-in", "{input_bam}", "-format", "sam", "-out", "{output_sam}"]}, "outputs": {"output_sam": "bamtools/output.sam"}, "validators": [validator("sam_valid", "output_sam", "sam")], "semantic_oracle": {"kind": "sam_records_equal", "target": "output_sam"}})
61
+ attach_generation_interface(case, "bamtools", "convert", [{"name": "input_bam", "value_type": "path", "required": True, "native_binding": "-in"}, {"name": "output_sam", "value_type": "path", "required": True, "native_binding": "-out"}], "SAM output format is fixed.")
62
+ attach_execution_plan(case, [{"command": ["bamtools", "convert", "-in", "{input_bam}", "-format", "sam", "-out", "{output_sam}"]}]); cases.append(case)
63
+
64
+ env = ENV_ROOT / "deeptools-3.1.3-py36h14c3975_1"
65
+ case = base("deeptools", "3.1.3", "py36h14c3975_1", "bam_coverage")
66
+ case.update({"fixture_bindings": {"input_bam": "data/fixtures/second_batch_alignments.bam", "input_bai": "data/fixtures/second_batch_alignments.bam.bai"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/bamCoverage"), "-b", "{input_bam}", "-o", "{output_bigwig}", "--binSize", "10", "-p", "1", "--normalizeUsing", "None"]}, "outputs": {"output_bigwig": "deeptools/coverage.bw"}, "validators": [validator("bigwig_nonempty", "output_bigwig", "nonempty")], "semantic_oracle": {"kind": "binary_equal", "target": "output_bigwig"}, "runner_notes": "input_bai is an implicit adjacent sidecar."})
67
+ attach_generation_interface(case, "bamCoverage", None, [{"name": "input_bam", "value_type": "path", "required": True, "native_binding": "-b"}, {"name": "output_bigwig", "value_type": "path", "required": True, "native_binding": "-o"}], "Use bin size 10, one processor, and no normalization.")
68
+ attach_execution_plan(case, [{"command": ["bamCoverage", "-b", "{input_bam}", "-o", "{output_bigwig}", "--binSize", "10", "-p", "1", "--normalizeUsing", "None"]}]); cases.append(case)
69
+ return cases
70
+
71
+
72
+ def main() -> int:
73
+ cases = build_cases(); OUT_ROOT.mkdir(parents=True, exist_ok=True)
74
+ for case in cases: (OUT_ROOT / f"{case['package']}.json").write_text(json.dumps(case, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
75
+ evidence = []
76
+ for case in cases:
77
+ files = [{"path": str(path.relative_to(ROOT)), "size": path.stat().st_size, "sha256": hashlib.sha256(path.read_bytes()).hexdigest()} for path in sorted(PROBE_ROOTS[case["package"]].glob("*")) if path.is_file() and path.stat().st_size]
78
+ evidence.append({"package": case["package"], "case_id": case["case_id"], "endpoint": case["endpoint"], "environment": case["native"]["environment"], "native_command": case["native"]["command"], "validators": case["validators"], "semantic_oracle": case["semantic_oracle"], "outputs": files, "review_decision": "preauthorized_pending_native_repeat"})
79
+ payload = {"scope": "test_103_group2_method_blind_native_review", "case_count": len(cases), "method_generation_started": False, "blanket_preauthorized_by_user": True, "cases": evidence}; REVIEW_JSON.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
80
+ lines = ["# Test 103 group 2 native review", "", "Blanket-preauthorized; promotion still requires native repeat equality.", "", "| Package | Endpoint | Decision |", "|---|---|---|"] + [f"| {row['package']} | `{row['endpoint']}` | preauthorized, repeat pending |" for row in evidence]
81
+ REVIEW_MD.write_text("\n".join(lines) + "\n", encoding="utf-8"); print(json.dumps({"cases": len(cases), "review_json": str(REVIEW_JSON), "review_md": str(REVIEW_MD)}, indent=2)); return 0
82
+
83
+
84
+ if __name__ == "__main__": raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group2/test_smoke.py ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import gzip
5
+ import py_compile
6
+ import tempfile
7
+ import unittest
8
+ from pathlib import Path
9
+ import sys
10
+
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ sys.path.insert(0, str(ROOT / "scripts"))
14
+
15
+ from generate_wrapper import render_wrapper, validate_ir_minimal # noqa: E402
16
+ from run_experiment import materialize_case, substitute_command # noqa: E402
17
+ from validators import compare_oracle, validate_all # noqa: E402
18
+
19
+
20
+ class ExperimentOneSmokeTests(unittest.TestCase):
21
+ def test_example_ir_generates_compilable_python(self) -> None:
22
+ ir = json.loads((ROOT / "examples" / "seqkit_stats.contract.json").read_text())
23
+ self.assertEqual(validate_ir_minimal(ir), [])
24
+ code = render_wrapper(ir)
25
+ self.assertIn("@mcp.tool()", code)
26
+ with tempfile.TemporaryDirectory() as temp:
27
+ path = Path(temp) / "server.py"
28
+ path.write_text(code)
29
+ py_compile.compile(str(path), doraise=True)
30
+
31
+ def test_tsv_validator_and_oracle(self) -> None:
32
+ with tempfile.TemporaryDirectory() as temp:
33
+ root = Path(temp)
34
+ native = root / "native.tsv"
35
+ mcp = root / "mcp.tsv"
36
+ native.write_text("a\tb\n1\t2\n")
37
+ mcp.write_text("a\tb\n1\t2\n")
38
+ spec = [{"name": "tsv", "target": "out", "kind": "tsv", "config": {"min_columns": 2}}]
39
+ ok, details = validate_all(spec, {"out": mcp})
40
+ self.assertTrue(ok, details)
41
+ oracle = compare_oracle({"kind": "normalized_text_equal", "target": "out"}, {"out": native}, {"out": mcp})
42
+ self.assertTrue(oracle["ok"])
43
+
44
+ def test_tsv_oracle_can_ignore_path_column(self) -> None:
45
+ with tempfile.TemporaryDirectory() as temp:
46
+ root = Path(temp)
47
+ native = root / "native.tsv"
48
+ mcp = root / "mcp.tsv"
49
+ native.write_text("/tmp/native/input.fa\t1\t40\n")
50
+ mcp.write_text("/tmp/mcp/input.fa\t1\t40\n")
51
+ oracle = compare_oracle(
52
+ {"kind": "tsv_equal_ignore_columns", "target": "out", "ignore_columns": [0]},
53
+ {"out": native},
54
+ {"out": mcp},
55
+ )
56
+ self.assertTrue(oracle["ok"])
57
+
58
+ def test_noncomment_oracle_ignores_command_header(self) -> None:
59
+ with tempfile.TemporaryDirectory() as temp:
60
+ root = Path(temp)
61
+ native = root / "native.gtf"
62
+ mcp = root / "mcp.gtf"
63
+ record = 'chr1\ttool\ttranscript\t1\t10\t.\t+\t.\tgene_id "g1";\n'
64
+ native.write_text("# native /tmp/a\n" + record)
65
+ mcp.write_text("# mcp /tmp/b\n" + record)
66
+ oracle = compare_oracle(
67
+ {"kind": "normalized_noncomment_text_equal", "target": "out"},
68
+ {"out": native},
69
+ {"out": mcp},
70
+ )
71
+ self.assertTrue(oracle["ok"])
72
+
73
+ def test_featurecounts_oracle_normalizes_input_path_header(self) -> None:
74
+ with tempfile.TemporaryDirectory() as temp:
75
+ root = Path(temp)
76
+ native = root / "native.txt"
77
+ mcp = root / "mcp.txt"
78
+ native.write_text("# command native\nGeneid\t/tmp/native/in.bam\ngeneA\t12\n")
79
+ mcp.write_text("# command mcp\nGeneid\t/tmp/mcp/in.bam\ngeneA\t12\n")
80
+ oracle = compare_oracle(
81
+ {"kind": "featurecounts_table_equal", "target": "out"},
82
+ {"out": native},
83
+ {"out": mcp},
84
+ )
85
+ self.assertTrue(oracle["ok"])
86
+
87
+ def test_binary_oracle_compares_exact_bytes(self) -> None:
88
+ with tempfile.TemporaryDirectory() as temp:
89
+ root = Path(temp)
90
+ native = root / "native.bin"
91
+ mcp = root / "mcp.bin"
92
+ native.write_bytes(b"\x00\x01\xff")
93
+ mcp.write_bytes(b"\x00\x01\xff")
94
+ oracle = compare_oracle(
95
+ {"kind": "binary_equal", "target": "out"},
96
+ {"out": native},
97
+ {"out": mcp},
98
+ )
99
+ self.assertTrue(oracle["ok"])
100
+
101
+ def test_sam_validator_ignores_header_records(self) -> None:
102
+ with tempfile.TemporaryDirectory() as temp:
103
+ output = Path(temp) / "output.sam"
104
+ output.write_text(
105
+ "@HD\tVN:1.6\tSO:queryname\n"
106
+ "@SQ\tSN:chr1\tLN:100\n"
107
+ "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
108
+ )
109
+ ok, details = validate_all(
110
+ [{"name": "sam", "target": "out", "kind": "sam", "config": {}}],
111
+ {"out": output},
112
+ )
113
+ self.assertTrue(ok, details)
114
+
115
+ def test_gzip_validator_and_content_oracle(self) -> None:
116
+ with tempfile.TemporaryDirectory() as temp:
117
+ root = Path(temp)
118
+ native = root / "native.gz"
119
+ mcp = root / "mcp.gz"
120
+ with gzip.open(native, "wb") as handle:
121
+ handle.write(b">seq\nACGT\n")
122
+ with gzip.open(mcp, "wb") as handle:
123
+ handle.write(b">seq\nACGT\n")
124
+ ok, details = validate_all(
125
+ [{"name": "gzip", "target": "out", "kind": "gzip", "config": {}}],
126
+ {"out": mcp},
127
+ )
128
+ self.assertTrue(ok, details)
129
+ oracle = compare_oracle(
130
+ {"kind": "gzip_content_equal", "target": "out"},
131
+ {"out": native},
132
+ {"out": mcp},
133
+ )
134
+ self.assertTrue(oracle["ok"])
135
+
136
+ def test_sam_record_oracle_ignores_headers(self) -> None:
137
+ with tempfile.TemporaryDirectory() as temp:
138
+ root = Path(temp)
139
+ native = root / "native.sam"
140
+ mcp = root / "mcp.sam"
141
+ record = "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
142
+ native.write_text("@PG\tID:native\tCL:/tmp/native\n" + record)
143
+ mcp.write_text("@PG\tID:mcp\tCL:/tmp/mcp\n" + record)
144
+ oracle = compare_oracle(
145
+ {"kind": "sam_records_equal", "target": "out"},
146
+ {"out": native},
147
+ {"out": mcp},
148
+ )
149
+ self.assertTrue(oracle["ok"])
150
+
151
+ def test_fixture_binding_can_materialize_path_list(self) -> None:
152
+ with tempfile.TemporaryDirectory() as temp:
153
+ root = Path(temp)
154
+ fixture = root / "input.fa"
155
+ fixture.write_text(">seq\nACGT\n")
156
+ workdir = root / "work"
157
+ workdir.mkdir()
158
+ case = {
159
+ "fixture_bindings": {
160
+ "files": {"path": "input.fa", "argument_mode": "list"}
161
+ }
162
+ }
163
+ bindings, arguments = materialize_case(case, root, workdir)
164
+ self.assertEqual(bindings["files"], workdir / "input.fa")
165
+ self.assertEqual(arguments["files"], [str(workdir / "input.fa")])
166
+
167
+ def test_endpoint_argument_allowlist_keeps_sidecars_out_of_mcp_call(self) -> None:
168
+ with tempfile.TemporaryDirectory() as temp:
169
+ root = Path(temp)
170
+ (root / "input.bam").write_bytes(b"bam")
171
+ (root / "input.bam.bai").write_bytes(b"bai")
172
+ workdir = root / "work"
173
+ workdir.mkdir()
174
+ case = {
175
+ "endpoint_arguments": ["input_bam", "output_table"],
176
+ "fixture_bindings": {
177
+ "input_bam": "input.bam",
178
+ "input_bai": "input.bam.bai",
179
+ },
180
+ "outputs": {"output_table": "result.txt"},
181
+ }
182
+ bindings, arguments = materialize_case(case, root, workdir)
183
+ self.assertIn("input_bai", bindings)
184
+ self.assertNotIn("input_bai", arguments)
185
+ self.assertEqual(set(arguments), {"input_bam", "output_table"})
186
+
187
+ def test_contract_template_can_capture_stdout_to_output_argument(self) -> None:
188
+ ir = {
189
+ "ir_version": "0.1",
190
+ "tool": {"executable": "tool", "subcommand": None},
191
+ "endpoint": {"name": "run_tool", "description": "test"},
192
+ "arguments": [
193
+ {"name": "input_file", "flag": "-i", "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "input"},
194
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "captured output", "pass_to_cli": False},
195
+ ],
196
+ "inputs": [],
197
+ "outputs": [{"name": "output", "artifact_type": "text", "binding": "output_file", "capture": "stdout", "assertions": []}],
198
+ "validators": [],
199
+ "evidence": [],
200
+ }
201
+ code = render_wrapper(ir)
202
+ self.assertIn("Path(output_file).write_text(completed.stdout", code)
203
+ self.assertNotIn("_append_value(command, None, output_file)", code)
204
+
205
+ def test_contract_template_can_capture_binary_stdout(self) -> None:
206
+ ir = {
207
+ "ir_version": "0.1",
208
+ "tool": {"executable": "bgzip", "subcommand": None},
209
+ "endpoint": {"name": "compress", "description": "test"},
210
+ "arguments": [
211
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input"},
212
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
213
+ ],
214
+ "inputs": [],
215
+ "outputs": [{"name": "output", "artifact_type": "file", "binding": "output_file", "assertions": []}],
216
+ "validators": [],
217
+ "evidence": [],
218
+ "execution_plan": {"steps": [{"command": ["bgzip", "-c", "{input_file}"], "capture_stdout_to": "output_file", "stdout_mode": "binary"}]},
219
+ }
220
+ code = render_wrapper(ir)
221
+ self.assertIn("text=False", code)
222
+ self.assertIn("Path(output_file).write_bytes", code)
223
+ with tempfile.TemporaryDirectory() as temp:
224
+ path = Path(temp) / "server.py"
225
+ path.write_text(code)
226
+ py_compile.compile(str(path), doraise=True)
227
+
228
+ def test_native_command_substitution_includes_scalar_arguments(self) -> None:
229
+ command = substitute_command(
230
+ ["tabix", "{input_file}", "{region}"],
231
+ {"input_file": Path("input.vcf.gz"), "region": "chrTiny:1-10"},
232
+ )
233
+ self.assertEqual(command, ["tabix", "input.vcf.gz", "chrTiny:1-10"])
234
+
235
+ def test_execution_plan_format_token_supports_multiple_arguments(self) -> None:
236
+ ir = {
237
+ "ir_version": "0.1",
238
+ "tool": {"executable": "mothur", "subcommand": None},
239
+ "endpoint": {"name": "summarize", "description": "test"},
240
+ "arguments": [
241
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input", "pass_to_cli": False},
242
+ {"name": "output_dir", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
243
+ ],
244
+ "inputs": [],
245
+ "outputs": [],
246
+ "validators": [],
247
+ "evidence": [],
248
+ "execution_plan": {"steps": [{"command": ["mothur", {"format": "#set.dir(output={output_dir}); summary.seqs(fasta={input_file})"}]}]},
249
+ }
250
+ code = render_wrapper(ir)
251
+ self.assertIn("str(output_dir)", code)
252
+ self.assertIn("str(input_file)", code)
253
+ with tempfile.TemporaryDirectory() as temp:
254
+ path = Path(temp) / "server.py"
255
+ path.write_text(code)
256
+ py_compile.compile(str(path), doraise=True)
257
+
258
+
259
+ if __name__ == "__main__":
260
+ unittest.main()
Biomanus-V2/Experiment1/.sync_stage_group2/validators.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import gzip
5
+ import json
6
+ import os
7
+ import re
8
+ import shutil
9
+ import subprocess
10
+ from pathlib import Path
11
+ from typing import Any
12
+
13
+
14
+ def _noncomment_lines(path: Path) -> list[str]:
15
+ return [line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")]
16
+
17
+
18
+ def validate_one(spec: dict[str, Any], bindings: dict[str, Path]) -> dict[str, Any]:
19
+ target = spec["target"]
20
+ path = bindings.get(target)
21
+ kind = spec["kind"]
22
+ config = spec.get("config") or {}
23
+ result = {"name": spec.get("name", kind), "target": target, "kind": kind, "ok": False, "detail": ""}
24
+ if path is None:
25
+ result["detail"] = "target binding missing"
26
+ return result
27
+ try:
28
+ if kind == "exists":
29
+ result["ok"] = path.exists()
30
+ elif kind == "nonempty":
31
+ result["ok"] = path.is_file() and path.stat().st_size > 0
32
+ elif kind == "json":
33
+ json.loads(path.read_text(encoding="utf-8")); result["ok"] = True
34
+ elif kind in {"csv", "tsv"}:
35
+ delimiter = "," if kind == "csv" else "\t"
36
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
37
+ rows = list(csv.reader(handle, delimiter=delimiter))
38
+ minimum = int(config.get("min_columns", 1))
39
+ result["ok"] = bool(rows) and all(len(row) >= minimum for row in rows)
40
+ result["detail"] = f"rows={len(rows)}"
41
+ elif kind == "fasta":
42
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
43
+ result["ok"] = bool(lines) and lines[0].startswith(">") and any(line and not line.startswith(">") for line in lines)
44
+ elif kind == "maf":
45
+ rows = _noncomment_lines(path)
46
+ result["ok"] = any(row.startswith("a ") for row in rows) and any(row.startswith("s ") for row in rows)
47
+ elif kind == "fastq":
48
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
49
+ result["ok"] = len(lines) >= 4 and len(lines) % 4 == 0 and lines[0].startswith("@") and lines[2].startswith("+")
50
+ elif kind == "bed":
51
+ rows = _noncomment_lines(path)
52
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 3 for row in rows)
53
+ elif kind == "sam":
54
+ rows = [
55
+ line
56
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
57
+ if line and not line.startswith("@")
58
+ ]
59
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 11 for row in rows)
60
+ elif kind == "gzip":
61
+ with gzip.open(path, "rb") as handle:
62
+ handle.read(1)
63
+ result["ok"] = True
64
+ elif kind == "vcf":
65
+ text = path.read_text(encoding="utf-8", errors="replace")
66
+ rows = [line for line in text.splitlines() if line and not line.startswith("#")]
67
+ result["ok"] = "##fileformat=VCF" in text and "#CHROM" in text and all(len(row.split("\t")) >= 8 for row in rows)
68
+ elif kind == "regex":
69
+ result["ok"] = re.search(str(config["pattern"]), path.read_text(encoding="utf-8", errors="replace"), re.MULTILINE) is not None
70
+ else:
71
+ result["detail"] = f"validator kind not implemented: {kind}"
72
+ return result
73
+ except Exception as exc:
74
+ result["detail"] = f"{type(exc).__name__}: {exc}"
75
+ return result
76
+ if not result["detail"]:
77
+ result["detail"] = str(path)
78
+ return result
79
+
80
+
81
+ def validate_all(specs: list[dict[str, Any]], bindings: dict[str, Path]) -> tuple[bool, list[dict[str, Any]]]:
82
+ results = [validate_one(spec, bindings) for spec in specs]
83
+ return bool(results) and all(item["ok"] for item in results), results
84
+
85
+
86
+ def normalized_text(path: Path) -> str:
87
+ return "\n".join(line.rstrip() for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line.strip())
88
+
89
+
90
+ def normalized_bcf_records(path: Path, spec: dict[str, Any]) -> list[str]:
91
+ executable = spec.get("bcftools_executable") or os.getenv("BCFTOOLS") or shutil.which("bcftools")
92
+ if not executable:
93
+ candidates = (
94
+ "/225040511/miniconda3/envs/bioenv/bin/bcftools",
95
+ "/225040511/miniconda3/envs/bioenv_cli/bin/bcftools",
96
+ "/225040511/miniconda3/envs/biomni_e1/bin/bcftools",
97
+ )
98
+ executable = next((candidate for candidate in candidates if Path(candidate).is_file()), None)
99
+ if not executable:
100
+ raise RuntimeError("bcftools executable not found")
101
+ completed = subprocess.run(
102
+ [str(executable), "view", "-H", str(path)],
103
+ text=True,
104
+ capture_output=True,
105
+ timeout=60,
106
+ )
107
+ if completed.returncode != 0:
108
+ raise RuntimeError(completed.stderr[-2000:] or "bcftools could not parse BCF")
109
+ return sorted(line.rstrip() for line in completed.stdout.splitlines() if line.strip())
110
+
111
+
112
+ def fasta_records(path: Path) -> dict[str, str]:
113
+ records: dict[str, str] = {}
114
+ name: str | None = None
115
+ chunks: list[str] = []
116
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
117
+ if line.startswith(">"):
118
+ if name is not None:
119
+ records[name] = "".join(chunks).replace(" ", "").upper()
120
+ name = line[1:].strip().split()[0]
121
+ chunks = []
122
+ elif line.strip():
123
+ chunks.append(line.strip())
124
+ if name is not None:
125
+ records[name] = "".join(chunks).replace(" ", "").upper()
126
+ return records
127
+
128
+
129
+ def maf_semantic_rows(path: Path) -> list[str]:
130
+ return [
131
+ " ".join(line.split())
132
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
133
+ if line.startswith(("a ", "s ", "i ", "e ", "q "))
134
+ ]
135
+
136
+
137
+ def compare_oracle(spec: dict[str, Any], native: dict[str, Path], mcp: dict[str, Path]) -> dict[str, Any]:
138
+ kind = spec.get("kind")
139
+ target = spec.get("target")
140
+ left, right = native.get(target), mcp.get(target)
141
+ result = {"kind": kind, "target": target, "ok": False, "detail": ""}
142
+ if left is None or right is None or not left.exists() or not right.exists():
143
+ result["detail"] = "oracle target missing"
144
+ return result
145
+ try:
146
+ if kind == "normalized_text_equal":
147
+ result["ok"] = normalized_text(left) == normalized_text(right)
148
+ elif kind == "normalized_noncomment_text_equal":
149
+ def noncomment_text(path: Path) -> str:
150
+ return "\n".join(
151
+ line.rstrip()
152
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
153
+ if line.strip() and not line.startswith("#")
154
+ )
155
+
156
+ result["ok"] = noncomment_text(left) == noncomment_text(right)
157
+ elif kind == "json_equal":
158
+ result["ok"] = json.loads(left.read_text()) == json.loads(right.read_text())
159
+ elif kind == "record_count_equal":
160
+ result["ok"] = len(_noncomment_lines(left)) == len(_noncomment_lines(right))
161
+ elif kind == "bcf_records_equal":
162
+ result["ok"] = normalized_bcf_records(left, spec) == normalized_bcf_records(right, spec)
163
+ elif kind == "fasta_records_equal":
164
+ result["ok"] = fasta_records(left) == fasta_records(right)
165
+ elif kind == "maf_records_equal":
166
+ result["ok"] = maf_semantic_rows(left) == maf_semantic_rows(right)
167
+ elif kind == "vcf_records_equal":
168
+ result["ok"] = _noncomment_lines(left) == _noncomment_lines(right)
169
+ elif kind == "tsv_equal_ignore_columns":
170
+ ignored = {int(value) for value in spec.get("ignore_columns", [])}
171
+
172
+ def projected(path: Path) -> list[list[str]]:
173
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
174
+ return [
175
+ [value for index, value in enumerate(row) if index not in ignored]
176
+ for row in csv.reader(handle, delimiter="\t")
177
+ ]
178
+
179
+ result["ok"] = projected(left) == projected(right)
180
+ elif kind == "featurecounts_table_equal":
181
+ def featurecounts_rows(path: Path) -> list[list[str]]:
182
+ rows = [
183
+ row for row in csv.reader(
184
+ (line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")),
185
+ delimiter="\t",
186
+ )
187
+ ]
188
+ if rows and rows[0]:
189
+ rows[0][-1] = Path(rows[0][-1]).name
190
+ return rows
191
+
192
+ result["ok"] = featurecounts_rows(left) == featurecounts_rows(right)
193
+ elif kind == "normalized_lines_equal_unordered":
194
+ def normalized_lines(path: Path) -> list[str]:
195
+ return sorted(
196
+ " ".join(line.split())
197
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
198
+ if line.strip()
199
+ )
200
+
201
+ result["ok"] = normalized_lines(left) == normalized_lines(right)
202
+ elif kind == "binary_equal":
203
+ result["ok"] = left.read_bytes() == right.read_bytes()
204
+ elif kind == "gzip_content_equal":
205
+ with gzip.open(left, "rb") as left_handle, gzip.open(right, "rb") as right_handle:
206
+ result["ok"] = left_handle.read() == right_handle.read()
207
+ elif kind == "sam_records_equal":
208
+ def sam_records(path: Path) -> list[str]:
209
+ return [
210
+ line.rstrip()
211
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
212
+ if line and not line.startswith("@")
213
+ ]
214
+
215
+ result["ok"] = sam_records(left) == sam_records(right)
216
+ else:
217
+ result["detail"] = f"oracle kind not implemented: {kind}"
218
+ return result
219
+ except Exception as exc:
220
+ result["detail"] = f"{type(exc).__name__}: {exc}"
221
+ return result
222
+ result["detail"] = f"native={left}; mcp={right}"
223
+ return result
Biomanus-V2/Experiment1/.sync_stage_group2/verify_test_103_group2_repeat.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Repeat group-2 native executions and compare them with the first probes."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import os
8
+ import subprocess
9
+ from pathlib import Path
10
+
11
+ from build_test_103_group2_cases import PROBE_ROOTS, ROOT, build_cases
12
+ from run_experiment import environment_for_case, materialize_case, substitute_command
13
+ from validators import compare_oracle, validate_all
14
+
15
+
16
+ REPEAT_ROOT = ROOT / "runs/test_103_native_curation/group2_repeat_v1"
17
+ REPORT = ROOT / "reports/test_103_group2_native_repeat.json"
18
+
19
+
20
+ def probe_bindings(case: dict) -> dict[str, Path]:
21
+ root = PROBE_ROOTS[case["package"]]
22
+ bindings: dict[str, Path] = {}
23
+ for name, relative in case["outputs"].items():
24
+ parts = Path(relative).parts
25
+ candidate = root.joinpath(*parts[1:]) if parts and parts[0] == case["package"] else root / relative
26
+ bindings[name] = candidate
27
+ return bindings
28
+
29
+
30
+ def main() -> int:
31
+ if REPEAT_ROOT.exists():
32
+ raise SystemExit(f"repeat output already exists: {REPEAT_ROOT}")
33
+ REPEAT_ROOT.mkdir(parents=True)
34
+ rows = []
35
+ for case in build_cases():
36
+ workdir = REPEAT_ROOT / case["package"]
37
+ workdir.mkdir()
38
+ bindings, arguments = materialize_case(case, ROOT, workdir)
39
+ command = substitute_command(case["native"]["command"], {**bindings, **arguments})
40
+ env = environment_for_case(case, os.environ)
41
+ completed = subprocess.run(command, cwd=workdir, env=env, text=True, capture_output=True, timeout=300)
42
+ validators_ok, details = validate_all(case["validators"], bindings)
43
+ oracle = compare_oracle(case["semantic_oracle"], probe_bindings(case), bindings)
44
+ ok = completed.returncode == 0 and validators_ok and oracle["ok"]
45
+ rows.append({
46
+ "package": case["package"],
47
+ "case_id": case["case_id"],
48
+ "ok": ok,
49
+ "returncode": completed.returncode,
50
+ "validators_ok": validators_ok,
51
+ "validators": details,
52
+ "oracle": oracle,
53
+ "stdout_tail": completed.stdout[-2000:],
54
+ "stderr_tail": completed.stderr[-2000:],
55
+ })
56
+ print(json.dumps({"package": case["package"], "ok": ok, "returncode": completed.returncode, "validators_ok": validators_ok, "oracle_ok": oracle["ok"]}))
57
+ payload = {"case_count": len(rows), "passed": sum(row["ok"] for row in rows), "cases": rows}
58
+ REPORT.parent.mkdir(parents=True, exist_ok=True)
59
+ REPORT.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
60
+ print(json.dumps({"report": str(REPORT), "case_count": len(rows), "passed": payload["passed"]}, indent=2))
61
+ return 0 if payload["passed"] == len(rows) else 1
62
+
63
+
64
+ if __name__ == "__main__":
65
+ raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group3/build_test_103_group3_cases.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build eight method-blind native-validated cases from the callable Test-103 pool."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import hashlib
7
+ import json
8
+ from pathlib import Path
9
+
10
+ from build_test_batch1_cases import ENV_ROOT, OUT_ROOT, ROOT, base
11
+ from promote_second_batch_cases import attach_execution_plan, attach_generation_interface, validator
12
+
13
+
14
+ PROBE_ROOTS = {
15
+ **{name: ROOT / "runs/test_103_native_curation/group3_probe_v1" / name for name in (
16
+ "blast-legacy", "python-edlib", "parasail-python", "biobambam", "pysam"
17
+ )},
18
+ **{name: ROOT / "runs/test_103_native_curation/group3_probe_v2" / name for name in (
19
+ "alfred", "ucsc-liftover", "tmalign"
20
+ )},
21
+ }
22
+ PROBE_OUTPUTS = {
23
+ "python-edlib": {"output_json": "python-edlib.json"},
24
+ "parasail-python": {"output_json": "parasail-python.json"},
25
+ "pysam": {"output_json": "pysam.json"},
26
+ }
27
+ REVIEW_JSON = ROOT / "data/curation/test_103_group3_native_review.json"
28
+ REVIEW_MD = ROOT / "reports/test_103_group3_native_review.md"
29
+
30
+
31
+ def add_interface(case: dict, executable: str, subcommand: str | None, parameters: list[dict], steps: list[dict], notes: str = "") -> None:
32
+ attach_generation_interface(case, executable, subcommand, parameters, notes)
33
+ attach_execution_plan(case, steps)
34
+
35
+
36
+ def p(name: str, binding: str, required: bool = True) -> dict:
37
+ return {"name": name, "value_type": "path", "required": required, "native_binding": binding}
38
+
39
+
40
+ def build_cases() -> list[dict]:
41
+ cases = []
42
+
43
+ env = ENV_ROOT / "alfred-0.6.2-h3752d28_0"
44
+ case = base("alfred", "0.6.2", "h3752d28_0", "pairwise_align")
45
+ case.update({"fixture_bindings": {"sequence_a": "data/fixtures/dna_reference.fa", "sequence_b": "data/fixtures/reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/alfred"), "pwalign", "-f", "h", "-a", "{output_alignment}", "{sequence_a}", "{sequence_b}"]}, "outputs": {"output_alignment": "alfred/alignment.fa.gz"}, "validators": [validator("alignment_gzip", "output_alignment", "gzip")], "semantic_oracle": {"kind": "gzip_content_equal", "target": "output_alignment"}})
46
+ add_interface(case, "alfred", "pwalign", [p("sequence_a", "positional"), p("sequence_b", "positional"), p("output_alignment", "-a")], [{"command": ["alfred", "pwalign", "-f", "h", "-a", "{output_alignment}", "{sequence_a}", "{sequence_b}"]}], "Horizontal alignment format is fixed.")
47
+ cases.append(case)
48
+
49
+ env = ENV_ROOT / "blast-legacy-2.2.26-hf7ff83a_5"
50
+ case = base("blast-legacy", "2.2.26", "hf7ff83a_5", "blastn_search")
51
+ case.update({"fixture_bindings": {"reference_fasta": "data/fixtures/dna_reference.fa", "query_fasta": "data/fixtures/dna_queries.fa"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/formatdb'} -i '{{reference_fasta}}' -p F -n '{{database_prefix}}' >/dev/null && {env / 'bin/blastall'} -p blastn -d '{{database_prefix}}' -i '{{query_fasta}}' -m 8 -F F -o '{{output_hits}}'"]}, "outputs": {"database_prefix": "blast-legacy/db", "output_hits": "blast-legacy/hits.tsv"}, "validators": [validator("hits_tsv", "output_hits", "tsv", min_columns=12), validator("hits_nonempty", "output_hits", "nonempty")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "output_hits"}, "runner_notes": "Database sidecar files derive from database_prefix."})
52
+ add_interface(case, "formatdb", None, [p("reference_fasta", "-i"), p("query_fasta", "blastall -i"), p("database_prefix", "formatdb -n"), p("output_hits", "blastall -o")], [{"command": ["formatdb", "-i", "{reference_fasta}", "-p", "F", "-n", "{database_prefix}"]}, {"command": ["blastall", "-p", "blastn", "-d", "{database_prefix}", "-i", "{query_fasta}", "-m", "8", "-F", "F", "-o", "{output_hits}"]}], "Build a nucleotide database, then emit legacy BLAST tabular format 8.")
53
+ cases.append(case)
54
+
55
+ fasta_reader = "lambda p:''.join(x.strip() for x in open(p) if not x.startswith('>'))"
56
+ env = ENV_ROOT / "python-edlib-1.3.9.post1-py310h1153794_3"
57
+ edlib_code = f"import json,edlib,sys; rd={fasta_reader}; r=edlib.align(rd(sys.argv[1]),rd(sys.argv[2]),mode='NW',task='path'); open(sys.argv[3],'w').write(json.dumps(r,sort_keys=True)+'\\n')"
58
+ case = base("python-edlib", "1.3.9.post1", "py310h1153794_3", "global_align")
59
+ case.update({"fixture_bindings": {"sequence_a": "data/fixtures/dna_reference.fa", "sequence_b": "data/fixtures/reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/python3.10"), "-c", edlib_code, "{sequence_a}", "{sequence_b}", "{output_json}"]}, "outputs": {"output_json": "python-edlib/alignment.json"}, "validators": [validator("alignment_json", "output_json", "json")], "semantic_oracle": {"kind": "json_equal", "target": "output_json"}})
60
+ add_interface(case, "python3.10", None, [p("sequence_a", "argv1"), p("sequence_b", "argv2"), p("output_json", "argv3")], [{"command": ["python3.10", "-c", edlib_code, "{sequence_a}", "{sequence_b}", "{output_json}"]}], "Invoke the pinned edlib module in NW/path mode.")
61
+ cases.append(case)
62
+
63
+ env = ENV_ROOT / "parasail-python-1.3.4-py313h5565187_6"
64
+ parasail_code = f"import json,parasail,sys; rd={fasta_reader}; r=parasail.nw_trace_striped_16(rd(sys.argv[1]),rd(sys.argv[2]),10,1,parasail.dnafull); d={{'score':r.score,'end_query':r.end_query,'end_ref':r.end_ref,'cigar':r.cigar.decode.decode()}}; open(sys.argv[3],'w').write(json.dumps(d,sort_keys=True)+'\\n')"
65
+ case = base("parasail-python", "1.3.4", "py313h5565187_6", "global_align")
66
+ case.update({"fixture_bindings": {"sequence_a": "data/fixtures/dna_reference.fa", "sequence_b": "data/fixtures/reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/python3.13"), "-c", parasail_code, "{sequence_a}", "{sequence_b}", "{output_json}"]}, "outputs": {"output_json": "parasail-python/alignment.json"}, "validators": [validator("alignment_json", "output_json", "json")], "semantic_oracle": {"kind": "json_equal", "target": "output_json"}})
67
+ add_interface(case, "python3.13", None, [p("sequence_a", "argv1"), p("sequence_b", "argv2"), p("output_json", "argv3")], [{"command": ["python3.13", "-c", parasail_code, "{sequence_a}", "{sequence_b}", "{output_json}"]}], "Invoke the pinned parasail module with NW trace, gap-open 10, gap-extension 1.")
68
+ cases.append(case)
69
+
70
+ env = ENV_ROOT / "ucsc-liftover-482-h0b57e2e_0"
71
+ case = base("ucsc-liftover", "482", "h0b57e2e_0", "lift_bed")
72
+ case.update({"fixture_bindings": {"input_bed": "data/fixtures/test_liftover_input.bed", "chain_file": "data/fixtures/test_liftover.chain"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/liftOver"), "{input_bed}", "{chain_file}", "{output_bed}", "{unmapped_bed}"]}, "outputs": {"output_bed": "ucsc-liftover/lifted.bed", "unmapped_bed": "ucsc-liftover/unmapped.bed"}, "validators": [validator("lifted_bed", "output_bed", "bed"), validator("unmapped_exists", "unmapped_bed", "exists")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "output_bed"}})
73
+ add_interface(case, "liftOver", None, [p("input_bed", "positional"), p("chain_file", "positional"), p("output_bed", "positional"), p("unmapped_bed", "positional")], [{"command": ["liftOver", "{input_bed}", "{chain_file}", "{output_bed}", "{unmapped_bed}"]}])
74
+ cases.append(case)
75
+
76
+ env = ENV_ROOT / "tmalign-20240303-hd63eeec_0"
77
+ case = base("tmalign", "20240303", "hd63eeec_0", "align_structures")
78
+ case.update({"fixture_bindings": {"structure_a": "data/fixtures/test_structure_a.pdb", "structure_b": "data/fixtures/test_structure_b.pdb"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/TMalign'} '{{structure_a}}' '{{structure_b}}' -outfmt 2 > '{{output_table}}'"]}, "outputs": {"output_table": "tmalign/summary.tsv"}, "validators": [validator("summary_nonempty", "output_table", "nonempty"), validator("perfect_score", "output_table", "regex", pattern=r"1\.0000\t1\.0000")], "semantic_oracle": {"kind": "tmalign_summary_equal", "target": "output_table"}})
79
+ add_interface(case, "TMalign", None, [p("structure_a", "positional"), p("structure_b", "positional"), p("output_table", "stdout")], [{"command": ["TMalign", "{structure_a}", "{structure_b}", "-outfmt", "2"], "capture_stdout_to": "output_table"}], "Machine-readable output format 2 is fixed; oracle ignores paths and timing comments.")
80
+ cases.append(case)
81
+
82
+ env = ENV_ROOT / "biobambam-2.0.185-hcca9a76_2"
83
+ case = base("biobambam", "2.0.185", "hcca9a76_2", "sort_bam_to_sam")
84
+ case.update({"fixture_bindings": {"input_bam": "data/fixtures/second_batch_alignments.unsorted.bam"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/bamsort"), "I={input_bam}", "O={output_sam}", "inputformat=bam", "outputformat=sam", "SO=coordinate", "verbose=0"]}, "outputs": {"output_sam": "biobambam/sorted.sam"}, "validators": [validator("sorted_sam", "output_sam", "sam")], "semantic_oracle": {"kind": "sam_records_equal", "target": "output_sam"}})
85
+ add_interface(case, "bamsort", None, [p("input_bam", "I="), p("output_sam", "O=")], [{"command": ["bamsort", {"format": "I={input_bam}"}, {"format": "O={output_sam}"}, "inputformat=bam", "outputformat=sam", "SO=coordinate", "verbose=0"]}], "Coordinate-sort and render SAM for a path-insensitive record oracle.")
86
+ cases.append(case)
87
+
88
+ env = ENV_ROOT / "pysam-0.24.0-py310h4a09ff2_1"
89
+ pysam_code = "import json,pysam,sys; b=pysam.AlignmentFile(sys.argv[1],'rb'); d={'references':list(b.references),'mapped':b.mapped,'unmapped':b.unmapped,'records':sum(1 for _ in b.fetch(until_eof=True))}; open(sys.argv[2],'w').write(json.dumps(d,sort_keys=True)+'\\n')"
90
+ case = base("pysam", "0.24.0", "py310h4a09ff2_1", "summarize_bam")
91
+ case.update({"fixture_bindings": {"input_bam": "data/fixtures/second_batch_alignments.bam", "input_bai": "data/fixtures/second_batch_alignments.bam.bai"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/python3.10"), "-c", pysam_code, "{input_bam}", "{output_json}"]}, "outputs": {"output_json": "pysam/summary.json"}, "validators": [validator("summary_json", "output_json", "json"), validator("mapped_24", "output_json", "regex", pattern=r'"mapped": 24')], "semantic_oracle": {"kind": "json_equal", "target": "output_json"}, "runner_notes": "input_bai is an implicit adjacent sidecar."})
92
+ add_interface(case, "python3.10", None, [p("input_bam", "argv1"), p("output_json", "argv2")], [{"command": ["python3.10", "-c", pysam_code, "{input_bam}", "{output_json}"]}], "Invoke pinned pysam to summarize BAM records; the BAI sidecar is implicit.")
93
+ cases.append(case)
94
+ return cases
95
+
96
+
97
+ def main() -> int:
98
+ cases = build_cases()
99
+ OUT_ROOT.mkdir(parents=True, exist_ok=True)
100
+ for case in cases:
101
+ (OUT_ROOT / f"{case['package']}.json").write_text(json.dumps(case, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
102
+ evidence = []
103
+ for case in cases:
104
+ files = [{"path": str(path.relative_to(ROOT)), "size": path.stat().st_size, "sha256": hashlib.sha256(path.read_bytes()).hexdigest()} for path in sorted(PROBE_ROOTS[case["package"]].glob("*")) if path.is_file()]
105
+ evidence.append({"package": case["package"], "case_id": case["case_id"], "endpoint": case["endpoint"], "environment": case["native"]["environment"], "native_command": case["native"]["command"], "validators": case["validators"], "semantic_oracle": case["semantic_oracle"], "outputs": files, "review_decision": "preauthorized_pending_native_repeat"})
106
+ payload = {"scope": "test_103_group3_method_blind_native_review", "case_count": len(cases), "method_generation_started": False, "blanket_preauthorized_by_user": True, "cases": evidence}
107
+ REVIEW_JSON.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
108
+ lines = ["# Test 103 group 3 native review", "", "Blanket-preauthorized; promotion still requires native repeat equality.", "", "| Package | Endpoint | Decision |", "|---|---|---|"] + [f"| {row['package']} | `{row['endpoint']}` | preauthorized, repeat pending |" for row in evidence]
109
+ REVIEW_MD.write_text("\n".join(lines) + "\n", encoding="utf-8")
110
+ print(json.dumps({"cases": len(cases), "review_json": str(REVIEW_JSON), "review_md": str(REVIEW_MD)}, indent=2))
111
+ return 0
112
+
113
+
114
+ if __name__ == "__main__":
115
+ raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group3/test_smoke.py ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import gzip
5
+ import py_compile
6
+ import tempfile
7
+ import unittest
8
+ from pathlib import Path
9
+ import sys
10
+
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ sys.path.insert(0, str(ROOT / "scripts"))
14
+
15
+ from generate_wrapper import render_wrapper, validate_ir_minimal # noqa: E402
16
+ from run_experiment import materialize_case, substitute_command # noqa: E402
17
+ from validators import compare_oracle, validate_all # noqa: E402
18
+
19
+
20
+ class ExperimentOneSmokeTests(unittest.TestCase):
21
+ def test_example_ir_generates_compilable_python(self) -> None:
22
+ ir = json.loads((ROOT / "examples" / "seqkit_stats.contract.json").read_text())
23
+ self.assertEqual(validate_ir_minimal(ir), [])
24
+ code = render_wrapper(ir)
25
+ self.assertIn("@mcp.tool()", code)
26
+ with tempfile.TemporaryDirectory() as temp:
27
+ path = Path(temp) / "server.py"
28
+ path.write_text(code)
29
+ py_compile.compile(str(path), doraise=True)
30
+
31
+ def test_tsv_validator_and_oracle(self) -> None:
32
+ with tempfile.TemporaryDirectory() as temp:
33
+ root = Path(temp)
34
+ native = root / "native.tsv"
35
+ mcp = root / "mcp.tsv"
36
+ native.write_text("a\tb\n1\t2\n")
37
+ mcp.write_text("a\tb\n1\t2\n")
38
+ spec = [{"name": "tsv", "target": "out", "kind": "tsv", "config": {"min_columns": 2}}]
39
+ ok, details = validate_all(spec, {"out": mcp})
40
+ self.assertTrue(ok, details)
41
+ oracle = compare_oracle({"kind": "normalized_text_equal", "target": "out"}, {"out": native}, {"out": mcp})
42
+ self.assertTrue(oracle["ok"])
43
+
44
+ def test_tsv_oracle_can_ignore_path_column(self) -> None:
45
+ with tempfile.TemporaryDirectory() as temp:
46
+ root = Path(temp)
47
+ native = root / "native.tsv"
48
+ mcp = root / "mcp.tsv"
49
+ native.write_text("/tmp/native/input.fa\t1\t40\n")
50
+ mcp.write_text("/tmp/mcp/input.fa\t1\t40\n")
51
+ oracle = compare_oracle(
52
+ {"kind": "tsv_equal_ignore_columns", "target": "out", "ignore_columns": [0]},
53
+ {"out": native},
54
+ {"out": mcp},
55
+ )
56
+ self.assertTrue(oracle["ok"])
57
+
58
+ def test_noncomment_oracle_ignores_command_header(self) -> None:
59
+ with tempfile.TemporaryDirectory() as temp:
60
+ root = Path(temp)
61
+ native = root / "native.gtf"
62
+ mcp = root / "mcp.gtf"
63
+ record = 'chr1\ttool\ttranscript\t1\t10\t.\t+\t.\tgene_id "g1";\n'
64
+ native.write_text("# native /tmp/a\n" + record)
65
+ mcp.write_text("# mcp /tmp/b\n" + record)
66
+ oracle = compare_oracle(
67
+ {"kind": "normalized_noncomment_text_equal", "target": "out"},
68
+ {"out": native},
69
+ {"out": mcp},
70
+ )
71
+ self.assertTrue(oracle["ok"])
72
+
73
+ def test_featurecounts_oracle_normalizes_input_path_header(self) -> None:
74
+ with tempfile.TemporaryDirectory() as temp:
75
+ root = Path(temp)
76
+ native = root / "native.txt"
77
+ mcp = root / "mcp.txt"
78
+ native.write_text("# command native\nGeneid\t/tmp/native/in.bam\ngeneA\t12\n")
79
+ mcp.write_text("# command mcp\nGeneid\t/tmp/mcp/in.bam\ngeneA\t12\n")
80
+ oracle = compare_oracle(
81
+ {"kind": "featurecounts_table_equal", "target": "out"},
82
+ {"out": native},
83
+ {"out": mcp},
84
+ )
85
+ self.assertTrue(oracle["ok"])
86
+
87
+ def test_binary_oracle_compares_exact_bytes(self) -> None:
88
+ with tempfile.TemporaryDirectory() as temp:
89
+ root = Path(temp)
90
+ native = root / "native.bin"
91
+ mcp = root / "mcp.bin"
92
+ native.write_bytes(b"\x00\x01\xff")
93
+ mcp.write_bytes(b"\x00\x01\xff")
94
+ oracle = compare_oracle(
95
+ {"kind": "binary_equal", "target": "out"},
96
+ {"out": native},
97
+ {"out": mcp},
98
+ )
99
+ self.assertTrue(oracle["ok"])
100
+
101
+ def test_sam_validator_ignores_header_records(self) -> None:
102
+ with tempfile.TemporaryDirectory() as temp:
103
+ output = Path(temp) / "output.sam"
104
+ output.write_text(
105
+ "@HD\tVN:1.6\tSO:queryname\n"
106
+ "@SQ\tSN:chr1\tLN:100\n"
107
+ "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
108
+ )
109
+ ok, details = validate_all(
110
+ [{"name": "sam", "target": "out", "kind": "sam", "config": {}}],
111
+ {"out": output},
112
+ )
113
+ self.assertTrue(ok, details)
114
+
115
+ def test_gzip_validator_and_content_oracle(self) -> None:
116
+ with tempfile.TemporaryDirectory() as temp:
117
+ root = Path(temp)
118
+ native = root / "native.gz"
119
+ mcp = root / "mcp.gz"
120
+ with gzip.open(native, "wb") as handle:
121
+ handle.write(b">seq\nACGT\n")
122
+ with gzip.open(mcp, "wb") as handle:
123
+ handle.write(b">seq\nACGT\n")
124
+ ok, details = validate_all(
125
+ [{"name": "gzip", "target": "out", "kind": "gzip", "config": {}}],
126
+ {"out": mcp},
127
+ )
128
+ self.assertTrue(ok, details)
129
+ oracle = compare_oracle(
130
+ {"kind": "gzip_content_equal", "target": "out"},
131
+ {"out": native},
132
+ {"out": mcp},
133
+ )
134
+ self.assertTrue(oracle["ok"])
135
+
136
+ def test_sam_record_oracle_ignores_headers(self) -> None:
137
+ with tempfile.TemporaryDirectory() as temp:
138
+ root = Path(temp)
139
+ native = root / "native.sam"
140
+ mcp = root / "mcp.sam"
141
+ record = "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
142
+ native.write_text("@PG\tID:native\tCL:/tmp/native\n" + record)
143
+ mcp.write_text("@PG\tID:mcp\tCL:/tmp/mcp\n" + record)
144
+ oracle = compare_oracle(
145
+ {"kind": "sam_records_equal", "target": "out"},
146
+ {"out": native},
147
+ {"out": mcp},
148
+ )
149
+ self.assertTrue(oracle["ok"])
150
+
151
+ def test_tmalign_summary_oracle_ignores_paths_and_comments(self) -> None:
152
+ with tempfile.TemporaryDirectory() as temp:
153
+ root = Path(temp)
154
+ native = root / "native.tsv"
155
+ mcp = root / "mcp.tsv"
156
+ native.write_text("#header\n/a.pdb\t/b.pdb\t1.0000\t0.00\n#Total CPU time is 0.01\n")
157
+ mcp.write_text("#header\n/x.pdb\t/y.pdb\t1.0000\t0.00\n#Total CPU time is 0.02\n")
158
+ oracle = compare_oracle(
159
+ {"kind": "tmalign_summary_equal", "target": "out"},
160
+ {"out": native},
161
+ {"out": mcp},
162
+ )
163
+ self.assertTrue(oracle["ok"])
164
+
165
+ def test_fixture_binding_can_materialize_path_list(self) -> None:
166
+ with tempfile.TemporaryDirectory() as temp:
167
+ root = Path(temp)
168
+ fixture = root / "input.fa"
169
+ fixture.write_text(">seq\nACGT\n")
170
+ workdir = root / "work"
171
+ workdir.mkdir()
172
+ case = {
173
+ "fixture_bindings": {
174
+ "files": {"path": "input.fa", "argument_mode": "list"}
175
+ }
176
+ }
177
+ bindings, arguments = materialize_case(case, root, workdir)
178
+ self.assertEqual(bindings["files"], workdir / "input.fa")
179
+ self.assertEqual(arguments["files"], [str(workdir / "input.fa")])
180
+
181
+ def test_endpoint_argument_allowlist_keeps_sidecars_out_of_mcp_call(self) -> None:
182
+ with tempfile.TemporaryDirectory() as temp:
183
+ root = Path(temp)
184
+ (root / "input.bam").write_bytes(b"bam")
185
+ (root / "input.bam.bai").write_bytes(b"bai")
186
+ workdir = root / "work"
187
+ workdir.mkdir()
188
+ case = {
189
+ "endpoint_arguments": ["input_bam", "output_table"],
190
+ "fixture_bindings": {
191
+ "input_bam": "input.bam",
192
+ "input_bai": "input.bam.bai",
193
+ },
194
+ "outputs": {"output_table": "result.txt"},
195
+ }
196
+ bindings, arguments = materialize_case(case, root, workdir)
197
+ self.assertIn("input_bai", bindings)
198
+ self.assertNotIn("input_bai", arguments)
199
+ self.assertEqual(set(arguments), {"input_bam", "output_table"})
200
+
201
+ def test_contract_template_can_capture_stdout_to_output_argument(self) -> None:
202
+ ir = {
203
+ "ir_version": "0.1",
204
+ "tool": {"executable": "tool", "subcommand": None},
205
+ "endpoint": {"name": "run_tool", "description": "test"},
206
+ "arguments": [
207
+ {"name": "input_file", "flag": "-i", "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "input"},
208
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "captured output", "pass_to_cli": False},
209
+ ],
210
+ "inputs": [],
211
+ "outputs": [{"name": "output", "artifact_type": "text", "binding": "output_file", "capture": "stdout", "assertions": []}],
212
+ "validators": [],
213
+ "evidence": [],
214
+ }
215
+ code = render_wrapper(ir)
216
+ self.assertIn("Path(output_file).write_text(completed.stdout", code)
217
+ self.assertNotIn("_append_value(command, None, output_file)", code)
218
+
219
+ def test_contract_template_can_capture_binary_stdout(self) -> None:
220
+ ir = {
221
+ "ir_version": "0.1",
222
+ "tool": {"executable": "bgzip", "subcommand": None},
223
+ "endpoint": {"name": "compress", "description": "test"},
224
+ "arguments": [
225
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input"},
226
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
227
+ ],
228
+ "inputs": [],
229
+ "outputs": [{"name": "output", "artifact_type": "file", "binding": "output_file", "assertions": []}],
230
+ "validators": [],
231
+ "evidence": [],
232
+ "execution_plan": {"steps": [{"command": ["bgzip", "-c", "{input_file}"], "capture_stdout_to": "output_file", "stdout_mode": "binary"}]},
233
+ }
234
+ code = render_wrapper(ir)
235
+ self.assertIn("text=False", code)
236
+ self.assertIn("Path(output_file).write_bytes", code)
237
+ with tempfile.TemporaryDirectory() as temp:
238
+ path = Path(temp) / "server.py"
239
+ path.write_text(code)
240
+ py_compile.compile(str(path), doraise=True)
241
+
242
+ def test_native_command_substitution_includes_scalar_arguments(self) -> None:
243
+ command = substitute_command(
244
+ ["tabix", "{input_file}", "{region}"],
245
+ {"input_file": Path("input.vcf.gz"), "region": "chrTiny:1-10"},
246
+ )
247
+ self.assertEqual(command, ["tabix", "input.vcf.gz", "chrTiny:1-10"])
248
+
249
+ def test_execution_plan_format_token_supports_multiple_arguments(self) -> None:
250
+ ir = {
251
+ "ir_version": "0.1",
252
+ "tool": {"executable": "mothur", "subcommand": None},
253
+ "endpoint": {"name": "summarize", "description": "test"},
254
+ "arguments": [
255
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input", "pass_to_cli": False},
256
+ {"name": "output_dir", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
257
+ ],
258
+ "inputs": [],
259
+ "outputs": [],
260
+ "validators": [],
261
+ "evidence": [],
262
+ "execution_plan": {"steps": [{"command": ["mothur", {"format": "#set.dir(output={output_dir}); summary.seqs(fasta={input_file})"}]}]},
263
+ }
264
+ code = render_wrapper(ir)
265
+ self.assertIn("str(output_dir)", code)
266
+ self.assertIn("str(input_file)", code)
267
+ with tempfile.TemporaryDirectory() as temp:
268
+ path = Path(temp) / "server.py"
269
+ path.write_text(code)
270
+ py_compile.compile(str(path), doraise=True)
271
+
272
+
273
+ if __name__ == "__main__":
274
+ unittest.main()
Biomanus-V2/Experiment1/.sync_stage_group3/validators.py ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import gzip
5
+ import json
6
+ import os
7
+ import re
8
+ import shutil
9
+ import subprocess
10
+ from pathlib import Path
11
+ from typing import Any
12
+
13
+
14
+ def _noncomment_lines(path: Path) -> list[str]:
15
+ return [line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")]
16
+
17
+
18
+ def validate_one(spec: dict[str, Any], bindings: dict[str, Path]) -> dict[str, Any]:
19
+ target = spec["target"]
20
+ path = bindings.get(target)
21
+ kind = spec["kind"]
22
+ config = spec.get("config") or {}
23
+ result = {"name": spec.get("name", kind), "target": target, "kind": kind, "ok": False, "detail": ""}
24
+ if path is None:
25
+ result["detail"] = "target binding missing"
26
+ return result
27
+ try:
28
+ if kind == "exists":
29
+ result["ok"] = path.exists()
30
+ elif kind == "nonempty":
31
+ result["ok"] = path.is_file() and path.stat().st_size > 0
32
+ elif kind == "json":
33
+ json.loads(path.read_text(encoding="utf-8")); result["ok"] = True
34
+ elif kind in {"csv", "tsv"}:
35
+ delimiter = "," if kind == "csv" else "\t"
36
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
37
+ rows = list(csv.reader(handle, delimiter=delimiter))
38
+ minimum = int(config.get("min_columns", 1))
39
+ result["ok"] = bool(rows) and all(len(row) >= minimum for row in rows)
40
+ result["detail"] = f"rows={len(rows)}"
41
+ elif kind == "fasta":
42
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
43
+ result["ok"] = bool(lines) and lines[0].startswith(">") and any(line and not line.startswith(">") for line in lines)
44
+ elif kind == "maf":
45
+ rows = _noncomment_lines(path)
46
+ result["ok"] = any(row.startswith("a ") for row in rows) and any(row.startswith("s ") for row in rows)
47
+ elif kind == "fastq":
48
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
49
+ result["ok"] = len(lines) >= 4 and len(lines) % 4 == 0 and lines[0].startswith("@") and lines[2].startswith("+")
50
+ elif kind == "bed":
51
+ rows = _noncomment_lines(path)
52
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 3 for row in rows)
53
+ elif kind == "sam":
54
+ rows = [
55
+ line
56
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
57
+ if line and not line.startswith("@")
58
+ ]
59
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 11 for row in rows)
60
+ elif kind == "gzip":
61
+ with gzip.open(path, "rb") as handle:
62
+ handle.read(1)
63
+ result["ok"] = True
64
+ elif kind == "vcf":
65
+ text = path.read_text(encoding="utf-8", errors="replace")
66
+ rows = [line for line in text.splitlines() if line and not line.startswith("#")]
67
+ result["ok"] = "##fileformat=VCF" in text and "#CHROM" in text and all(len(row.split("\t")) >= 8 for row in rows)
68
+ elif kind == "regex":
69
+ result["ok"] = re.search(str(config["pattern"]), path.read_text(encoding="utf-8", errors="replace"), re.MULTILINE) is not None
70
+ else:
71
+ result["detail"] = f"validator kind not implemented: {kind}"
72
+ return result
73
+ except Exception as exc:
74
+ result["detail"] = f"{type(exc).__name__}: {exc}"
75
+ return result
76
+ if not result["detail"]:
77
+ result["detail"] = str(path)
78
+ return result
79
+
80
+
81
+ def validate_all(specs: list[dict[str, Any]], bindings: dict[str, Path]) -> tuple[bool, list[dict[str, Any]]]:
82
+ results = [validate_one(spec, bindings) for spec in specs]
83
+ return bool(results) and all(item["ok"] for item in results), results
84
+
85
+
86
+ def normalized_text(path: Path) -> str:
87
+ return "\n".join(line.rstrip() for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line.strip())
88
+
89
+
90
+ def normalized_bcf_records(path: Path, spec: dict[str, Any]) -> list[str]:
91
+ executable = spec.get("bcftools_executable") or os.getenv("BCFTOOLS") or shutil.which("bcftools")
92
+ if not executable:
93
+ candidates = (
94
+ "/225040511/miniconda3/envs/bioenv/bin/bcftools",
95
+ "/225040511/miniconda3/envs/bioenv_cli/bin/bcftools",
96
+ "/225040511/miniconda3/envs/biomni_e1/bin/bcftools",
97
+ )
98
+ executable = next((candidate for candidate in candidates if Path(candidate).is_file()), None)
99
+ if not executable:
100
+ raise RuntimeError("bcftools executable not found")
101
+ completed = subprocess.run(
102
+ [str(executable), "view", "-H", str(path)],
103
+ text=True,
104
+ capture_output=True,
105
+ timeout=60,
106
+ )
107
+ if completed.returncode != 0:
108
+ raise RuntimeError(completed.stderr[-2000:] or "bcftools could not parse BCF")
109
+ return sorted(line.rstrip() for line in completed.stdout.splitlines() if line.strip())
110
+
111
+
112
+ def fasta_records(path: Path) -> dict[str, str]:
113
+ records: dict[str, str] = {}
114
+ name: str | None = None
115
+ chunks: list[str] = []
116
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
117
+ if line.startswith(">"):
118
+ if name is not None:
119
+ records[name] = "".join(chunks).replace(" ", "").upper()
120
+ name = line[1:].strip().split()[0]
121
+ chunks = []
122
+ elif line.strip():
123
+ chunks.append(line.strip())
124
+ if name is not None:
125
+ records[name] = "".join(chunks).replace(" ", "").upper()
126
+ return records
127
+
128
+
129
+ def maf_semantic_rows(path: Path) -> list[str]:
130
+ return [
131
+ " ".join(line.split())
132
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
133
+ if line.startswith(("a ", "s ", "i ", "e ", "q "))
134
+ ]
135
+
136
+
137
+ def compare_oracle(spec: dict[str, Any], native: dict[str, Path], mcp: dict[str, Path]) -> dict[str, Any]:
138
+ kind = spec.get("kind")
139
+ target = spec.get("target")
140
+ left, right = native.get(target), mcp.get(target)
141
+ result = {"kind": kind, "target": target, "ok": False, "detail": ""}
142
+ if left is None or right is None or not left.exists() or not right.exists():
143
+ result["detail"] = "oracle target missing"
144
+ return result
145
+ try:
146
+ if kind == "normalized_text_equal":
147
+ result["ok"] = normalized_text(left) == normalized_text(right)
148
+ elif kind == "normalized_noncomment_text_equal":
149
+ def noncomment_text(path: Path) -> str:
150
+ return "\n".join(
151
+ line.rstrip()
152
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
153
+ if line.strip() and not line.startswith("#")
154
+ )
155
+
156
+ result["ok"] = noncomment_text(left) == noncomment_text(right)
157
+ elif kind == "json_equal":
158
+ result["ok"] = json.loads(left.read_text()) == json.loads(right.read_text())
159
+ elif kind == "record_count_equal":
160
+ result["ok"] = len(_noncomment_lines(left)) == len(_noncomment_lines(right))
161
+ elif kind == "bcf_records_equal":
162
+ result["ok"] = normalized_bcf_records(left, spec) == normalized_bcf_records(right, spec)
163
+ elif kind == "fasta_records_equal":
164
+ result["ok"] = fasta_records(left) == fasta_records(right)
165
+ elif kind == "maf_records_equal":
166
+ result["ok"] = maf_semantic_rows(left) == maf_semantic_rows(right)
167
+ elif kind == "vcf_records_equal":
168
+ result["ok"] = _noncomment_lines(left) == _noncomment_lines(right)
169
+ elif kind == "tsv_equal_ignore_columns":
170
+ ignored = {int(value) for value in spec.get("ignore_columns", [])}
171
+
172
+ def projected(path: Path) -> list[list[str]]:
173
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
174
+ return [
175
+ [value for index, value in enumerate(row) if index not in ignored]
176
+ for row in csv.reader(handle, delimiter="\t")
177
+ ]
178
+
179
+ result["ok"] = projected(left) == projected(right)
180
+ elif kind == "featurecounts_table_equal":
181
+ def featurecounts_rows(path: Path) -> list[list[str]]:
182
+ rows = [
183
+ row for row in csv.reader(
184
+ (line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")),
185
+ delimiter="\t",
186
+ )
187
+ ]
188
+ if rows and rows[0]:
189
+ rows[0][-1] = Path(rows[0][-1]).name
190
+ return rows
191
+
192
+ result["ok"] = featurecounts_rows(left) == featurecounts_rows(right)
193
+ elif kind == "normalized_lines_equal_unordered":
194
+ def normalized_lines(path: Path) -> list[str]:
195
+ return sorted(
196
+ " ".join(line.split())
197
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
198
+ if line.strip()
199
+ )
200
+
201
+ result["ok"] = normalized_lines(left) == normalized_lines(right)
202
+ elif kind == "binary_equal":
203
+ result["ok"] = left.read_bytes() == right.read_bytes()
204
+ elif kind == "gzip_content_equal":
205
+ with gzip.open(left, "rb") as left_handle, gzip.open(right, "rb") as right_handle:
206
+ result["ok"] = left_handle.read() == right_handle.read()
207
+ elif kind == "sam_records_equal":
208
+ def sam_records(path: Path) -> list[str]:
209
+ return [
210
+ line.rstrip()
211
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
212
+ if line and not line.startswith("@")
213
+ ]
214
+
215
+ result["ok"] = sam_records(left) == sam_records(right)
216
+ elif kind == "tmalign_summary_equal":
217
+ def tmalign_summary(path: Path) -> list[str]:
218
+ rows = []
219
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
220
+ if not line or line.startswith("#"):
221
+ continue
222
+ fields = line.split("\t")
223
+ rows.append("\t".join(fields[2:]) if len(fields) >= 3 else line)
224
+ return rows
225
+
226
+ result["ok"] = tmalign_summary(left) == tmalign_summary(right)
227
+ else:
228
+ result["detail"] = f"oracle kind not implemented: {kind}"
229
+ return result
230
+ except Exception as exc:
231
+ result["detail"] = f"{type(exc).__name__}: {exc}"
232
+ return result
233
+ result["detail"] = f"native={left}; mcp={right}"
234
+ return result
Biomanus-V2/Experiment1/.sync_stage_group3/verify_native_group_repeat.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Repeat a native curation group and compare it with its first-pass probes."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import importlib
8
+ import json
9
+ import os
10
+ import subprocess
11
+ from pathlib import Path
12
+
13
+ from run_experiment import environment_for_case, materialize_case, substitute_command
14
+ from validators import compare_oracle, validate_all
15
+
16
+
17
+ def probe_bindings(case: dict, probe_root: Path, overrides: dict[str, str] | None = None) -> dict[str, Path]:
18
+ bindings = {}
19
+ overrides = overrides or {}
20
+ for name, relative in case["outputs"].items():
21
+ if name in overrides:
22
+ bindings[name] = probe_root / overrides[name]
23
+ continue
24
+ parts = Path(relative).parts
25
+ candidate = probe_root.joinpath(*parts[1:]) if parts and parts[0] == case["package"] else probe_root / relative
26
+ bindings[name] = candidate
27
+ return bindings
28
+
29
+
30
+ def main() -> int:
31
+ parser = argparse.ArgumentParser()
32
+ parser.add_argument("--builder-module", required=True)
33
+ parser.add_argument("--repeat-root", type=Path, required=True)
34
+ parser.add_argument("--report", type=Path, required=True)
35
+ args = parser.parse_args()
36
+ module = importlib.import_module(args.builder_module)
37
+ root: Path = module.ROOT
38
+ repeat_root = args.repeat_root if args.repeat_root.is_absolute() else root / args.repeat_root
39
+ report = args.report if args.report.is_absolute() else root / args.report
40
+ if repeat_root.exists():
41
+ raise SystemExit(f"repeat output already exists: {repeat_root}")
42
+ repeat_root.mkdir(parents=True)
43
+ rows = []
44
+ for case in module.build_cases():
45
+ workdir = repeat_root / case["package"]
46
+ workdir.mkdir()
47
+ bindings, arguments = materialize_case(case, root, workdir)
48
+ command = substitute_command(case["native"]["command"], {**bindings, **arguments})
49
+ env = environment_for_case(case, os.environ)
50
+ completed = subprocess.run(command, cwd=workdir, env=env, text=True, capture_output=True, timeout=300)
51
+ validators_ok, details = validate_all(case["validators"], bindings)
52
+ overrides = getattr(module, "PROBE_OUTPUTS", {}).get(case["package"], {})
53
+ oracle = compare_oracle(case["semantic_oracle"], probe_bindings(case, module.PROBE_ROOTS[case["package"]], overrides), bindings)
54
+ ok = completed.returncode == 0 and validators_ok and oracle["ok"]
55
+ rows.append({"package": case["package"], "case_id": case["case_id"], "ok": ok, "returncode": completed.returncode, "validators_ok": validators_ok, "validators": details, "oracle": oracle, "stdout_tail": completed.stdout[-2000:], "stderr_tail": completed.stderr[-2000:]})
56
+ print(json.dumps({"package": case["package"], "ok": ok, "returncode": completed.returncode, "validators_ok": validators_ok, "oracle_ok": oracle["ok"]}))
57
+ payload = {"case_count": len(rows), "passed": sum(row["ok"] for row in rows), "cases": rows}
58
+ report.parent.mkdir(parents=True, exist_ok=True)
59
+ report.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
60
+ print(json.dumps({"report": str(report), "case_count": len(rows), "passed": payload["passed"]}, indent=2))
61
+ return 0 if payload["passed"] == len(rows) else 1
62
+
63
+
64
+ if __name__ == "__main__":
65
+ raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group5/build_test_103_group5_cases.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build seven native-validated cases for callable Test-103 group five."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import hashlib
7
+ import json
8
+
9
+ from build_test_batch1_cases import ENV_ROOT, OUT_ROOT, ROOT, base
10
+ from promote_second_batch_cases import attach_execution_plan, attach_generation_interface, validator
11
+
12
+ PROBE_ROOTS = {
13
+ **{name: ROOT / "runs/test_103_native_curation/group5_probe_v1" / name for name in ("fastani", "infernal", "taxonkit", "krona", "trnascan-se", "gseapy")},
14
+ "paml": ROOT / "runs/test_103_native_curation/group5_probe_v3/paml",
15
+ }
16
+ REVIEW_JSON = ROOT / "data/curation/test_103_group5_native_review.json"
17
+ REVIEW_MD = ROOT / "reports/test_103_group5_native_review.md"
18
+
19
+
20
+ def p(name: str, binding: str) -> dict:
21
+ return {"name": name, "value_type": "path", "required": True, "native_binding": binding}
22
+
23
+
24
+ def add(case: dict, executable: str, subcommand: str | None, params: list[dict], steps: list[dict], notes: str = "") -> None:
25
+ attach_generation_interface(case, executable, subcommand, params, notes); attach_execution_plan(case, steps)
26
+
27
+
28
+ def build_cases() -> list[dict]:
29
+ cases = []
30
+
31
+ env = ENV_ROOT / "fastani-1.34-hb66fcc3_7"
32
+ case = base("fastani", "1.34", "hb66fcc3_7", "compute_ani")
33
+ case.update({"fixture_bindings": {"query_fasta": "data/fixtures/test_nextalign_query.fa", "reference_fasta": "data/fixtures/test_nextalign_reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/fastANI"), "-q", "{query_fasta}", "-r", "{reference_fasta}", "--fragLen", "100", "-t", "1", "-o", "{output_table}"]}, "outputs": {"output_table": "fastani/ani.tsv"}, "validators": [validator("ani_nonempty", "output_table", "nonempty"), validator("ani_100", "output_table", "regex", pattern=r"\t100\t2\t2$")], "semantic_oracle": {"kind": "tsv_equal_ignore_columns", "target": "output_table", "ignore_columns": [0, 1]}})
34
+ add(case, "fastANI", None, [p("query_fasta", "-q"), p("reference_fasta", "-r"), p("output_table", "-o")], [{"command": ["fastANI", "-q", "{query_fasta}", "-r", "{reference_fasta}", "--fragLen", "100", "-t", "1", "-o", "{output_table}"]}], "Fragment length 100 and one thread are fixed; path columns are ignored by the oracle.")
35
+ cases.append(case)
36
+
37
+ env = ENV_ROOT / "infernal-1.1.5-pl5321h7b50bb2_4"
38
+ case = base("infernal", "1.1.5", "pl5321h7b50bb2_4", "build_and_align_cm")
39
+ case.update({"fixture_bindings": {"training_alignment": "data/fixtures/test_rna_multi.fa", "query_fasta": "data/fixtures/test_rna_a.fa"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/cmbuild'} --noss -F '{{output_cm}}' '{{training_alignment}}' >/dev/null && {env / 'bin/cmalign'} -o '{{output_stockholm}}' '{{output_cm}}' '{{query_fasta}}' >/dev/null"]}, "outputs": {"output_cm": "infernal/model.cm", "output_stockholm": "infernal/aligned.sto"}, "validators": [validator("cm_nonempty", "output_cm", "nonempty"), validator("stockholm_nonempty", "output_stockholm", "nonempty"), validator("stockholm_format", "output_stockholm", "regex", pattern=r"^# STOCKHOLM")], "semantic_oracle": {"kind": "normalized_noncomment_text_equal", "target": "output_stockholm"}})
40
+ add(case, "cmbuild", None, [p("training_alignment", "cmbuild positional"), p("query_fasta", "cmalign positional"), p("output_cm", "cmbuild positional"), p("output_stockholm", "cmalign -o")], [{"command": ["cmbuild", "--noss", "-F", "{output_cm}", "{training_alignment}"]}, {"command": ["cmalign", "-o", "{output_stockholm}", "{output_cm}", "{query_fasta}"]}], "Build without secondary-structure annotation, then align the query.")
41
+ cases.append(case)
42
+
43
+ env = ENV_ROOT / "taxonkit-0.20.0-h9ee0642_1"
44
+ case = base("taxonkit", "0.20.0", "h9ee0642_1", "create_taxdump")
45
+ case.update({"fixture_bindings": {"taxonomy_tsv": "data/fixtures/test_taxonomy.tsv"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/taxonkit"), "create-taxdump", "-A", "4", "-O", "{output_dir}", "--force", "{taxonomy_tsv}"]}, "outputs": {"output_dir": "taxonkit/taxdump", "nodes_file": "taxonkit/taxdump/nodes.dmp", "names_file": "taxonkit/taxdump/names.dmp", "taxid_map": "taxonkit/taxdump/taxid.map"}, "validators": [validator("nodes_nonempty", "nodes_file", "nonempty"), validator("names_nonempty", "names_file", "nonempty"), validator("map_nonempty", "taxid_map", "nonempty")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "nodes_file"}, "runner_notes": "Taxdump files derive under output_dir."})
46
+ add(case, "taxonkit", "create-taxdump", [p("taxonomy_tsv", "positional"), p("output_dir", "-O")], [{"command": ["taxonkit", "create-taxdump", "-A", "4", "-O", "{output_dir}", "--force", "{taxonomy_tsv}"]}], "The fourth TSV field is the accession; force only applies to the fresh output directory.")
47
+ cases.append(case)
48
+
49
+ env = ENV_ROOT / "krona-2.7.1-pl526_0"
50
+ case = base("krona", "2.7.1", "pl526_0", "taxonomy_chart")
51
+ case.update({"fixture_bindings": {"input_table": "data/fixtures/test_krona.tsv"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/ktImportText"), "-o", "{output_html}", "{input_table}"]}, "outputs": {"output_html": "krona/taxonomy.html"}, "validators": [validator("html_nonempty", "output_html", "nonempty"), validator("krona_html", "output_html", "regex", pattern=r"Krona")], "semantic_oracle": {"kind": "krona_tree_equal", "target": "output_html"}})
52
+ add(case, "ktImportText", None, [p("input_table", "positional"), p("output_html", "-o")], [{"command": ["ktImportText", "-o", "{output_html}", "{input_table}"]}])
53
+ cases.append(case)
54
+
55
+ env = ENV_ROOT / "trnascan-se-2.0.13-pl5321hab16a5f_0"
56
+ case = base("trnascan-se", "2.0.13", "pl5321hab16a5f_0", "scan_trna")
57
+ case.update({"fixture_bindings": {"input_fasta": "data/fixtures/test_trna.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/tRNAscan-SE"), "-G", "-o", "{output_table}", "-m", "{stats_file}", "-q", "{input_fasta}"]}, "outputs": {"output_table": "trnascan-se/trnas.tsv", "stats_file": "trnascan-se/stats.txt"}, "validators": [validator("trna_table_nonempty", "output_table", "nonempty"), validator("trna_hit", "output_table", "regex", pattern=r"synthetic_tRNA_Phe"), validator("stats_nonempty", "stats_file", "nonempty")], "semantic_oracle": {"kind": "normalized_noncomment_text_equal", "target": "output_table"}})
58
+ add(case, "tRNAscan-SE", None, [p("input_fasta", "positional"), p("output_table", "-o"), p("stats_file", "-m")], [{"command": ["tRNAscan-SE", "-G", "-o", "{output_table}", "-m", "{stats_file}", "-q", "{input_fasta}"]}], "General model and quiet mode are fixed.")
59
+ cases.append(case)
60
+
61
+ env = ENV_ROOT / "paml-4.10.10-h87e0c26_2"
62
+ shell = "cp '{input_sequences}' '{control_file}.seq' && cd \"$(dirname '{control_file}')\" && printf 'seqfile = yn00.ctl.seq\\noutfile = results.txt\\nverbose = 0\\nicode = 0\\nweighting = 0\\ncommonf3x4 = 0\\n' > yn00.ctl && yn00 yn00.ctl >/dev/null"
63
+ case = base("paml", "4.10.10", "h87e0c26_2", "pairwise_dn_ds")
64
+ case.update({"fixture_bindings": {"input_sequences": "data/fixtures/test_paml_coding.phy"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", shell.replace("yn00 ", f"{env / 'bin/yn00'} ")]}, "outputs": {"control_file": "paml/yn00.ctl", "output_results": "paml/results.txt", "output_dn": "paml/2YN.dN"}, "validators": [validator("results_nonempty", "output_results", "nonempty"), validator("dn_nonempty", "output_dn", "nonempty"), validator("sequence_names", "output_results", "regex", pattern=r"seqB")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "output_dn"}})
65
+ add(case, "yn00", None, [p("input_sequences", "ctl seqfile"), p("control_file", "ctl path"), p("output_results", "ctl outfile"), p("output_dn", "copied 2YN.dN")], [{"command": ["bash", "-lc", {"format": shell}]}], "A deterministic control file is materialized; the dN matrix is copied to the declared output.")
66
+ cases.append(case)
67
+
68
+ env = ENV_ROOT / "gseapy-1.3.1-py313h551aa79_0"
69
+ case = base("gseapy", "1.3.1", "py313h551aa79_0", "prerank_gene_sets")
70
+ case.update({"fixture_bindings": {"ranking_file": "data/fixtures/test_gseapy.rnk", "gene_sets": "data/fixtures/test_gseapy.gmt"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/gseapy"), "prerank", "-r", "{ranking_file}", "-g", "{gene_sets}", "-o", "{output_dir}", "--no-plot", "-n", "20", "--min-size", "2", "--max-size", "20", "-s", "1", "-p", "1"]}, "outputs": {"output_dir": "gseapy/results", "report_csv": "gseapy/results/gseapy.gene_set.prerank.report.csv"}, "validators": [validator("report_nonempty", "report_csv", "nonempty"), validator("report_csv", "report_csv", "csv", min_columns=5), validator("up_set", "report_csv", "regex", pattern=r"UP_SET")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "report_csv"}, "runner_notes": "report_csv derives inside output_dir."})
71
+ add(case, "gseapy", "prerank", [p("ranking_file", "-r"), p("gene_sets", "-g"), p("output_dir", "-o")], [{"command": ["gseapy", "prerank", "-r", "{ranking_file}", "-g", "{gene_sets}", "-o", "{output_dir}", "--no-plot", "-n", "20", "--min-size", "2", "--max-size", "20", "-s", "1", "-p", "1"]}], "No plots, 20 permutations, seed 1, and one thread are fixed.")
72
+ cases.append(case)
73
+ return cases
74
+
75
+
76
+ def main() -> int:
77
+ cases = build_cases(); OUT_ROOT.mkdir(parents=True, exist_ok=True)
78
+ for case in cases: (OUT_ROOT / f"{case['package']}.json").write_text(json.dumps(case, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
79
+ evidence = []
80
+ for case in cases:
81
+ files = [{"path": str(path.relative_to(ROOT)), "size": path.stat().st_size, "sha256": hashlib.sha256(path.read_bytes()).hexdigest()} for path in sorted(PROBE_ROOTS[case["package"]].rglob("*")) if path.is_file()]
82
+ evidence.append({"package": case["package"], "case_id": case["case_id"], "endpoint": case["endpoint"], "environment": case["native"]["environment"], "native_command": case["native"]["command"], "validators": case["validators"], "semantic_oracle": case["semantic_oracle"], "outputs": files, "review_decision": "preauthorized_pending_native_repeat"})
83
+ payload = {"scope": "test_103_group5_method_blind_native_review", "case_count": len(cases), "method_generation_started": False, "blanket_preauthorized_by_user": True, "cases": evidence}; REVIEW_JSON.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
84
+ lines = ["# Test 103 group 5 native review", "", "Blanket-preauthorized; promotion still requires native repeat equality.", "", "| Package | Endpoint | Decision |", "|---|---|---|"] + [f"| {row['package']} | `{row['endpoint']}` | preauthorized, repeat pending |" for row in evidence]
85
+ REVIEW_MD.write_text("\n".join(lines) + "\n", encoding="utf-8"); print(json.dumps({"cases": len(cases), "review_json": str(REVIEW_JSON), "review_md": str(REVIEW_MD)}, indent=2)); return 0
86
+
87
+
88
+ if __name__ == "__main__": raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group5/test_smoke.py ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import gzip
5
+ import py_compile
6
+ import tempfile
7
+ import unittest
8
+ from pathlib import Path
9
+ import sys
10
+
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ sys.path.insert(0, str(ROOT / "scripts"))
14
+
15
+ from generate_wrapper import render_wrapper, validate_ir_minimal # noqa: E402
16
+ from run_experiment import materialize_case, substitute_command # noqa: E402
17
+ from validators import compare_oracle, validate_all # noqa: E402
18
+
19
+
20
+ class ExperimentOneSmokeTests(unittest.TestCase):
21
+ def test_example_ir_generates_compilable_python(self) -> None:
22
+ ir = json.loads((ROOT / "examples" / "seqkit_stats.contract.json").read_text())
23
+ self.assertEqual(validate_ir_minimal(ir), [])
24
+ code = render_wrapper(ir)
25
+ self.assertIn("@mcp.tool()", code)
26
+ with tempfile.TemporaryDirectory() as temp:
27
+ path = Path(temp) / "server.py"
28
+ path.write_text(code)
29
+ py_compile.compile(str(path), doraise=True)
30
+
31
+ def test_tsv_validator_and_oracle(self) -> None:
32
+ with tempfile.TemporaryDirectory() as temp:
33
+ root = Path(temp)
34
+ native = root / "native.tsv"
35
+ mcp = root / "mcp.tsv"
36
+ native.write_text("a\tb\n1\t2\n")
37
+ mcp.write_text("a\tb\n1\t2\n")
38
+ spec = [{"name": "tsv", "target": "out", "kind": "tsv", "config": {"min_columns": 2}}]
39
+ ok, details = validate_all(spec, {"out": mcp})
40
+ self.assertTrue(ok, details)
41
+ oracle = compare_oracle({"kind": "normalized_text_equal", "target": "out"}, {"out": native}, {"out": mcp})
42
+ self.assertTrue(oracle["ok"])
43
+
44
+ def test_tsv_oracle_can_ignore_path_column(self) -> None:
45
+ with tempfile.TemporaryDirectory() as temp:
46
+ root = Path(temp)
47
+ native = root / "native.tsv"
48
+ mcp = root / "mcp.tsv"
49
+ native.write_text("/tmp/native/input.fa\t1\t40\n")
50
+ mcp.write_text("/tmp/mcp/input.fa\t1\t40\n")
51
+ oracle = compare_oracle(
52
+ {"kind": "tsv_equal_ignore_columns", "target": "out", "ignore_columns": [0]},
53
+ {"out": native},
54
+ {"out": mcp},
55
+ )
56
+ self.assertTrue(oracle["ok"])
57
+
58
+ def test_noncomment_oracle_ignores_command_header(self) -> None:
59
+ with tempfile.TemporaryDirectory() as temp:
60
+ root = Path(temp)
61
+ native = root / "native.gtf"
62
+ mcp = root / "mcp.gtf"
63
+ record = 'chr1\ttool\ttranscript\t1\t10\t.\t+\t.\tgene_id "g1";\n'
64
+ native.write_text("# native /tmp/a\n" + record)
65
+ mcp.write_text("# mcp /tmp/b\n" + record)
66
+ oracle = compare_oracle(
67
+ {"kind": "normalized_noncomment_text_equal", "target": "out"},
68
+ {"out": native},
69
+ {"out": mcp},
70
+ )
71
+ self.assertTrue(oracle["ok"])
72
+
73
+ def test_featurecounts_oracle_normalizes_input_path_header(self) -> None:
74
+ with tempfile.TemporaryDirectory() as temp:
75
+ root = Path(temp)
76
+ native = root / "native.txt"
77
+ mcp = root / "mcp.txt"
78
+ native.write_text("# command native\nGeneid\t/tmp/native/in.bam\ngeneA\t12\n")
79
+ mcp.write_text("# command mcp\nGeneid\t/tmp/mcp/in.bam\ngeneA\t12\n")
80
+ oracle = compare_oracle(
81
+ {"kind": "featurecounts_table_equal", "target": "out"},
82
+ {"out": native},
83
+ {"out": mcp},
84
+ )
85
+ self.assertTrue(oracle["ok"])
86
+
87
+ def test_binary_oracle_compares_exact_bytes(self) -> None:
88
+ with tempfile.TemporaryDirectory() as temp:
89
+ root = Path(temp)
90
+ native = root / "native.bin"
91
+ mcp = root / "mcp.bin"
92
+ native.write_bytes(b"\x00\x01\xff")
93
+ mcp.write_bytes(b"\x00\x01\xff")
94
+ oracle = compare_oracle(
95
+ {"kind": "binary_equal", "target": "out"},
96
+ {"out": native},
97
+ {"out": mcp},
98
+ )
99
+ self.assertTrue(oracle["ok"])
100
+
101
+ def test_sam_validator_ignores_header_records(self) -> None:
102
+ with tempfile.TemporaryDirectory() as temp:
103
+ output = Path(temp) / "output.sam"
104
+ output.write_text(
105
+ "@HD\tVN:1.6\tSO:queryname\n"
106
+ "@SQ\tSN:chr1\tLN:100\n"
107
+ "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
108
+ )
109
+ ok, details = validate_all(
110
+ [{"name": "sam", "target": "out", "kind": "sam", "config": {}}],
111
+ {"out": output},
112
+ )
113
+ self.assertTrue(ok, details)
114
+
115
+ def test_gzip_validator_and_content_oracle(self) -> None:
116
+ with tempfile.TemporaryDirectory() as temp:
117
+ root = Path(temp)
118
+ native = root / "native.gz"
119
+ mcp = root / "mcp.gz"
120
+ with gzip.open(native, "wb") as handle:
121
+ handle.write(b">seq\nACGT\n")
122
+ with gzip.open(mcp, "wb") as handle:
123
+ handle.write(b">seq\nACGT\n")
124
+ ok, details = validate_all(
125
+ [{"name": "gzip", "target": "out", "kind": "gzip", "config": {}}],
126
+ {"out": mcp},
127
+ )
128
+ self.assertTrue(ok, details)
129
+ oracle = compare_oracle(
130
+ {"kind": "gzip_content_equal", "target": "out"},
131
+ {"out": native},
132
+ {"out": mcp},
133
+ )
134
+ self.assertTrue(oracle["ok"])
135
+
136
+ def test_sam_record_oracle_ignores_headers(self) -> None:
137
+ with tempfile.TemporaryDirectory() as temp:
138
+ root = Path(temp)
139
+ native = root / "native.sam"
140
+ mcp = root / "mcp.sam"
141
+ record = "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
142
+ native.write_text("@PG\tID:native\tCL:/tmp/native\n" + record)
143
+ mcp.write_text("@PG\tID:mcp\tCL:/tmp/mcp\n" + record)
144
+ oracle = compare_oracle(
145
+ {"kind": "sam_records_equal", "target": "out"},
146
+ {"out": native},
147
+ {"out": mcp},
148
+ )
149
+ self.assertTrue(oracle["ok"])
150
+
151
+ def test_tmalign_summary_oracle_ignores_paths_and_comments(self) -> None:
152
+ with tempfile.TemporaryDirectory() as temp:
153
+ root = Path(temp)
154
+ native = root / "native.tsv"
155
+ mcp = root / "mcp.tsv"
156
+ native.write_text("#header\n/a.pdb\t/b.pdb\t1.0000\t0.00\n#Total CPU time is 0.01\n")
157
+ mcp.write_text("#header\n/x.pdb\t/y.pdb\t1.0000\t0.00\n#Total CPU time is 0.02\n")
158
+ oracle = compare_oracle(
159
+ {"kind": "tmalign_summary_equal", "target": "out"},
160
+ {"out": native},
161
+ {"out": mcp},
162
+ )
163
+ self.assertTrue(oracle["ok"])
164
+
165
+ def test_krona_tree_oracle_ignores_sibling_order(self) -> None:
166
+ with tempfile.TemporaryDirectory() as temp:
167
+ root = Path(temp)
168
+ native = root / "native.html"
169
+ mcp = root / "mcp.html"
170
+ native.write_text("<html><krona><node name='root'><node name='a'/><node name='b'/></node></krona></html>")
171
+ mcp.write_text("<html><krona><node name='root'><node name='b'/><node name='a'/></node></krona></html>")
172
+ oracle = compare_oracle(
173
+ {"kind": "krona_tree_equal", "target": "out"},
174
+ {"out": native},
175
+ {"out": mcp},
176
+ )
177
+ self.assertTrue(oracle["ok"])
178
+
179
+ def test_fixture_binding_can_materialize_path_list(self) -> None:
180
+ with tempfile.TemporaryDirectory() as temp:
181
+ root = Path(temp)
182
+ fixture = root / "input.fa"
183
+ fixture.write_text(">seq\nACGT\n")
184
+ workdir = root / "work"
185
+ workdir.mkdir()
186
+ case = {
187
+ "fixture_bindings": {
188
+ "files": {"path": "input.fa", "argument_mode": "list"}
189
+ }
190
+ }
191
+ bindings, arguments = materialize_case(case, root, workdir)
192
+ self.assertEqual(bindings["files"], workdir / "input.fa")
193
+ self.assertEqual(arguments["files"], [str(workdir / "input.fa")])
194
+
195
+ def test_endpoint_argument_allowlist_keeps_sidecars_out_of_mcp_call(self) -> None:
196
+ with tempfile.TemporaryDirectory() as temp:
197
+ root = Path(temp)
198
+ (root / "input.bam").write_bytes(b"bam")
199
+ (root / "input.bam.bai").write_bytes(b"bai")
200
+ workdir = root / "work"
201
+ workdir.mkdir()
202
+ case = {
203
+ "endpoint_arguments": ["input_bam", "output_table"],
204
+ "fixture_bindings": {
205
+ "input_bam": "input.bam",
206
+ "input_bai": "input.bam.bai",
207
+ },
208
+ "outputs": {"output_table": "result.txt"},
209
+ }
210
+ bindings, arguments = materialize_case(case, root, workdir)
211
+ self.assertIn("input_bai", bindings)
212
+ self.assertNotIn("input_bai", arguments)
213
+ self.assertEqual(set(arguments), {"input_bam", "output_table"})
214
+
215
+ def test_contract_template_can_capture_stdout_to_output_argument(self) -> None:
216
+ ir = {
217
+ "ir_version": "0.1",
218
+ "tool": {"executable": "tool", "subcommand": None},
219
+ "endpoint": {"name": "run_tool", "description": "test"},
220
+ "arguments": [
221
+ {"name": "input_file", "flag": "-i", "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "input"},
222
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "captured output", "pass_to_cli": False},
223
+ ],
224
+ "inputs": [],
225
+ "outputs": [{"name": "output", "artifact_type": "text", "binding": "output_file", "capture": "stdout", "assertions": []}],
226
+ "validators": [],
227
+ "evidence": [],
228
+ }
229
+ code = render_wrapper(ir)
230
+ self.assertIn("Path(output_file).write_text(completed.stdout", code)
231
+ self.assertNotIn("_append_value(command, None, output_file)", code)
232
+
233
+ def test_contract_template_can_capture_binary_stdout(self) -> None:
234
+ ir = {
235
+ "ir_version": "0.1",
236
+ "tool": {"executable": "bgzip", "subcommand": None},
237
+ "endpoint": {"name": "compress", "description": "test"},
238
+ "arguments": [
239
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input"},
240
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
241
+ ],
242
+ "inputs": [],
243
+ "outputs": [{"name": "output", "artifact_type": "file", "binding": "output_file", "assertions": []}],
244
+ "validators": [],
245
+ "evidence": [],
246
+ "execution_plan": {"steps": [{"command": ["bgzip", "-c", "{input_file}"], "capture_stdout_to": "output_file", "stdout_mode": "binary"}]},
247
+ }
248
+ code = render_wrapper(ir)
249
+ self.assertIn("text=False", code)
250
+ self.assertIn("Path(output_file).write_bytes", code)
251
+ with tempfile.TemporaryDirectory() as temp:
252
+ path = Path(temp) / "server.py"
253
+ path.write_text(code)
254
+ py_compile.compile(str(path), doraise=True)
255
+
256
+ def test_native_command_substitution_includes_scalar_arguments(self) -> None:
257
+ command = substitute_command(
258
+ ["tabix", "{input_file}", "{region}"],
259
+ {"input_file": Path("input.vcf.gz"), "region": "chrTiny:1-10"},
260
+ )
261
+ self.assertEqual(command, ["tabix", "input.vcf.gz", "chrTiny:1-10"])
262
+
263
+ def test_execution_plan_format_token_supports_multiple_arguments(self) -> None:
264
+ ir = {
265
+ "ir_version": "0.1",
266
+ "tool": {"executable": "mothur", "subcommand": None},
267
+ "endpoint": {"name": "summarize", "description": "test"},
268
+ "arguments": [
269
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input", "pass_to_cli": False},
270
+ {"name": "output_dir", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
271
+ ],
272
+ "inputs": [],
273
+ "outputs": [],
274
+ "validators": [],
275
+ "evidence": [],
276
+ "execution_plan": {"steps": [{"command": ["mothur", {"format": "#set.dir(output={output_dir}); summary.seqs(fasta={input_file})"}]}]},
277
+ }
278
+ code = render_wrapper(ir)
279
+ self.assertIn("str(output_dir)", code)
280
+ self.assertIn("str(input_file)", code)
281
+ with tempfile.TemporaryDirectory() as temp:
282
+ path = Path(temp) / "server.py"
283
+ path.write_text(code)
284
+ py_compile.compile(str(path), doraise=True)
285
+
286
+
287
+ if __name__ == "__main__":
288
+ unittest.main()
Biomanus-V2/Experiment1/.sync_stage_group5/validators.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import gzip
5
+ import json
6
+ import os
7
+ import re
8
+ import shutil
9
+ import subprocess
10
+ import xml.etree.ElementTree as ET
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _noncomment_lines(path: Path) -> list[str]:
16
+ return [line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")]
17
+
18
+
19
+ def validate_one(spec: dict[str, Any], bindings: dict[str, Path]) -> dict[str, Any]:
20
+ target = spec["target"]
21
+ path = bindings.get(target)
22
+ kind = spec["kind"]
23
+ config = spec.get("config") or {}
24
+ result = {"name": spec.get("name", kind), "target": target, "kind": kind, "ok": False, "detail": ""}
25
+ if path is None:
26
+ result["detail"] = "target binding missing"
27
+ return result
28
+ try:
29
+ if kind == "exists":
30
+ result["ok"] = path.exists()
31
+ elif kind == "nonempty":
32
+ result["ok"] = path.is_file() and path.stat().st_size > 0
33
+ elif kind == "json":
34
+ json.loads(path.read_text(encoding="utf-8")); result["ok"] = True
35
+ elif kind in {"csv", "tsv"}:
36
+ delimiter = "," if kind == "csv" else "\t"
37
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
38
+ rows = list(csv.reader(handle, delimiter=delimiter))
39
+ minimum = int(config.get("min_columns", 1))
40
+ result["ok"] = bool(rows) and all(len(row) >= minimum for row in rows)
41
+ result["detail"] = f"rows={len(rows)}"
42
+ elif kind == "fasta":
43
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
44
+ result["ok"] = bool(lines) and lines[0].startswith(">") and any(line and not line.startswith(">") for line in lines)
45
+ elif kind == "maf":
46
+ rows = _noncomment_lines(path)
47
+ result["ok"] = any(row.startswith("a ") for row in rows) and any(row.startswith("s ") for row in rows)
48
+ elif kind == "fastq":
49
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
50
+ result["ok"] = len(lines) >= 4 and len(lines) % 4 == 0 and lines[0].startswith("@") and lines[2].startswith("+")
51
+ elif kind == "bed":
52
+ rows = _noncomment_lines(path)
53
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 3 for row in rows)
54
+ elif kind == "sam":
55
+ rows = [
56
+ line
57
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
58
+ if line and not line.startswith("@")
59
+ ]
60
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 11 for row in rows)
61
+ elif kind == "gzip":
62
+ with gzip.open(path, "rb") as handle:
63
+ handle.read(1)
64
+ result["ok"] = True
65
+ elif kind == "vcf":
66
+ text = path.read_text(encoding="utf-8", errors="replace")
67
+ rows = [line for line in text.splitlines() if line and not line.startswith("#")]
68
+ result["ok"] = "##fileformat=VCF" in text and "#CHROM" in text and all(len(row.split("\t")) >= 8 for row in rows)
69
+ elif kind == "regex":
70
+ result["ok"] = re.search(str(config["pattern"]), path.read_text(encoding="utf-8", errors="replace"), re.MULTILINE) is not None
71
+ else:
72
+ result["detail"] = f"validator kind not implemented: {kind}"
73
+ return result
74
+ except Exception as exc:
75
+ result["detail"] = f"{type(exc).__name__}: {exc}"
76
+ return result
77
+ if not result["detail"]:
78
+ result["detail"] = str(path)
79
+ return result
80
+
81
+
82
+ def validate_all(specs: list[dict[str, Any]], bindings: dict[str, Path]) -> tuple[bool, list[dict[str, Any]]]:
83
+ results = [validate_one(spec, bindings) for spec in specs]
84
+ return bool(results) and all(item["ok"] for item in results), results
85
+
86
+
87
+ def normalized_text(path: Path) -> str:
88
+ return "\n".join(line.rstrip() for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line.strip())
89
+
90
+
91
+ def normalized_bcf_records(path: Path, spec: dict[str, Any]) -> list[str]:
92
+ executable = spec.get("bcftools_executable") or os.getenv("BCFTOOLS") or shutil.which("bcftools")
93
+ if not executable:
94
+ candidates = (
95
+ "/225040511/miniconda3/envs/bioenv/bin/bcftools",
96
+ "/225040511/miniconda3/envs/bioenv_cli/bin/bcftools",
97
+ "/225040511/miniconda3/envs/biomni_e1/bin/bcftools",
98
+ )
99
+ executable = next((candidate for candidate in candidates if Path(candidate).is_file()), None)
100
+ if not executable:
101
+ raise RuntimeError("bcftools executable not found")
102
+ completed = subprocess.run(
103
+ [str(executable), "view", "-H", str(path)],
104
+ text=True,
105
+ capture_output=True,
106
+ timeout=60,
107
+ )
108
+ if completed.returncode != 0:
109
+ raise RuntimeError(completed.stderr[-2000:] or "bcftools could not parse BCF")
110
+ return sorted(line.rstrip() for line in completed.stdout.splitlines() if line.strip())
111
+
112
+
113
+ def fasta_records(path: Path) -> dict[str, str]:
114
+ records: dict[str, str] = {}
115
+ name: str | None = None
116
+ chunks: list[str] = []
117
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
118
+ if line.startswith(">"):
119
+ if name is not None:
120
+ records[name] = "".join(chunks).replace(" ", "").upper()
121
+ name = line[1:].strip().split()[0]
122
+ chunks = []
123
+ elif line.strip():
124
+ chunks.append(line.strip())
125
+ if name is not None:
126
+ records[name] = "".join(chunks).replace(" ", "").upper()
127
+ return records
128
+
129
+
130
+ def maf_semantic_rows(path: Path) -> list[str]:
131
+ return [
132
+ " ".join(line.split())
133
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
134
+ if line.startswith(("a ", "s ", "i ", "e ", "q "))
135
+ ]
136
+
137
+
138
+ def compare_oracle(spec: dict[str, Any], native: dict[str, Path], mcp: dict[str, Path]) -> dict[str, Any]:
139
+ kind = spec.get("kind")
140
+ target = spec.get("target")
141
+ left, right = native.get(target), mcp.get(target)
142
+ result = {"kind": kind, "target": target, "ok": False, "detail": ""}
143
+ if left is None or right is None or not left.exists() or not right.exists():
144
+ result["detail"] = "oracle target missing"
145
+ return result
146
+ try:
147
+ if kind == "normalized_text_equal":
148
+ result["ok"] = normalized_text(left) == normalized_text(right)
149
+ elif kind == "normalized_noncomment_text_equal":
150
+ def noncomment_text(path: Path) -> str:
151
+ return "\n".join(
152
+ line.rstrip()
153
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
154
+ if line.strip() and not line.startswith("#")
155
+ )
156
+
157
+ result["ok"] = noncomment_text(left) == noncomment_text(right)
158
+ elif kind == "json_equal":
159
+ result["ok"] = json.loads(left.read_text()) == json.loads(right.read_text())
160
+ elif kind == "record_count_equal":
161
+ result["ok"] = len(_noncomment_lines(left)) == len(_noncomment_lines(right))
162
+ elif kind == "bcf_records_equal":
163
+ result["ok"] = normalized_bcf_records(left, spec) == normalized_bcf_records(right, spec)
164
+ elif kind == "fasta_records_equal":
165
+ result["ok"] = fasta_records(left) == fasta_records(right)
166
+ elif kind == "maf_records_equal":
167
+ result["ok"] = maf_semantic_rows(left) == maf_semantic_rows(right)
168
+ elif kind == "vcf_records_equal":
169
+ result["ok"] = _noncomment_lines(left) == _noncomment_lines(right)
170
+ elif kind == "tsv_equal_ignore_columns":
171
+ ignored = {int(value) for value in spec.get("ignore_columns", [])}
172
+
173
+ def projected(path: Path) -> list[list[str]]:
174
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
175
+ return [
176
+ [value for index, value in enumerate(row) if index not in ignored]
177
+ for row in csv.reader(handle, delimiter="\t")
178
+ ]
179
+
180
+ result["ok"] = projected(left) == projected(right)
181
+ elif kind == "featurecounts_table_equal":
182
+ def featurecounts_rows(path: Path) -> list[list[str]]:
183
+ rows = [
184
+ row for row in csv.reader(
185
+ (line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")),
186
+ delimiter="\t",
187
+ )
188
+ ]
189
+ if rows and rows[0]:
190
+ rows[0][-1] = Path(rows[0][-1]).name
191
+ return rows
192
+
193
+ result["ok"] = featurecounts_rows(left) == featurecounts_rows(right)
194
+ elif kind == "normalized_lines_equal_unordered":
195
+ def normalized_lines(path: Path) -> list[str]:
196
+ return sorted(
197
+ " ".join(line.split())
198
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
199
+ if line.strip()
200
+ )
201
+
202
+ result["ok"] = normalized_lines(left) == normalized_lines(right)
203
+ elif kind == "binary_equal":
204
+ result["ok"] = left.read_bytes() == right.read_bytes()
205
+ elif kind == "gzip_content_equal":
206
+ with gzip.open(left, "rb") as left_handle, gzip.open(right, "rb") as right_handle:
207
+ result["ok"] = left_handle.read() == right_handle.read()
208
+ elif kind == "sam_records_equal":
209
+ def sam_records(path: Path) -> list[str]:
210
+ return [
211
+ line.rstrip()
212
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
213
+ if line and not line.startswith("@")
214
+ ]
215
+
216
+ result["ok"] = sam_records(left) == sam_records(right)
217
+ elif kind == "tmalign_summary_equal":
218
+ def tmalign_summary(path: Path) -> list[str]:
219
+ rows = []
220
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
221
+ if not line or line.startswith("#"):
222
+ continue
223
+ fields = line.split("\t")
224
+ rows.append("\t".join(fields[2:]) if len(fields) >= 3 else line)
225
+ return rows
226
+
227
+ result["ok"] = tmalign_summary(left) == tmalign_summary(right)
228
+ elif kind == "krona_tree_equal":
229
+ def krona_tree(path: Path) -> tuple:
230
+ text = path.read_text(encoding="utf-8", errors="replace")
231
+ start = text.index("<krona")
232
+ end = text.index("</krona>", start) + len("</krona>")
233
+ root = ET.fromstring(text[start:end])
234
+
235
+ def canonical(node: ET.Element) -> tuple:
236
+ children = sorted((canonical(child) for child in node), key=repr)
237
+ return (node.tag, tuple(sorted(node.attrib.items())), (node.text or "").strip(), tuple(children))
238
+
239
+ return canonical(root)
240
+
241
+ result["ok"] = krona_tree(left) == krona_tree(right)
242
+ else:
243
+ result["detail"] = f"oracle kind not implemented: {kind}"
244
+ return result
245
+ except Exception as exc:
246
+ result["detail"] = f"{type(exc).__name__}: {exc}"
247
+ return result
248
+ result["detail"] = f"native={left}; mcp={right}"
249
+ return result
Biomanus-V2/Experiment1/.sync_stage_group6/build_test_103_group6_cases.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build six native-validated cases for callable Test-103 group six."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import hashlib
7
+ import json
8
+
9
+ from build_test_batch1_cases import ENV_ROOT, OUT_ROOT, ROOT, base
10
+ from promote_second_batch_cases import attach_execution_plan, attach_generation_interface, validator
11
+
12
+ PROBE_ROOTS = {name: ROOT / "runs/test_103_native_curation/group6_probe_v1" / name for name in ("gffutils", "cooltools", "whatshap", "slow5tools", "sourmash", "spades")}
13
+ REVIEW_JSON = ROOT / "data/curation/test_103_group6_native_review.json"
14
+ REVIEW_MD = ROOT / "reports/test_103_group6_native_review.md"
15
+
16
+
17
+ def p(name: str, binding: str) -> dict:
18
+ return {"name": name, "value_type": "path", "required": True, "native_binding": binding}
19
+
20
+
21
+ def add(case: dict, executable: str, subcommand: str | None, params: list[dict], steps: list[dict], notes: str = "") -> None:
22
+ attach_generation_interface(case, executable, subcommand, params, notes); attach_execution_plan(case, steps)
23
+
24
+
25
+ def build_cases() -> list[dict]:
26
+ cases = []
27
+ env = ENV_ROOT / "gffutils-0.9-py36_0"
28
+ code = "import gffutils,json,sys; db=gffutils.create_db(sys.argv[1],dbfn=sys.argv[2],force=True,keep_order=True,merge_strategy='merge',sort_attribute_values=True); rows=[{'id':x.id,'seqid':x.seqid,'source':x.source,'type':x.featuretype,'start':x.start,'end':x.end,'strand':x.strand,'attributes':dict(x.attributes)} for x in db.all_features(order_by=('seqid','start'))]; open(sys.argv[3],'w').write(json.dumps(rows,sort_keys=True)+'\\n')"
29
+ case = base("gffutils", "0.9", "py36_0", "build_feature_database")
30
+ case.update({"fixture_bindings": {"input_gff": "data/fixtures/genes.gff3"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/python3.6"), "-c", code, "{input_gff}", "{output_db}", "{output_json}"]}, "outputs": {"output_db": "gffutils/features.db", "output_json": "gffutils/features.json"}, "validators": [validator("db_nonempty", "output_db", "nonempty"), validator("features_json", "output_json", "json"), validator("gene_feature", "output_json", "regex", pattern=r'"type": "gene"')], "semantic_oracle": {"kind": "json_equal", "target": "output_json"}})
31
+ add(case, "python3.6", None, [p("input_gff", "argv1"), p("output_db", "argv2"), p("output_json", "argv3")], [{"command": ["python3.6", "-c", code, "{input_gff}", "{output_db}", "{output_json}"]}], "Invoke pinned gffutils to build SQLite, then emit a deterministic feature JSON oracle.")
32
+ cases.append(case)
33
+
34
+ env = ENV_ROOT / "cooltools-0.7.1-py39hff726c5_3"
35
+ case = base("cooltools", "0.7.1", "py39hff726c5_3", "binnify_genome")
36
+ case.update({"fixture_bindings": {"chrom_sizes": "data/fixtures/test_chrom.sizes"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/cooltools'} genome binnify --all-names '{{chrom_sizes}}' 10 > '{{output_bed}}'"]}, "outputs": {"output_bed": "cooltools/bins.bed"}, "validators": [validator("bins_bed", "output_bed", "bed"), validator("final_bin", "output_bed", "regex", pattern=r"chrTiny\t30\t40$")], "semantic_oracle": {"kind": "normalized_text_equal", "target": "output_bed"}})
37
+ add(case, "cooltools", "genome binnify", [p("chrom_sizes", "positional"), p("output_bed", "stdout")], [{"command": ["cooltools", "genome", "binnify", "--all-names", "{chrom_sizes}", "10"], "capture_stdout_to": "output_bed"}], "Bin size 10 and all chromosome names are fixed.")
38
+ cases.append(case)
39
+
40
+ env = ENV_ROOT / "whatshap-2.8-py39h2de1943_0"
41
+ case = base("whatshap", "2.8", "py39h2de1943_0", "phasing_stats")
42
+ case.update({"fixture_bindings": {"input_vcf": "data/fixtures/test_phased.vcf"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/whatshap"), "stats", "--tsv", "{output_tsv}", "--sample", "SAMPLE", "{input_vcf}"]}, "outputs": {"output_tsv": "whatshap/stats.tsv"}, "validators": [validator("stats_tsv", "output_tsv", "tsv", min_columns=10), validator("sample_row", "output_tsv", "regex", pattern=r"^SAMPLE\tchrTiny")], "semantic_oracle": {"kind": "tsv_equal_ignore_columns", "target": "output_tsv", "ignore_columns": [2]}})
43
+ add(case, "whatshap", "stats", [p("input_vcf", "positional"), p("output_tsv", "--tsv")], [{"command": ["whatshap", "stats", "--tsv", "{output_tsv}", "--sample", "SAMPLE", "{input_vcf}"]}], "Sample SAMPLE is fixed; the input filename column is ignored by the oracle.")
44
+ cases.append(case)
45
+
46
+ env = ENV_ROOT / "slow5tools-1.4.0-hee927d3_0"
47
+ case = base("slow5tools", "1.4.0", "hee927d3_0", "signal_stats")
48
+ case.update({"fixture_bindings": {"input_slow5": "data/fixtures/test_signal.slow5"}, "arguments": {}, "native": {"environment": str(env), "command": ["bash", "-lc", f"{env / 'bin/slow5tools'} stats '{{input_slow5}}' > '{{output_stats}}'"]}, "outputs": {"output_stats": "slow5tools/stats.txt"}, "validators": [validator("stats_nonempty", "output_stats", "nonempty"), validator("one_record", "output_stats", "regex", pattern=r"number of records\t1")], "semantic_oracle": {"kind": "slow5_stats_equal", "target": "output_stats"}})
49
+ add(case, "slow5tools", "stats", [p("input_slow5", "positional"), p("output_stats", "stdout")], [{"command": ["slow5tools", "stats", "{input_slow5}"], "capture_stdout_to": "output_stats"}], "The oracle ignores only the input file path line.")
50
+ cases.append(case)
51
+
52
+ env = ENV_ROOT / "sourmash-3.3.0-py37h8f50634_1"
53
+ case = base("sourmash", "3.3.0", "py37h8f50634_1", "compute_signature")
54
+ case.update({"fixture_bindings": {"input_fasta": "data/fixtures/test_nextalign_reference.fa"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/sourmash"), "compute", "-k", "5", "--scaled", "1", "-o", "{output_signature}", "{input_fasta}"]}, "outputs": {"output_signature": "sourmash/signature.sig"}, "validators": [validator("signature_json", "output_signature", "json"), validator("md5_present", "output_signature", "regex", pattern=r'"md5sum"')], "semantic_oracle": {"kind": "sourmash_signature_equal", "target": "output_signature"}, "runner_notes": "Environment compatibility repair: screed 1.0.5 plus importlib-metadata 4.13.0 were installed; sourmash remains exact version/build 3.3.0 py37h8f50634_1."})
55
+ add(case, "sourmash", "compute", [p("input_fasta", "positional"), p("output_signature", "-o")], [{"command": ["sourmash", "compute", "-k", "5", "--scaled", "1", "-o", "{output_signature}", "{input_fasta}"]}], "k=5 and scaled=1 are fixed; filename metadata is ignored by the oracle.")
56
+ cases.append(case)
57
+
58
+ env = ENV_ROOT / "spades-4.3.0-hde4eca7_1"
59
+ case = base("spades", "4.3.0", "hde4eca7_1", "assemble_paired_reads")
60
+ case.update({"fixture_bindings": {"reads_r1": "data/fixtures/spades_ecoli_1K_1.fq.gz", "reads_r2": "data/fixtures/spades_ecoli_1K_2.fq.gz"}, "arguments": {}, "native": {"environment": str(env), "command": [str(env / "bin/spades.py"), "--only-assembler", "-1", "{reads_r1}", "-2", "{reads_r2}", "-o", "{output_dir}", "-t", "1", "-m", "1", "-k", "21"]}, "outputs": {"output_dir": "spades/assembly", "contigs_fasta": "spades/assembly/contigs.fasta"}, "validators": [validator("contigs_fasta", "contigs_fasta", "fasta"), validator("contigs_nonempty", "contigs_fasta", "nonempty")], "semantic_oracle": {"kind": "fasta_records_equal", "target": "contigs_fasta"}, "runner_notes": "contigs_fasta derives under output_dir."})
61
+ add(case, "spades.py", None, [p("reads_r1", "-1"), p("reads_r2", "-2"), p("output_dir", "-o")], [{"command": ["spades.py", "--only-assembler", "-1", "{reads_r1}", "-2", "{reads_r2}", "-o", "{output_dir}", "-t", "1", "-m", "1", "-k", "21"]}], "Assembler-only, one thread, 1 GB, and k=21 are fixed.")
62
+ cases.append(case)
63
+ return cases
64
+
65
+
66
+ def main() -> int:
67
+ cases = build_cases(); OUT_ROOT.mkdir(parents=True, exist_ok=True)
68
+ for case in cases: (OUT_ROOT / f"{case['package']}.json").write_text(json.dumps(case, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
69
+ evidence = []
70
+ for case in cases:
71
+ files = [{"path": str(path.relative_to(ROOT)), "size": path.stat().st_size, "sha256": hashlib.sha256(path.read_bytes()).hexdigest()} for path in sorted(PROBE_ROOTS[case["package"]].rglob("*")) if path.is_file()]
72
+ evidence.append({"package": case["package"], "case_id": case["case_id"], "endpoint": case["endpoint"], "environment": case["native"]["environment"], "native_command": case["native"]["command"], "validators": case["validators"], "semantic_oracle": case["semantic_oracle"], "outputs": files, "review_decision": "preauthorized_pending_native_repeat"})
73
+ payload = {"scope": "test_103_group6_method_blind_native_review", "case_count": len(cases), "method_generation_started": False, "blanket_preauthorized_by_user": True, "cases": evidence}; REVIEW_JSON.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
74
+ lines = ["# Test 103 group 6 native review", "", "Blanket-preauthorized; promotion still requires native repeat equality.", "", "| Package | Endpoint | Decision |", "|---|---|---|"] + [f"| {row['package']} | `{row['endpoint']}` | preauthorized, repeat pending |" for row in evidence]
75
+ REVIEW_MD.write_text("\n".join(lines) + "\n", encoding="utf-8"); print(json.dumps({"cases": len(cases), "review_json": str(REVIEW_JSON), "review_md": str(REVIEW_MD)}, indent=2)); return 0
76
+
77
+
78
+ if __name__ == "__main__": raise SystemExit(main())
Biomanus-V2/Experiment1/.sync_stage_group6/test_smoke.py ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import gzip
5
+ import py_compile
6
+ import tempfile
7
+ import unittest
8
+ from pathlib import Path
9
+ import sys
10
+
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ sys.path.insert(0, str(ROOT / "scripts"))
14
+
15
+ from generate_wrapper import render_wrapper, validate_ir_minimal # noqa: E402
16
+ from run_experiment import materialize_case, substitute_command # noqa: E402
17
+ from validators import compare_oracle, validate_all # noqa: E402
18
+
19
+
20
+ class ExperimentOneSmokeTests(unittest.TestCase):
21
+ def test_example_ir_generates_compilable_python(self) -> None:
22
+ ir = json.loads((ROOT / "examples" / "seqkit_stats.contract.json").read_text())
23
+ self.assertEqual(validate_ir_minimal(ir), [])
24
+ code = render_wrapper(ir)
25
+ self.assertIn("@mcp.tool()", code)
26
+ with tempfile.TemporaryDirectory() as temp:
27
+ path = Path(temp) / "server.py"
28
+ path.write_text(code)
29
+ py_compile.compile(str(path), doraise=True)
30
+
31
+ def test_tsv_validator_and_oracle(self) -> None:
32
+ with tempfile.TemporaryDirectory() as temp:
33
+ root = Path(temp)
34
+ native = root / "native.tsv"
35
+ mcp = root / "mcp.tsv"
36
+ native.write_text("a\tb\n1\t2\n")
37
+ mcp.write_text("a\tb\n1\t2\n")
38
+ spec = [{"name": "tsv", "target": "out", "kind": "tsv", "config": {"min_columns": 2}}]
39
+ ok, details = validate_all(spec, {"out": mcp})
40
+ self.assertTrue(ok, details)
41
+ oracle = compare_oracle({"kind": "normalized_text_equal", "target": "out"}, {"out": native}, {"out": mcp})
42
+ self.assertTrue(oracle["ok"])
43
+
44
+ def test_tsv_oracle_can_ignore_path_column(self) -> None:
45
+ with tempfile.TemporaryDirectory() as temp:
46
+ root = Path(temp)
47
+ native = root / "native.tsv"
48
+ mcp = root / "mcp.tsv"
49
+ native.write_text("/tmp/native/input.fa\t1\t40\n")
50
+ mcp.write_text("/tmp/mcp/input.fa\t1\t40\n")
51
+ oracle = compare_oracle(
52
+ {"kind": "tsv_equal_ignore_columns", "target": "out", "ignore_columns": [0]},
53
+ {"out": native},
54
+ {"out": mcp},
55
+ )
56
+ self.assertTrue(oracle["ok"])
57
+
58
+ def test_noncomment_oracle_ignores_command_header(self) -> None:
59
+ with tempfile.TemporaryDirectory() as temp:
60
+ root = Path(temp)
61
+ native = root / "native.gtf"
62
+ mcp = root / "mcp.gtf"
63
+ record = 'chr1\ttool\ttranscript\t1\t10\t.\t+\t.\tgene_id "g1";\n'
64
+ native.write_text("# native /tmp/a\n" + record)
65
+ mcp.write_text("# mcp /tmp/b\n" + record)
66
+ oracle = compare_oracle(
67
+ {"kind": "normalized_noncomment_text_equal", "target": "out"},
68
+ {"out": native},
69
+ {"out": mcp},
70
+ )
71
+ self.assertTrue(oracle["ok"])
72
+
73
+ def test_featurecounts_oracle_normalizes_input_path_header(self) -> None:
74
+ with tempfile.TemporaryDirectory() as temp:
75
+ root = Path(temp)
76
+ native = root / "native.txt"
77
+ mcp = root / "mcp.txt"
78
+ native.write_text("# command native\nGeneid\t/tmp/native/in.bam\ngeneA\t12\n")
79
+ mcp.write_text("# command mcp\nGeneid\t/tmp/mcp/in.bam\ngeneA\t12\n")
80
+ oracle = compare_oracle(
81
+ {"kind": "featurecounts_table_equal", "target": "out"},
82
+ {"out": native},
83
+ {"out": mcp},
84
+ )
85
+ self.assertTrue(oracle["ok"])
86
+
87
+ def test_binary_oracle_compares_exact_bytes(self) -> None:
88
+ with tempfile.TemporaryDirectory() as temp:
89
+ root = Path(temp)
90
+ native = root / "native.bin"
91
+ mcp = root / "mcp.bin"
92
+ native.write_bytes(b"\x00\x01\xff")
93
+ mcp.write_bytes(b"\x00\x01\xff")
94
+ oracle = compare_oracle(
95
+ {"kind": "binary_equal", "target": "out"},
96
+ {"out": native},
97
+ {"out": mcp},
98
+ )
99
+ self.assertTrue(oracle["ok"])
100
+
101
+ def test_sam_validator_ignores_header_records(self) -> None:
102
+ with tempfile.TemporaryDirectory() as temp:
103
+ output = Path(temp) / "output.sam"
104
+ output.write_text(
105
+ "@HD\tVN:1.6\tSO:queryname\n"
106
+ "@SQ\tSN:chr1\tLN:100\n"
107
+ "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
108
+ )
109
+ ok, details = validate_all(
110
+ [{"name": "sam", "target": "out", "kind": "sam", "config": {}}],
111
+ {"out": output},
112
+ )
113
+ self.assertTrue(ok, details)
114
+
115
+ def test_gzip_validator_and_content_oracle(self) -> None:
116
+ with tempfile.TemporaryDirectory() as temp:
117
+ root = Path(temp)
118
+ native = root / "native.gz"
119
+ mcp = root / "mcp.gz"
120
+ with gzip.open(native, "wb") as handle:
121
+ handle.write(b">seq\nACGT\n")
122
+ with gzip.open(mcp, "wb") as handle:
123
+ handle.write(b">seq\nACGT\n")
124
+ ok, details = validate_all(
125
+ [{"name": "gzip", "target": "out", "kind": "gzip", "config": {}}],
126
+ {"out": mcp},
127
+ )
128
+ self.assertTrue(ok, details)
129
+ oracle = compare_oracle(
130
+ {"kind": "gzip_content_equal", "target": "out"},
131
+ {"out": native},
132
+ {"out": mcp},
133
+ )
134
+ self.assertTrue(oracle["ok"])
135
+
136
+ def test_sam_record_oracle_ignores_headers(self) -> None:
137
+ with tempfile.TemporaryDirectory() as temp:
138
+ root = Path(temp)
139
+ native = root / "native.sam"
140
+ mcp = root / "mcp.sam"
141
+ record = "read1\t4\t*\t0\t0\t*\t*\t0\t0\tACGT\tIIII\n"
142
+ native.write_text("@PG\tID:native\tCL:/tmp/native\n" + record)
143
+ mcp.write_text("@PG\tID:mcp\tCL:/tmp/mcp\n" + record)
144
+ oracle = compare_oracle(
145
+ {"kind": "sam_records_equal", "target": "out"},
146
+ {"out": native},
147
+ {"out": mcp},
148
+ )
149
+ self.assertTrue(oracle["ok"])
150
+
151
+ def test_tmalign_summary_oracle_ignores_paths_and_comments(self) -> None:
152
+ with tempfile.TemporaryDirectory() as temp:
153
+ root = Path(temp)
154
+ native = root / "native.tsv"
155
+ mcp = root / "mcp.tsv"
156
+ native.write_text("#header\n/a.pdb\t/b.pdb\t1.0000\t0.00\n#Total CPU time is 0.01\n")
157
+ mcp.write_text("#header\n/x.pdb\t/y.pdb\t1.0000\t0.00\n#Total CPU time is 0.02\n")
158
+ oracle = compare_oracle(
159
+ {"kind": "tmalign_summary_equal", "target": "out"},
160
+ {"out": native},
161
+ {"out": mcp},
162
+ )
163
+ self.assertTrue(oracle["ok"])
164
+
165
+ def test_krona_tree_oracle_ignores_sibling_order(self) -> None:
166
+ with tempfile.TemporaryDirectory() as temp:
167
+ root = Path(temp)
168
+ native = root / "native.html"
169
+ mcp = root / "mcp.html"
170
+ native.write_text("<html><krona><node name='root'><node name='a'/><node name='b'/></node></krona></html>")
171
+ mcp.write_text("<html><krona><node name='root'><node name='b'/><node name='a'/></node></krona></html>")
172
+ oracle = compare_oracle(
173
+ {"kind": "krona_tree_equal", "target": "out"},
174
+ {"out": native},
175
+ {"out": mcp},
176
+ )
177
+ self.assertTrue(oracle["ok"])
178
+
179
+ def test_slow5_stats_oracle_ignores_file_path(self) -> None:
180
+ with tempfile.TemporaryDirectory() as temp:
181
+ root = Path(temp); native = root / "a.txt"; mcp = root / "b.txt"
182
+ native.write_text("file path\t/a.slow5\nnumber of records\t1\n")
183
+ mcp.write_text("file path\t/b.slow5\nnumber of records\t1\n")
184
+ self.assertTrue(compare_oracle({"kind": "slow5_stats_equal", "target": "out"}, {"out": native}, {"out": mcp})["ok"])
185
+
186
+ def test_sourmash_signature_oracle_ignores_filename(self) -> None:
187
+ with tempfile.TemporaryDirectory() as temp:
188
+ root = Path(temp); native = root / "a.sig"; mcp = root / "b.sig"
189
+ native.write_text(json.dumps([{"filename": "/a.fa", "signatures": [{"md5sum": "x", "mins": [1]}]}]))
190
+ mcp.write_text(json.dumps([{"filename": "/b.fa", "signatures": [{"md5sum": "x", "mins": [1]}]}]))
191
+ self.assertTrue(compare_oracle({"kind": "sourmash_signature_equal", "target": "out"}, {"out": native}, {"out": mcp})["ok"])
192
+
193
+ def test_fixture_binding_can_materialize_path_list(self) -> None:
194
+ with tempfile.TemporaryDirectory() as temp:
195
+ root = Path(temp)
196
+ fixture = root / "input.fa"
197
+ fixture.write_text(">seq\nACGT\n")
198
+ workdir = root / "work"
199
+ workdir.mkdir()
200
+ case = {
201
+ "fixture_bindings": {
202
+ "files": {"path": "input.fa", "argument_mode": "list"}
203
+ }
204
+ }
205
+ bindings, arguments = materialize_case(case, root, workdir)
206
+ self.assertEqual(bindings["files"], workdir / "input.fa")
207
+ self.assertEqual(arguments["files"], [str(workdir / "input.fa")])
208
+
209
+ def test_endpoint_argument_allowlist_keeps_sidecars_out_of_mcp_call(self) -> None:
210
+ with tempfile.TemporaryDirectory() as temp:
211
+ root = Path(temp)
212
+ (root / "input.bam").write_bytes(b"bam")
213
+ (root / "input.bam.bai").write_bytes(b"bai")
214
+ workdir = root / "work"
215
+ workdir.mkdir()
216
+ case = {
217
+ "endpoint_arguments": ["input_bam", "output_table"],
218
+ "fixture_bindings": {
219
+ "input_bam": "input.bam",
220
+ "input_bai": "input.bam.bai",
221
+ },
222
+ "outputs": {"output_table": "result.txt"},
223
+ }
224
+ bindings, arguments = materialize_case(case, root, workdir)
225
+ self.assertIn("input_bai", bindings)
226
+ self.assertNotIn("input_bai", arguments)
227
+ self.assertEqual(set(arguments), {"input_bam", "output_table"})
228
+
229
+ def test_contract_template_can_capture_stdout_to_output_argument(self) -> None:
230
+ ir = {
231
+ "ir_version": "0.1",
232
+ "tool": {"executable": "tool", "subcommand": None},
233
+ "endpoint": {"name": "run_tool", "description": "test"},
234
+ "arguments": [
235
+ {"name": "input_file", "flag": "-i", "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "input"},
236
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "captured output", "pass_to_cli": False},
237
+ ],
238
+ "inputs": [],
239
+ "outputs": [{"name": "output", "artifact_type": "text", "binding": "output_file", "capture": "stdout", "assertions": []}],
240
+ "validators": [],
241
+ "evidence": [],
242
+ }
243
+ code = render_wrapper(ir)
244
+ self.assertIn("Path(output_file).write_text(completed.stdout", code)
245
+ self.assertNotIn("_append_value(command, None, output_file)", code)
246
+
247
+ def test_contract_template_can_capture_binary_stdout(self) -> None:
248
+ ir = {
249
+ "ir_version": "0.1",
250
+ "tool": {"executable": "bgzip", "subcommand": None},
251
+ "endpoint": {"name": "compress", "description": "test"},
252
+ "arguments": [
253
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input"},
254
+ {"name": "output_file", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
255
+ ],
256
+ "inputs": [],
257
+ "outputs": [{"name": "output", "artifact_type": "file", "binding": "output_file", "assertions": []}],
258
+ "validators": [],
259
+ "evidence": [],
260
+ "execution_plan": {"steps": [{"command": ["bgzip", "-c", "{input_file}"], "capture_stdout_to": "output_file", "stdout_mode": "binary"}]},
261
+ }
262
+ code = render_wrapper(ir)
263
+ self.assertIn("text=False", code)
264
+ self.assertIn("Path(output_file).write_bytes", code)
265
+ with tempfile.TemporaryDirectory() as temp:
266
+ path = Path(temp) / "server.py"
267
+ path.write_text(code)
268
+ py_compile.compile(str(path), doraise=True)
269
+
270
+ def test_native_command_substitution_includes_scalar_arguments(self) -> None:
271
+ command = substitute_command(
272
+ ["tabix", "{input_file}", "{region}"],
273
+ {"input_file": Path("input.vcf.gz"), "region": "chrTiny:1-10"},
274
+ )
275
+ self.assertEqual(command, ["tabix", "input.vcf.gz", "chrTiny:1-10"])
276
+
277
+ def test_execution_plan_format_token_supports_multiple_arguments(self) -> None:
278
+ ir = {
279
+ "ir_version": "0.1",
280
+ "tool": {"executable": "mothur", "subcommand": None},
281
+ "endpoint": {"name": "summarize", "description": "test"},
282
+ "arguments": [
283
+ {"name": "input_file", "flag": None, "kind": "positional", "value_type": "path", "required": True, "position": 0, "repeat": False, "description": "input", "pass_to_cli": False},
284
+ {"name": "output_dir", "flag": None, "kind": "option", "value_type": "path", "required": True, "position": None, "repeat": False, "description": "output", "pass_to_cli": False},
285
+ ],
286
+ "inputs": [],
287
+ "outputs": [],
288
+ "validators": [],
289
+ "evidence": [],
290
+ "execution_plan": {"steps": [{"command": ["mothur", {"format": "#set.dir(output={output_dir}); summary.seqs(fasta={input_file})"}]}]},
291
+ }
292
+ code = render_wrapper(ir)
293
+ self.assertIn("str(output_dir)", code)
294
+ self.assertIn("str(input_file)", code)
295
+ with tempfile.TemporaryDirectory() as temp:
296
+ path = Path(temp) / "server.py"
297
+ path.write_text(code)
298
+ py_compile.compile(str(path), doraise=True)
299
+
300
+
301
+ if __name__ == "__main__":
302
+ unittest.main()
Biomanus-V2/Experiment1/.sync_stage_group6/validators.py ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import gzip
5
+ import json
6
+ import os
7
+ import re
8
+ import shutil
9
+ import subprocess
10
+ import xml.etree.ElementTree as ET
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _noncomment_lines(path: Path) -> list[str]:
16
+ return [line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")]
17
+
18
+
19
+ def validate_one(spec: dict[str, Any], bindings: dict[str, Path]) -> dict[str, Any]:
20
+ target = spec["target"]
21
+ path = bindings.get(target)
22
+ kind = spec["kind"]
23
+ config = spec.get("config") or {}
24
+ result = {"name": spec.get("name", kind), "target": target, "kind": kind, "ok": False, "detail": ""}
25
+ if path is None:
26
+ result["detail"] = "target binding missing"
27
+ return result
28
+ try:
29
+ if kind == "exists":
30
+ result["ok"] = path.exists()
31
+ elif kind == "nonempty":
32
+ result["ok"] = path.is_file() and path.stat().st_size > 0
33
+ elif kind == "json":
34
+ json.loads(path.read_text(encoding="utf-8")); result["ok"] = True
35
+ elif kind in {"csv", "tsv"}:
36
+ delimiter = "," if kind == "csv" else "\t"
37
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
38
+ rows = list(csv.reader(handle, delimiter=delimiter))
39
+ minimum = int(config.get("min_columns", 1))
40
+ result["ok"] = bool(rows) and all(len(row) >= minimum for row in rows)
41
+ result["detail"] = f"rows={len(rows)}"
42
+ elif kind == "fasta":
43
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
44
+ result["ok"] = bool(lines) and lines[0].startswith(">") and any(line and not line.startswith(">") for line in lines)
45
+ elif kind == "maf":
46
+ rows = _noncomment_lines(path)
47
+ result["ok"] = any(row.startswith("a ") for row in rows) and any(row.startswith("s ") for row in rows)
48
+ elif kind == "fastq":
49
+ lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
50
+ result["ok"] = len(lines) >= 4 and len(lines) % 4 == 0 and lines[0].startswith("@") and lines[2].startswith("+")
51
+ elif kind == "bed":
52
+ rows = _noncomment_lines(path)
53
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 3 for row in rows)
54
+ elif kind == "sam":
55
+ rows = [
56
+ line
57
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
58
+ if line and not line.startswith("@")
59
+ ]
60
+ result["ok"] = bool(rows) and all(len(row.split("\t")) >= 11 for row in rows)
61
+ elif kind == "gzip":
62
+ with gzip.open(path, "rb") as handle:
63
+ handle.read(1)
64
+ result["ok"] = True
65
+ elif kind == "vcf":
66
+ text = path.read_text(encoding="utf-8", errors="replace")
67
+ rows = [line for line in text.splitlines() if line and not line.startswith("#")]
68
+ result["ok"] = "##fileformat=VCF" in text and "#CHROM" in text and all(len(row.split("\t")) >= 8 for row in rows)
69
+ elif kind == "regex":
70
+ result["ok"] = re.search(str(config["pattern"]), path.read_text(encoding="utf-8", errors="replace"), re.MULTILINE) is not None
71
+ else:
72
+ result["detail"] = f"validator kind not implemented: {kind}"
73
+ return result
74
+ except Exception as exc:
75
+ result["detail"] = f"{type(exc).__name__}: {exc}"
76
+ return result
77
+ if not result["detail"]:
78
+ result["detail"] = str(path)
79
+ return result
80
+
81
+
82
+ def validate_all(specs: list[dict[str, Any]], bindings: dict[str, Path]) -> tuple[bool, list[dict[str, Any]]]:
83
+ results = [validate_one(spec, bindings) for spec in specs]
84
+ return bool(results) and all(item["ok"] for item in results), results
85
+
86
+
87
+ def normalized_text(path: Path) -> str:
88
+ return "\n".join(line.rstrip() for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line.strip())
89
+
90
+
91
+ def normalized_bcf_records(path: Path, spec: dict[str, Any]) -> list[str]:
92
+ executable = spec.get("bcftools_executable") or os.getenv("BCFTOOLS") or shutil.which("bcftools")
93
+ if not executable:
94
+ candidates = (
95
+ "/225040511/miniconda3/envs/bioenv/bin/bcftools",
96
+ "/225040511/miniconda3/envs/bioenv_cli/bin/bcftools",
97
+ "/225040511/miniconda3/envs/biomni_e1/bin/bcftools",
98
+ )
99
+ executable = next((candidate for candidate in candidates if Path(candidate).is_file()), None)
100
+ if not executable:
101
+ raise RuntimeError("bcftools executable not found")
102
+ completed = subprocess.run(
103
+ [str(executable), "view", "-H", str(path)],
104
+ text=True,
105
+ capture_output=True,
106
+ timeout=60,
107
+ )
108
+ if completed.returncode != 0:
109
+ raise RuntimeError(completed.stderr[-2000:] or "bcftools could not parse BCF")
110
+ return sorted(line.rstrip() for line in completed.stdout.splitlines() if line.strip())
111
+
112
+
113
+ def fasta_records(path: Path) -> dict[str, str]:
114
+ records: dict[str, str] = {}
115
+ name: str | None = None
116
+ chunks: list[str] = []
117
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
118
+ if line.startswith(">"):
119
+ if name is not None:
120
+ records[name] = "".join(chunks).replace(" ", "").upper()
121
+ name = line[1:].strip().split()[0]
122
+ chunks = []
123
+ elif line.strip():
124
+ chunks.append(line.strip())
125
+ if name is not None:
126
+ records[name] = "".join(chunks).replace(" ", "").upper()
127
+ return records
128
+
129
+
130
+ def maf_semantic_rows(path: Path) -> list[str]:
131
+ return [
132
+ " ".join(line.split())
133
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
134
+ if line.startswith(("a ", "s ", "i ", "e ", "q "))
135
+ ]
136
+
137
+
138
+ def compare_oracle(spec: dict[str, Any], native: dict[str, Path], mcp: dict[str, Path]) -> dict[str, Any]:
139
+ kind = spec.get("kind")
140
+ target = spec.get("target")
141
+ left, right = native.get(target), mcp.get(target)
142
+ result = {"kind": kind, "target": target, "ok": False, "detail": ""}
143
+ if left is None or right is None or not left.exists() or not right.exists():
144
+ result["detail"] = "oracle target missing"
145
+ return result
146
+ try:
147
+ if kind == "normalized_text_equal":
148
+ result["ok"] = normalized_text(left) == normalized_text(right)
149
+ elif kind == "normalized_noncomment_text_equal":
150
+ def noncomment_text(path: Path) -> str:
151
+ return "\n".join(
152
+ line.rstrip()
153
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
154
+ if line.strip() and not line.startswith("#")
155
+ )
156
+
157
+ result["ok"] = noncomment_text(left) == noncomment_text(right)
158
+ elif kind == "json_equal":
159
+ result["ok"] = json.loads(left.read_text()) == json.loads(right.read_text())
160
+ elif kind == "record_count_equal":
161
+ result["ok"] = len(_noncomment_lines(left)) == len(_noncomment_lines(right))
162
+ elif kind == "bcf_records_equal":
163
+ result["ok"] = normalized_bcf_records(left, spec) == normalized_bcf_records(right, spec)
164
+ elif kind == "fasta_records_equal":
165
+ result["ok"] = fasta_records(left) == fasta_records(right)
166
+ elif kind == "maf_records_equal":
167
+ result["ok"] = maf_semantic_rows(left) == maf_semantic_rows(right)
168
+ elif kind == "vcf_records_equal":
169
+ result["ok"] = _noncomment_lines(left) == _noncomment_lines(right)
170
+ elif kind == "tsv_equal_ignore_columns":
171
+ ignored = {int(value) for value in spec.get("ignore_columns", [])}
172
+
173
+ def projected(path: Path) -> list[list[str]]:
174
+ with path.open("r", encoding="utf-8", errors="replace") as handle:
175
+ return [
176
+ [value for index, value in enumerate(row) if index not in ignored]
177
+ for row in csv.reader(handle, delimiter="\t")
178
+ ]
179
+
180
+ result["ok"] = projected(left) == projected(right)
181
+ elif kind == "featurecounts_table_equal":
182
+ def featurecounts_rows(path: Path) -> list[list[str]]:
183
+ rows = [
184
+ row for row in csv.reader(
185
+ (line for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("#")),
186
+ delimiter="\t",
187
+ )
188
+ ]
189
+ if rows and rows[0]:
190
+ rows[0][-1] = Path(rows[0][-1]).name
191
+ return rows
192
+
193
+ result["ok"] = featurecounts_rows(left) == featurecounts_rows(right)
194
+ elif kind == "normalized_lines_equal_unordered":
195
+ def normalized_lines(path: Path) -> list[str]:
196
+ return sorted(
197
+ " ".join(line.split())
198
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
199
+ if line.strip()
200
+ )
201
+
202
+ result["ok"] = normalized_lines(left) == normalized_lines(right)
203
+ elif kind == "binary_equal":
204
+ result["ok"] = left.read_bytes() == right.read_bytes()
205
+ elif kind == "gzip_content_equal":
206
+ with gzip.open(left, "rb") as left_handle, gzip.open(right, "rb") as right_handle:
207
+ result["ok"] = left_handle.read() == right_handle.read()
208
+ elif kind == "sam_records_equal":
209
+ def sam_records(path: Path) -> list[str]:
210
+ return [
211
+ line.rstrip()
212
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines()
213
+ if line and not line.startswith("@")
214
+ ]
215
+
216
+ result["ok"] = sam_records(left) == sam_records(right)
217
+ elif kind == "tmalign_summary_equal":
218
+ def tmalign_summary(path: Path) -> list[str]:
219
+ rows = []
220
+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
221
+ if not line or line.startswith("#"):
222
+ continue
223
+ fields = line.split("\t")
224
+ rows.append("\t".join(fields[2:]) if len(fields) >= 3 else line)
225
+ return rows
226
+
227
+ result["ok"] = tmalign_summary(left) == tmalign_summary(right)
228
+ elif kind == "krona_tree_equal":
229
+ def krona_tree(path: Path) -> tuple:
230
+ text = path.read_text(encoding="utf-8", errors="replace")
231
+ start = text.index("<krona")
232
+ end = text.index("</krona>", start) + len("</krona>")
233
+ root = ET.fromstring(text[start:end])
234
+
235
+ def canonical(node: ET.Element) -> tuple:
236
+ children = sorted((canonical(child) for child in node), key=repr)
237
+ return (node.tag, tuple(sorted(node.attrib.items())), (node.text or "").strip(), tuple(children))
238
+
239
+ return canonical(root)
240
+
241
+ result["ok"] = krona_tree(left) == krona_tree(right)
242
+ elif kind == "slow5_stats_equal":
243
+ def slow5_stats(path: Path) -> list[str]:
244
+ return [line.rstrip() for line in path.read_text(encoding="utf-8", errors="replace").splitlines() if line and not line.startswith("file path\t")]
245
+
246
+ result["ok"] = slow5_stats(left) == slow5_stats(right)
247
+ elif kind == "sourmash_signature_equal":
248
+ def sourmash_payload(path: Path) -> list[dict[str, Any]]:
249
+ payload = json.loads(path.read_text(encoding="utf-8"))
250
+ return [entry.get("signatures", []) for entry in payload]
251
+
252
+ result["ok"] = sourmash_payload(left) == sourmash_payload(right)
253
+ else:
254
+ result["detail"] = f"oracle kind not implemented: {kind}"
255
+ return result
256
+ except Exception as exc:
257
+ result["detail"] = f"{type(exc).__name__}: {exc}"
258
+ return result
259
+ result["detail"] = f"native={left}; mcp={right}"
260
+ return result
Biomanus-V2/Experiment1/CURATION_GUIDE.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gold Case 标注指南
2
+
3
+ 1. 只在 development split 上调试标注规则和 validator 实现。
4
+ 2. Test case 的标注者不得查看四种生成方法的输出。
5
+ 3. 优先选一个代表性、确定性、五分钟内完成的 CLI endpoint。
6
+ 4. Fixture 必须能被标准解析器读取;禁止使用 `BAM\\1`、空文件或伪造 H5AD 作为成功证据。
7
+ 5. 原生命令先独立跑通,再保存命令模板;不要从旧 MCP wrapper 反推标准答案。
8
+ 6. Validator 至少包含 exists、nonempty 和一种格式/结构检查。
9
+ 7. Semantic oracle 应忽略无关的绝对路径、时间戳和随机临时目录,但不能忽略生物学结果字段。
10
+ 8. 随机工具必须固定 seed;仍不稳定时使用容差或集合/记录级比较,并记录理由。
11
+ 9. 每个 case 由第二位标注者复核后将 `curation.status` 改成 `reviewed`。
12
+ 10. 最终运行前执行 `validate_cases.py --require-reviewed`,任何 pending case 都不能进入论文结果。
13
+
Biomanus-V2/Experiment1/DATASET_CARD.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Experiment 1 Dataset Card
2
+
3
+ Generated on 2026-08-21 with seed `20260821` from the current BioManus catalog and Bioconda linux-64 `current_repodata`.
4
+
5
+ ## Frozen manifests
6
+
7
+ | Manifest | Development | Test | Audit-exposed test | Manually repaired test | SHA-256 |
8
+ |---|---:|---:|---:|---:|---|
9
+ | Main | 30 | 150 | 74 | 0 | `8124754540d05363fdedb105b606529e709bc6ea8280f70d54f0d0f66df75c18` |
10
+ | Strict core | 30 | 75 | 0 | 0 | `16d3513f403c941a2e1d3aef2838c1243bbc6c9d3c4025a26561b9e59079563f` |
11
+
12
+ The cached Bioconda repodata SHA-256 is `b63bcdb7539bf1dc816ba42864b3946cf5c302b83398ed3e10b5d61373900c07`.
13
+
14
+ `seqkit` is forcibly assigned to development in both manifests because it was used for pipeline and oracle debugging.
15
+
16
+ ## Eligibility filters
17
+
18
+ Candidates must have current help text, an existing source wrapper for metadata recovery, a matching package in Bioconda repodata, a detectable native CLI literal, sufficient help content, and a biomedical keyword signal. Bioconductor/R/Perl libraries and known infrastructure-only packages are excluded from this CLI experiment.
19
+
20
+ From 913 catalog entries, 189 candidates remain after filtering. Exclusion counts are stored in `reports/dataset_report.json`.
21
+
22
+ ## Files
23
+
24
+ - Main manifest: `data/manifests/split_manifest.json`
25
+ - Strict manifest: `data/manifests/strict_split_manifest.json`
26
+ - Main case stubs: `data/cases/main_81247545/`
27
+ - Strict case stubs: `data/cases/strict_16d3513f/`
28
+ - Frozen LLM items: `data/items/main_81247545_development/` and `data/items/main_81247545_test/`
29
+ - Development fixture library: `data/fixtures/`
30
+
31
+ ## What is and is not complete
32
+
33
+ The package candidates, version/build pins, contamination flags, and splits are complete and validated. The case stubs are intentionally `pending`: a final gold benchmark still requires independent native commands, parseable per-tool fixtures, artifact validators, semantic oracles, and second-reviewer approval. The included seqkit pilot is the only completed end-to-end case and is not a test result.
34
+
35
+ ## Known limitations
36
+
37
+ The legacy catalog category labels are noisy and heavily skewed toward `single_cell`; they are used only for approximate sampling, not scientific domain claims. The main test includes automated-audit-exposed packages, so primary results should always be accompanied by the strict-core result and an exposed/unexposed stratification.
Biomanus-V2/Experiment1/EXPERIMENT_DESIGN.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 实验一设计:Evidence-Grounded BioMCP Compilation
2
+
3
+ ## 1. 研究问题
4
+
5
+ 面对未进入人工修复流程的、固定版本的 Bioconda CLI,以下方法能否生成与原生软件行为一致的 MCP 工具?
6
+
7
+ 1. Direct prompting;
8
+ 2. 旧 BioinfoMCP compiler;
9
+ 3. Contract IR + deterministic template;
10
+ 4. Contract IR + template + execution validation + 最多两次 repair。
11
+
12
+ 主终点为 T5 native–MCP semantic conformance。T0–T4 只用于定位失败发生在哪一层。
13
+
14
+ ## 2. 预注册假设
15
+
16
+ - H1:IR + template 的 T3/T4 成功率高于 direct prompting 和旧 compiler。
17
+ - H2:加入执行反馈与有限修复后,T5 高于不修复的 IR + template。
18
+ - H3:T2 startup success 显著高估 T5 semantic conformance。
19
+
20
+ 如果 H1/H2 不成立,不把该方法包装成论文贡献;优先分析失败分类并继续开发。
21
+
22
+ ## 3. 数据划分
23
+
24
+ 主清单 `split_manifest.json`:30 development + 150 repair-clean test。测试集从未进入人工/定向修复,但其中历史自动审计暴露状态会单独报告。
25
+
26
+ 严格清单 `strict_split_manifest.json`:30 development + 75 fully-unexposed test。严格测试集同时排除历史自动审计和人工修复。
27
+
28
+ 划分按旧 catalog 的 category 和机械 complexity 分层。由于旧 category 存在噪声,它只用于平衡抽样,不作为生物领域结论。最终报告应同时按 package、complexity 和 `audit_exposed` 分层。
29
+
30
+ ## 4. 实验单位
31
+
32
+ 主分析单位是 package,而不是 endpoint。一个 package 可以有多个 case,但统计时先在 package 内聚合,避免多命令软件主导总分。
33
+
34
+ 每个最终 case 必须包含:
35
+
36
+ - 固定 package/version/build;
37
+ - 不超过5分钟的 tiny fixture;
38
+ - 隐藏的 native command;
39
+ - MCP arguments;
40
+ - artifact validators;
41
+ - semantic oracle;
42
+ - 独立审核状态和审核者记录。
43
+
44
+ 生成方法只能看到 help/manual 和 package metadata,不能看到 native command、oracle 或 gold outputs。
45
+
46
+ ## 5. 公平控制
47
+
48
+ 四个方法必须固定:模型、temperature、最大输出 token、输入 help 文本、生成次数、软件环境、fixture、timeout。Repair 方法最多两次,并且只能读取结构化 counterexample;不能读取人工修复答案。
49
+
50
+ 旧 wrapper 只能作为结构诊断参考,不能作为 T5 gold。T5 gold 来自固定版本原生软件的隐藏调用和领域 oracle。
51
+
52
+ ## 6. 指标
53
+
54
+ - T0:生成 artifact;IR 方法还需通过 Contract IR 校验;
55
+ - T1:Python/schema valid;
56
+ - T2:MCP server startup + list-tools;
57
+ - T3:tiny fixture MCP invocation;
58
+ - T4:MCP artifact validators 全部通过;
59
+ - T5:原生执行成功、原生 artifact 合格、MCP artifact 合格、semantic oracle 通过。
60
+
61
+ 同时报告 token、生成耗时、执行耗时、修复次数、无效调用和 failure taxonomy。
62
+
63
+ ## 7. 统计分析
64
+
65
+ - 报告 package-level macro average;
66
+ - 同一 package 的方法差异使用 paired bootstrap 95% CI;
67
+ - 二分类配对结果使用 McNemar test;
68
+ - 分别报告主测试集、严格核心集、audit-exposed 与未暴露子集;
69
+ - 不只报告最终成功率,必须报告完整 T0–T5 funnel。
70
+
71
+ ## 8. 当前状态
72
+
73
+ - 候选与划分:已生成并冻结 SHA-256;
74
+ - 通用可解析 fixtures:已生成,仅用于开发;
75
+ - T0–T5 runner:已实现;
76
+ - seqkit development pilot:已通过 T0–T5;
77
+ - 全量 case native commands/oracles:尚待独立标注,不能把候选清单称作最终 gold benchmark。
78
+
Biomanus-V2/Experiment1/README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Experiment 1: Evidence-Grounded BioMCP Compilation
2
+
3
+ This directory implements the held-out compiler experiment for BioManus V2.
4
+ The primary question is whether a generated MCP wrapper preserves the behavior
5
+ of the native, version-pinned bioinformatics CLI. Structural similarity to an
6
+ old generated wrapper is retained only as a secondary diagnostic.
7
+
8
+ ## Experimental conditions
9
+
10
+ - `direct_prompt`: LLM writes MCP code directly from help text.
11
+ - `legacy_compiler`: existing BioinfoMCP converter output.
12
+ - `ir_template`: LLM extracts Contract IR; deterministic template writes code.
13
+ - `validated_repair`: IR/template plus execution validation and at most two
14
+ counterexample-guided repair attempts.
15
+
16
+ All conditions must use the same model, temperature, help text, token budget,
17
+ software version, fixture, and timeout.
18
+
19
+ ## Certification funnel
20
+
21
+ - T0: Contract IR produced and evidence fields present.
22
+ - T1: IR/schema and generated Python are valid.
23
+ - T2: MCP server starts and lists the expected endpoint.
24
+ - T3: a tiny fixture can be invoked.
25
+ - T4: output artifacts pass format/structure validators.
26
+ - T5: MCP and native executions satisfy the same semantic oracle.
27
+
28
+ T5 is the primary endpoint. T0-T4 are diagnostic stages.
29
+
30
+ ## Dataset policy
31
+
32
+ `scripts/build_dataset.py` intersects the current BioManus server catalog with
33
+ the current Bioconda linux-64 repodata. It pins package version/build, requires
34
+ help text and a source wrapper, and creates deterministic category/complexity
35
+ stratified splits.
36
+
37
+ The builder records two contamination flags:
38
+
39
+ - `audit_exposed`: appeared in any historical execution-audit manifest/result.
40
+ - `manual_repair_contaminated`: appeared in a path or record associated with
41
+ targeted/manual/repair runs.
42
+
43
+ The main 150-package split excludes manual/targeted repair contamination and
44
+ retains `audit_exposed` as an explicit stratification variable. A second,
45
+ stricter 75-package core split excludes both flags. After domain/CLI quality
46
+ filtering, the current catalog contains only 160 repair-clean and 83 fully
47
+ unexposed eligible CLIs. Development tools may be audit-exposed so old
48
+ debugging assets can be reused without contaminating the strict core.
49
+ Any package used for pilot debugging must be added to `forced_development` in
50
+ both configs before rebuilding and freezing manifests. `seqkit` is currently
51
+ forced because it was used to test the T0-T5 pipeline and normalize its oracle.
52
+
53
+ ## Quick start
54
+
55
+ ```bash
56
+ cd /225040511/project/Beyond_Prompt-Based_Planning/Biomanus-V2/Experiment1
57
+ python3 scripts/build_dataset.py --config configs/experiment.json
58
+ python3 scripts/build_dataset.py --config configs/strict_core.json
59
+ python3 scripts/make_pilot_fixtures.py --out data/fixtures
60
+ python3 scripts/validate_dataset.py --manifest data/manifests/split_manifest.json
61
+ python3 -m unittest discover -s tests -v
62
+ ```
63
+
64
+ Run a structural dry-run with the included example IR:
65
+
66
+ ```bash
67
+ python3 scripts/generate_wrapper.py \
68
+ --ir examples/seqkit_stats.contract.json \
69
+ --out runs/smoke/seqkit_stats_server.py
70
+ python3 scripts/run_experiment.py \
71
+ --manifest data/manifests/pilot_manifest.json \
72
+ --method ir_template \
73
+ --dry-run \
74
+ --out runs/smoke/results.jsonl
75
+ python3 scripts/summarize_results.py \
76
+ --results runs/smoke/results.jsonl \
77
+ --out reports/smoke_summary.json
78
+ ```
79
+
80
+ ## Full run protocol
81
+
82
+ 1. Build and freeze the split manifest. Save its SHA-256 in the paper logs.
83
+ 2. Manually curate fixtures/oracles only for the development split.
84
+ 3. Freeze the Contract IR schema, prompts, validators, and repair budget.
85
+ 4. Create test fixtures through a separate curator process; do not expose
86
+ expected commands or outputs to the generation methods.
87
+ 5. Run all four methods against the same frozen manifest.
88
+ 6. Report macro package-level T0-T5 rates, paired differences, bootstrap 95%
89
+ confidence intervals, resource cost, and the failure taxonomy.
90
+
91
+ Generation jobs use one frozen JSON item per package:
92
+
93
+ ```bash
94
+ python3 scripts/export_items.py \
95
+ --manifest data/manifests/split_manifest.json \
96
+ --split development \
97
+ --out data/items/main_development
98
+
99
+ python3 scripts/llm_generate.py \
100
+ --item data/items/main_development/seqkit.json \
101
+ --mode contract_ir \
102
+ --model YOUR_FROZEN_MODEL \
103
+ --out runs/generated_ir/seqkit.json
104
+
105
+ python3 scripts/generate_wrapper.py \
106
+ --ir runs/generated_ir/seqkit.json \
107
+ --out runs/generated/ir_template/seqkit_server.py
108
+ ```
109
+
110
+ `llm_generate.py` reads the API key from `OPENAI_API_KEY` by default and never
111
+ writes the key to logs. No model credential was available during repository
112
+ preparation, so only the deterministic pipeline and the included seqkit pilot
113
+ were executed; the four full generation conditions remain intentionally unrun.
114
+
115
+ ## Important limitations
116
+
117
+ - The generated manifest is a candidate benchmark, not automatically a gold
118
+ semantic benchmark. Every final test case still needs a native command and a
119
+ domain-appropriate oracle reviewed independently from wrapper generation.
120
+ - Generic placeholder fixtures from the old audit are not accepted as T4/T5
121
+ evidence. The pilot fixture generator creates parseable files, but per-tool
122
+ commands and validators must still be curated.
123
+ - Never tune prompts or repair rules on the held-out test package families.
Biomanus-V2/Experiment1/SAMPLE_EXPANSION_PLAN.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sample expansion plan
2
+
3
+ The inferential unit is one package, not one endpoint execution. Repeating the
4
+ same `seqkit` case does not increase the effective sample size.
5
+
6
+ ## Fixed target
7
+
8
+ - Primary test set: all 150 repair-clean packages in the frozen main split.
9
+ - Strict sensitivity set: the 75 fully unexposed packages in the frozen strict split.
10
+ - Development set: 30 packages, used only to freeze prompts, schemas, validators,
11
+ fixture-binding rules, and the repair budget.
12
+ - One primary endpoint per package. Additional endpoints are robustness checks and
13
+ are aggregated inside package before inference.
14
+
15
+ The primary target is fixed before test generation. Collection must not stop when
16
+ a p-value crosses 0.05, and the target must not be enlarged after inspecting method
17
+ outputs merely to obtain significance.
18
+
19
+ ## Power interpretation
20
+
21
+ The primary binary comparison uses a two-sided paired McNemar test at alpha 0.05.
22
+ With 150 packages, power is generally above 0.80 for an absolute paired difference
23
+ near 0.15 across plausible discordance rates (0.20--0.35). A 0.10 difference may
24
+ require roughly 170--290 packages, so a nonsignificant 10-point effect must be
25
+ reported with its confidence interval rather than chased by optional sampling.
26
+
27
+ ## Method-blind curation
28
+
29
+ 1. Select endpoint candidates from frozen package metadata and version-pinned help.
30
+ 2. Prefer deterministic commands finishing within five minutes on tiny fixtures.
31
+ 3. Exclude endpoints requiring network access, licensed resources, large reference
32
+ databases, GPUs, or stochastic output without a controllable seed.
33
+ 4. Run the native command first and define validators plus a semantic oracle without
34
+ viewing any generated wrapper or Contract IR.
35
+ 5. Require a second reviewer before a case enters the test manifest.
36
+ 6. Freeze case hashes, then run every method once under the same model configuration.
37
+
38
+ ## Attrition
39
+
40
+ Every excluded package remains in the screening log with a prespecified reason.
41
+ If fewer than 120 packages are curatable, the study reports the achieved precision
42
+ and power instead of replacing failures with convenient packages after seeing model
43
+ performance.
Biomanus-V2/Experiment1/SECOND_BATCH_FIXTURES.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 第二批程序调试数据、依赖与命令
2
+
3
+ ## 使用边界
4
+
5
+ 这些文件只用于计算机程序的输入输出、命令行参数和文件格式调试。它们由人工合成数据和工具官方仓库的公开测试数据组成,不包含患者、人体样本、临床信息或隐私数据,不可用于生物研究结论。
6
+
7
+ 项目根目录:
8
+
9
+ `/225040511/project/Beyond_Prompt-Based_Planning/Biomanus-V2/Experiment1`
10
+
11
+ 每个 package 的独立 Conda 安装脚本:
12
+
13
+ `scripts/install_all_pinned_envs.sh`
14
+
15
+ 第二批命令脚本(仅保存,未自动执行):
16
+
17
+ `scripts/run_second_batch_commands.sh`
18
+
19
+ ## 数据清单
20
+
21
+ | Package | 精确版本/build | 运行时输入依赖 | 已准备的 fixture | 预期输出 |
22
+ |---|---|---|---|---|
23
+ | RSeQC | `5.0.3 py310h7c593f9_3` | 坐标排序且带索引的 BAM;BED12 基因模型 | `second_batch_alignments.bam`, `.bam.bai`, `second_batch_gene_model.bed12` | `read_distribution.txt` |
24
+ | Sambamba | `1.0.1 he614052_4` | SAM/BAM;排序测试使用未排序 BAM | `second_batch_alignments.unsorted.bam` | `sorted.bam`, `sorted.bam.bai` |
25
+ | CRISPResso2 | `2.3.4 py312hfcd9dac_0` | FASTQ;扩增子序列 | `crispresso_reads.fastq`, `crispresso_amplicon.txt` | `CRISPResso_on_fixture/` 结果目录 |
26
+ | DELLY | `2.6.0 h3752d28_0` | 参考 FASTA + FAI;至少 1000 个同染色体配对;排序且带索引的 BAM | `delly_reference.fa`, `.fa.fai`, `delly_alignments.bam`, `.bam.bai` | `calls.bcf` |
27
+ | T-Coffee | `11.0.8 py36hea885bf_8` | 至少两条蛋白 FASTA 序列 | `proteins_multi.faa` | `aligned.faa` |
28
+ | UShER | `0.6.6 hdd55de9_4` | Newick 树;已有样本 VCF;待放置样本 VCF | `usher/global_phylo.nh`, `usher/global_samples.vcf`, `usher/new_samples.vcf` | `global.pb`, `placed.pb` 及树文件 |
29
+
30
+ 所有 fixture 的大小和 SHA-256 位于 `data/fixtures/fixture_manifest.json`。UShER 文件的下载地址、大小和固定校验值位于 `data/fixtures/usher/provenance.json`。
31
+
32
+ T-Coffee 11.0.8 的 Bioconda Python 包装器存在旧版绝对路径递归解析问题。命令脚本从包内 `bin` 目录以 `./t_coffee` 启动同一个精确二进制,并设置包内插件路径;没有替换 package、version 或 build。
33
+
34
+ ## 依赖管理方式
35
+
36
+ 不要把 23 个包放进同一环境。`install_all_pinned_envs.sh` 为每个 `package/version/build` 建独立 prefix,并执行两级解析:
37
+
38
+ 1. 先用当前 Conda 求解器和 `conda-forge + bioconda`;目标包用 `bioconda::` 明确限定,禁止替换 build。
39
+ 2. 对旧 Python/Perl 依赖解析失败的包,自动改用 classic solver 和完整历史 `repodata.json` 再试。
40
+ 3. 成功后在 `runs/env_locks/` 导出 explicit lock 和完整 package JSON,即为该工具的全部传递依赖。
41
+
42
+ 手工启动环境安装:
43
+
44
+ ```bash
45
+ cd /225040511/project/Beyond_Prompt-Based_Planning/Biomanus-V2/Experiment1
46
+ bash scripts/install_all_pinned_envs.sh 2>&1 | tee runs/install_all_pinned_envs.log
47
+ ```
48
+
49
+ 环境全部准备好后,如需由你手工执行第二批命令:
50
+
51
+ ```bash
52
+ cd /225040511/project/Beyond_Prompt-Based_Planning/Biomanus-V2/Experiment1
53
+ bash scripts/run_second_batch_commands.sh 2>&1 | tee runs/second_batch_native.log
54
+ ```
55
+
56
+ ## 数据来源
57
+
58
+ - RSeQC、Sambamba、CRISPResso2、DELLY 的小型输入为人工合成格式测试数据。
59
+ - T-Coffee 使用本项目已有的人工合成蛋白 FASTA。
60
+ - UShER 使用官方 GitHub 仓库 `yatisht/usher/test` 的三个公开测试文件;下载脚本固定了 SHA-256,避免上游文件静默变化。
Biomanus-V2/Experiment1/configs/backend_deepseek_v4_flash.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "provider": "deepseek",
3
+ "model": "deepseek-v4-flash",
4
+ "base_url": "https://api.deepseek.com/v1",
5
+ "api_key_env": "DEEPSEEK_API_KEY",
6
+ "thinking": "disabled",
7
+ "temperature": 0.1,
8
+ "max_output_tokens": 16384
9
+ }
Biomanus-V2/Experiment1/configs/development_pinned_envs.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "0.1",
3
+ "channels": ["bioconda", "conda-forge"],
4
+ "environment_root": "/225040511/miniconda3/envs/experiment1_pinned",
5
+ "packages": [
6
+ {"name": "arvados-cwl-runner", "version": "1.3.3.20190419203205", "build": "py36_0", "batch": "first"},
7
+ {"name": "arvados-python-client", "version": "2.0.1", "build": "py27_0", "batch": "first"},
8
+ {"name": "auspice", "version": "2.73.0", "build": "h8471819_0", "batch": "first"},
9
+ {"name": "cnvkit", "version": "0.9.6", "build": "py36_1", "batch": "first"},
10
+ {"name": "cooler", "version": "0.8.5", "build": "py36h1341992_0", "batch": "first"},
11
+ {"name": "crispresso2", "version": "2.3.4", "build": "py312hfcd9dac_0", "batch": "second"},
12
+ {"name": "delly", "version": "2.6.0", "build": "h3752d28_0", "batch": "second"},
13
+ {"name": "dxpy", "version": "0.273.0", "build": "py36_0", "batch": "first"},
14
+ {"name": "ensembl-vep", "version": "96.0", "build": "pl526hecc5488_0", "batch": "first"},
15
+ {"name": "genomepy", "version": "0.5.5", "build": "py27_0", "batch": "first"},
16
+ {"name": "kmer-jellyfish", "version": "1.1.12", "build": "h9948957_6", "batch": "first"},
17
+ {"name": "libdeflate", "version": "1.2", "build": "h516909a_1", "batch": "first"},
18
+ {"name": "phyml", "version": "3.3.20260528", "build": "h34a2149_0", "batch": "first"},
19
+ {"name": "pytabix", "version": "0.1", "build": "py311hc84137b_7", "batch": "first"},
20
+ {"name": "rseqc", "version": "5.0.3", "build": "py310h7c593f9_3", "batch": "second"},
21
+ {"name": "sambamba", "version": "1.0.1", "build": "he614052_4", "batch": "second"},
22
+ {"name": "samtools", "version": "1.7", "build": "h91fe0ab_3", "batch": "first"},
23
+ {"name": "seqfu", "version": "1.27.1", "build": "h41da26b_0", "batch": "first"},
24
+ {"name": "snakemake-minimal", "version": "5.3.0", "build": "py35_1", "batch": "first"},
25
+ {"name": "t_coffee", "version": "11.0.8", "build": "py36hea885bf_8", "batch": "second"},
26
+ {"name": "usher", "version": "0.6.6", "build": "hdd55de9_4", "batch": "second"},
27
+ {"name": "vcftools", "version": "0.1.17", "build": "pl5321h077b44d_0", "batch": "first"},
28
+ {"name": "yacrd", "version": "1.0.0", "build": "h790517f_5", "batch": "first"}
29
+ ]
30
+ }
Biomanus-V2/Experiment1/configs/experiment.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 20260821,
3
+ "development_size": 30,
4
+ "test_size": 150,
5
+ "forced_development": ["seqkit"],
6
+ "strict_holdout": false,
7
+ "quality_filter": {
8
+ "min_help_lines": 8,
9
+ "min_bio_keyword_hits": 1,
10
+ "exclude_package_prefixes": ["bioconductor-", "perl-", "r-"],
11
+ "deny_packages": ["aria2", "c-ares", "galaxy-lib", "gecode", "gnuplot", "iow", "jq", "k8", "mysql-connector-c"]
12
+ },
13
+ "source": {
14
+ "catalog": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/graph_outputs/mcp_generated_graph_all_20260522_124110/server_catalog.json",
15
+ "help_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt",
16
+ "mcp_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/mcp_generated",
17
+ "audit_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/experiments/execution_audit"
18
+ },
19
+ "bioconda": {
20
+ "repodata_url": "https://conda.anaconda.org/bioconda/linux-64/current_repodata.json.bz2",
21
+ "repodata_cache": "data/cache/bioconda-linux-64-current-repodata.json.bz2"
22
+ },
23
+ "output": {
24
+ "candidate_jsonl": "data/manifests/candidates.jsonl",
25
+ "candidate_csv": "data/manifests/candidates.csv",
26
+ "split_json": "data/manifests/split_manifest.json",
27
+ "split_csv": "data/manifests/split_manifest.csv",
28
+ "contamination_json": "data/manifests/contamination_registry.json",
29
+ "dataset_report": "reports/dataset_report.json"
30
+ },
31
+ "execution": {
32
+ "timeout_seconds": 300,
33
+ "startup_grace_seconds": 3,
34
+ "repair_budget": 2,
35
+ "temperature": 0.1,
36
+ "max_output_tokens": 4096
37
+ }
38
+ }
Biomanus-V2/Experiment1/configs/strict_core.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 20260821,
3
+ "development_size": 30,
4
+ "test_size": 75,
5
+ "forced_development": ["seqkit"],
6
+ "strict_holdout": true,
7
+ "quality_filter": {
8
+ "min_help_lines": 8,
9
+ "min_bio_keyword_hits": 1,
10
+ "exclude_package_prefixes": ["bioconductor-", "perl-", "r-"],
11
+ "deny_packages": ["aria2", "c-ares", "galaxy-lib", "gecode", "gnuplot", "iow", "jq", "k8", "mysql-connector-c"]
12
+ },
13
+ "source": {
14
+ "catalog": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/graph_outputs/mcp_generated_graph_all_20260522_124110/server_catalog.json",
15
+ "help_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt",
16
+ "mcp_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/mcp_generated",
17
+ "audit_root": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/experiments/execution_audit"
18
+ },
19
+ "bioconda": {
20
+ "repodata_url": "https://conda.anaconda.org/bioconda/linux-64/current_repodata.json.bz2",
21
+ "repodata_cache": "data/cache/bioconda-linux-64-current-repodata.json.bz2"
22
+ },
23
+ "output": {
24
+ "candidate_jsonl": "data/manifests/strict_candidates.jsonl",
25
+ "candidate_csv": "data/manifests/strict_candidates.csv",
26
+ "split_json": "data/manifests/strict_split_manifest.json",
27
+ "split_csv": "data/manifests/strict_split_manifest.csv",
28
+ "contamination_json": "data/manifests/strict_contamination_registry.json",
29
+ "dataset_report": "reports/strict_dataset_report.json"
30
+ },
31
+ "execution": {
32
+ "timeout_seconds": 300,
33
+ "startup_grace_seconds": 3,
34
+ "repair_budget": 2,
35
+ "temperature": 0.1,
36
+ "max_output_tokens": 4096
37
+ }
38
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/arvados-cwl-runner.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "arvados-cwl-runner_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "arvados-cwl-runner",
5
+ "package": "arvados-cwl-runner",
6
+ "version": "1.3.3.20190419203205",
7
+ "build": "py36_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/arvados-cwl-runner.txt",
9
+ "suggested_native_executables": [
10
+ "arvados-cwl-runner"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/arvados-python-client.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "arvados-python-client_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "arvados-python-client",
5
+ "package": "arvados-python-client",
6
+ "version": "2.0.1",
7
+ "build": "py27_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/arvados-python-client.txt",
9
+ "suggested_native_executables": [
10
+ "arv-get",
11
+ "arv-put",
12
+ "arv-ls",
13
+ "arv-copy",
14
+ "arv-tag"
15
+ ],
16
+ "endpoint": "TODO",
17
+ "contract_ir": null,
18
+ "fixture_bindings": {},
19
+ "arguments": {},
20
+ "native": {
21
+ "command": []
22
+ },
23
+ "outputs": {},
24
+ "validators": [],
25
+ "semantic_oracle": {
26
+ "kind": "TODO",
27
+ "target": "TODO"
28
+ },
29
+ "curation": {
30
+ "status": "pending",
31
+ "curator": "",
32
+ "reviewer": "",
33
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
34
+ }
35
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/auspice.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "auspice_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "auspice",
5
+ "package": "auspice",
6
+ "version": "2.73.0",
7
+ "build": "h8471819_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/auspice.txt",
9
+ "suggested_native_executables": [
10
+ "auspice"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/cnvkit.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "cnvkit_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "cnvkit",
5
+ "package": "cnvkit",
6
+ "version": "0.9.6",
7
+ "build": "py36_1",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/cnvkit.txt",
9
+ "suggested_native_executables": [
10
+ "cnvkit.py"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/cooler.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "cooler_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "cooler",
5
+ "package": "cooler",
6
+ "version": "0.8.5",
7
+ "build": "py36h1341992_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/cooler.txt",
9
+ "suggested_native_executables": [
10
+ "cooler"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/crispresso2.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "crispresso2_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "crispresso2",
5
+ "package": "crispresso2",
6
+ "version": "2.3.4",
7
+ "build": "py312hfcd9dac_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/crispresso2.txt",
9
+ "suggested_native_executables": [
10
+ "crispresso",
11
+ "crispressobatch",
12
+ "crispressopooled",
13
+ "crispressowgs",
14
+ "crispressocompare",
15
+ "crispressoaggregate"
16
+ ],
17
+ "endpoint": "TODO",
18
+ "contract_ir": null,
19
+ "fixture_bindings": {},
20
+ "arguments": {},
21
+ "native": {
22
+ "command": []
23
+ },
24
+ "outputs": {},
25
+ "validators": [],
26
+ "semantic_oracle": {
27
+ "kind": "TODO",
28
+ "target": "TODO"
29
+ },
30
+ "curation": {
31
+ "status": "pending",
32
+ "curator": "",
33
+ "reviewer": "",
34
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
35
+ }
36
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/delly.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "delly_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "delly",
5
+ "package": "delly",
6
+ "version": "2.6.0",
7
+ "build": "h3752d28_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/delly.txt",
9
+ "suggested_native_executables": [
10
+ "delly"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/dxpy.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "dxpy_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "dxpy",
5
+ "package": "dxpy",
6
+ "version": "0.273.0",
7
+ "build": "py36_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/dxpy.txt",
9
+ "suggested_native_executables": [
10
+ "dx"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/ensembl-vep.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "ensembl-vep_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "ensembl-vep",
5
+ "package": "ensembl-vep",
6
+ "version": "96.0",
7
+ "build": "pl526hecc5488_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/ensembl-vep.txt",
9
+ "suggested_native_executables": [
10
+ "vep",
11
+ "haplo",
12
+ "variant_recoder"
13
+ ],
14
+ "endpoint": "TODO",
15
+ "contract_ir": null,
16
+ "fixture_bindings": {},
17
+ "arguments": {},
18
+ "native": {
19
+ "command": []
20
+ },
21
+ "outputs": {},
22
+ "validators": [],
23
+ "semantic_oracle": {
24
+ "kind": "TODO",
25
+ "target": "TODO"
26
+ },
27
+ "curation": {
28
+ "status": "pending",
29
+ "curator": "",
30
+ "reviewer": "",
31
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
32
+ }
33
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/genomepy.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "genomepy_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "genomepy",
5
+ "package": "genomepy",
6
+ "version": "0.5.5",
7
+ "build": "py27_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/genomepy.txt",
9
+ "suggested_native_executables": [
10
+ "genomepy"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/gofasta.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "gofasta_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "gofasta",
5
+ "package": "gofasta",
6
+ "version": "1.2.3",
7
+ "build": "h9ee0642_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/gofasta.txt",
9
+ "suggested_native_executables": [
10
+ "gofasta"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kalign2.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "kalign2_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "kalign2",
5
+ "package": "kalign2",
6
+ "version": "2.04",
7
+ "build": "h7b50bb2_8",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/kalign2.txt",
9
+ "suggested_native_executables": [
10
+ "kalign2"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kmer-jellyfish.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "kmer-jellyfish_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "kmer-jellyfish",
5
+ "package": "kmer-jellyfish",
6
+ "version": "1.1.12",
7
+ "build": "h9948957_6",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/kmer-jellyfish.txt",
9
+ "suggested_native_executables": [
10
+ "jellyfish"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/kraken2.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "kraken2_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "kraken2",
5
+ "package": "kraken2",
6
+ "version": "2.17.1",
7
+ "build": "pl5321h077b44d_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/kraken2.txt",
9
+ "suggested_native_executables": [
10
+ "kraken2",
11
+ "kraken2-build",
12
+ "kraken2-inspect"
13
+ ],
14
+ "endpoint": "TODO",
15
+ "contract_ir": null,
16
+ "fixture_bindings": {},
17
+ "arguments": {},
18
+ "native": {
19
+ "command": []
20
+ },
21
+ "outputs": {},
22
+ "validators": [],
23
+ "semantic_oracle": {
24
+ "kind": "TODO",
25
+ "target": "TODO"
26
+ },
27
+ "curation": {
28
+ "status": "pending",
29
+ "curator": "",
30
+ "reviewer": "",
31
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
32
+ }
33
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/lastz.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "lastz_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "lastz",
5
+ "package": "lastz",
6
+ "version": "1.04.52",
7
+ "build": "h7b50bb2_1",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/lastz.txt",
9
+ "suggested_native_executables": [
10
+ "lastz"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/libdeflate.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "libdeflate_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "libdeflate",
5
+ "package": "libdeflate",
6
+ "version": "1.2",
7
+ "build": "h516909a_1",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/libdeflate.txt",
9
+ "suggested_native_executables": [
10
+ "libdeflate-gzip",
11
+ "libdeflate-gunzip",
12
+ "benchmark",
13
+ "checksum"
14
+ ],
15
+ "endpoint": "TODO",
16
+ "contract_ir": null,
17
+ "fixture_bindings": {},
18
+ "arguments": {},
19
+ "native": {
20
+ "command": []
21
+ },
22
+ "outputs": {},
23
+ "validators": [],
24
+ "semantic_oracle": {
25
+ "kind": "TODO",
26
+ "target": "TODO"
27
+ },
28
+ "curation": {
29
+ "status": "pending",
30
+ "curator": "",
31
+ "reviewer": "",
32
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
33
+ }
34
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/multiqc-bcbio.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "multiqc-bcbio_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "multiqc-bcbio",
5
+ "package": "multiqc-bcbio",
6
+ "version": "0.2.6",
7
+ "build": "py36_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/multiqc-bcbio.txt",
9
+ "suggested_native_executables": [
10
+ "multiqc"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/phyml.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "phyml_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "phyml",
5
+ "package": "phyml",
6
+ "version": "3.3.20260528",
7
+ "build": "h34a2149_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/phyml.txt",
9
+ "suggested_native_executables": [
10
+ "phyml"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/pytabix.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "pytabix_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "pytabix",
5
+ "package": "pytabix",
6
+ "version": "0.1",
7
+ "build": "py311hc84137b_7",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/pytabix.txt",
9
+ "suggested_native_executables": [
10
+ "bgzip",
11
+ "tabix"
12
+ ],
13
+ "endpoint": "TODO",
14
+ "contract_ir": null,
15
+ "fixture_bindings": {},
16
+ "arguments": {},
17
+ "native": {
18
+ "command": []
19
+ },
20
+ "outputs": {},
21
+ "validators": [],
22
+ "semantic_oracle": {
23
+ "kind": "TODO",
24
+ "target": "TODO"
25
+ },
26
+ "curation": {
27
+ "status": "pending",
28
+ "curator": "",
29
+ "reviewer": "",
30
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
31
+ }
32
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/rseqc.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "rseqc_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "rseqc",
5
+ "package": "rseqc",
6
+ "version": "5.0.3",
7
+ "build": "py310h7c593f9_3",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/rseqc.txt",
9
+ "suggested_native_executables": [
10
+ "bam2fq.py",
11
+ "bam2wig.py",
12
+ "bam_stat.py",
13
+ "clipping_profile.py",
14
+ "deletion_profile.py",
15
+ "divide_bam.py",
16
+ "fpkm_count.py",
17
+ "fpkm-uq.py",
18
+ "genebody_coverage.py",
19
+ "infer_experiment.py",
20
+ "inner_distance.py",
21
+ "junction_annotation.py",
22
+ "read_distribution.py",
23
+ "read_duplication.py",
24
+ "tin.py",
25
+ "sc_bamstat.py",
26
+ "mismatch_profile.py",
27
+ "insertion_profile.py"
28
+ ],
29
+ "endpoint": "TODO",
30
+ "contract_ir": null,
31
+ "fixture_bindings": {},
32
+ "arguments": {},
33
+ "native": {
34
+ "command": []
35
+ },
36
+ "outputs": {},
37
+ "validators": [],
38
+ "semantic_oracle": {
39
+ "kind": "TODO",
40
+ "target": "TODO"
41
+ },
42
+ "curation": {
43
+ "status": "pending",
44
+ "curator": "",
45
+ "reviewer": "",
46
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
47
+ }
48
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/sage-proteomics.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "sage-proteomics_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "sage-proteomics",
5
+ "package": "sage-proteomics",
6
+ "version": "0.14.7",
7
+ "build": "hc1c3326_2",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/sage-proteomics.txt",
9
+ "suggested_native_executables": [
10
+ "sage"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/sambamba.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "sambamba_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "sambamba",
5
+ "package": "sambamba",
6
+ "version": "1.0.1",
7
+ "build": "he614052_4",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/sambamba.txt",
9
+ "suggested_native_executables": [
10
+ "sambamba"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/samtools.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "samtools_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "samtools",
5
+ "package": "samtools",
6
+ "version": "1.7",
7
+ "build": "h91fe0ab_3",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/samtools.txt",
9
+ "suggested_native_executables": [
10
+ "samtools",
11
+ "dict",
12
+ "faidx",
13
+ "fqidx",
14
+ "index",
15
+ "calmd",
16
+ "fixmate",
17
+ "reheader",
18
+ "targetcut",
19
+ "addreplacerg",
20
+ "markdup",
21
+ "collate",
22
+ "cat",
23
+ "merge",
24
+ "mpileup",
25
+ "sort",
26
+ "split",
27
+ "quickcheck",
28
+ "fastq",
29
+ "fasta",
30
+ "bedcov",
31
+ "depth",
32
+ "flagstat",
33
+ "idxstats",
34
+ "phase",
35
+ "stats",
36
+ "flags",
37
+ "tview",
38
+ "view",
39
+ "depad"
40
+ ],
41
+ "endpoint": "TODO",
42
+ "contract_ir": null,
43
+ "fixture_bindings": {},
44
+ "arguments": {},
45
+ "native": {
46
+ "command": []
47
+ },
48
+ "outputs": {},
49
+ "validators": [],
50
+ "semantic_oracle": {
51
+ "kind": "TODO",
52
+ "target": "TODO"
53
+ },
54
+ "curation": {
55
+ "status": "pending",
56
+ "curator": "",
57
+ "reviewer": "",
58
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
59
+ }
60
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/seqfu.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "seqfu_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "seqfu",
5
+ "package": "seqfu",
6
+ "version": "1.27.1",
7
+ "build": "h41da26b_0",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/seqfu.txt",
9
+ "suggested_native_executables": [
10
+ "seqfu"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/snakemake-minimal.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "snakemake-minimal_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "snakemake-minimal",
5
+ "package": "snakemake-minimal",
6
+ "version": "5.3.0",
7
+ "build": "py35_1",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/snakemake-minimal.txt",
9
+ "suggested_native_executables": [
10
+ "snakemake"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }
Biomanus-V2/Experiment1/data/archive/pre_forced_development/cases_main/development/t_coffee.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "t_coffee_CASE_TODO",
3
+ "split": "development",
4
+ "server_name": "t_coffee",
5
+ "package": "t_coffee",
6
+ "version": "11.0.8",
7
+ "build": "py36hea885bf_8",
8
+ "help_path": "/225040511/project/Beyond_Prompt-Based_Planning/Biomanus/biomni_web/backend/data/merged_prefer_help_txt/t_coffee.txt",
9
+ "suggested_native_executables": [
10
+ "t_coffee"
11
+ ],
12
+ "endpoint": "TODO",
13
+ "contract_ir": null,
14
+ "fixture_bindings": {},
15
+ "arguments": {},
16
+ "native": {
17
+ "command": []
18
+ },
19
+ "outputs": {},
20
+ "validators": [],
21
+ "semantic_oracle": {
22
+ "kind": "TODO",
23
+ "target": "TODO"
24
+ },
25
+ "curation": {
26
+ "status": "pending",
27
+ "curator": "",
28
+ "reviewer": "",
29
+ "notes": "Choose one representative endpoint; native oracle must be independent of generated wrappers."
30
+ }
31
+ }