Download construction/tests/test_normalisation_pipeline.py from HFMI-PROFOUND/BILBY-PRO: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/datasets/HFMI-PROFOUND/BILBY-PRO/resolve/main/construction/tests/test_normalisation_pipeline.py
- Command line
-
hf download hf://datasets/HFMI-PROFOUND/BILBY-PRO/construction/tests/test_normalisation_pipeline.py
-
curl -L -o test_normalisation_pipeline.py https://huggingface.co/datasets/HFMI-PROFOUND/BILBY-PRO/resolve/main/construction/tests/test_normalisation_pipeline.py
2.24 kB
| # Copyright 2026 Emile de Bruyn | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from pathlib import Path | |
| import pandas as pd | |
| from motifbench_prosite.normalisation import NormalisationConfig, run_normalisation | |
| from test_normalisation_pdb import _write_tiny_pdb | |
| def test_run_normalisation_roundtrip(tmp_path: Path): | |
| output_root = tmp_path / "motifbench_candidates" | |
| output_root.mkdir(parents=True, exist_ok=True) | |
| motif_pdb_dir = output_root / "motif_pdbs" | |
| motif_pdb_dir.mkdir() | |
| benchmark_id = "01_FOO" | |
| pdb_path = motif_pdb_dir / f"{benchmark_id}.pdb" | |
| _write_tiny_pdb(pdb_path, chain_id="L", n_res=3) | |
| meta_df = pd.DataFrame( | |
| [ | |
| { | |
| "benchmark_pdb_id": benchmark_id, | |
| "motif_segments": "L24-26", | |
| "redesignable_segments": "L24-25", | |
| "not_motif_segments": "L23;L27", | |
| } | |
| ] | |
| ) | |
| meta_path = output_root / "motif_cases_metadata.csv" | |
| meta_df.to_csv(meta_path, index=False) | |
| test_df = pd.DataFrame( | |
| [ | |
| { | |
| "pdb_id": benchmark_id, | |
| "motif_residues": "L24-26", | |
| "redesign_idcs": "L24-25", | |
| "length": 75, | |
| "group": 4, | |
| "not_motif": "L23;L27", | |
| } | |
| ] | |
| ) | |
| test_path = output_root / "test_cases.csv" | |
| test_df.to_csv(test_path, index=False) | |
| contig_df = pd.DataFrame( | |
| [ | |
| { | |
| "problem": benchmark_id, | |
| "length": 75, | |
| "contig": "0-10;L24-26;0-10", | |
| } | |
| ] | |
| ) | |
| contig_path = output_root / "contig_specifications.csv" | |
| contig_df.to_csv(contig_path, index=False) | |
| cfg = NormalisationConfig(output_root=output_root, backup_originals=False) | |
| new_meta, new_test, new_contig = run_normalisation(cfg) | |
| assert new_meta.loc[0, "motif_segments"] == "A1-3" | |
| assert new_meta.loc[0, "redesignable_segments"] == "A1-2" | |
| assert new_meta.loc[0, "not_motif_segments"] == "" | |
| assert new_test.loc[0, "motif_residues"] == "A1-3" | |
| assert new_test.loc[0, "redesign_idcs"] == "A1-2" | |
| assert new_test.loc[0, "not_motif"] == "" | |
| assert new_contig.loc[0, "contig"] == "0-10;A1-3;0-10" | |