Datasets:
Modalities:
Tabular
Formats:
json
Languages:
English
Size:
< 1K
Tags:
glycomics
compositional-data
benchmark
batch-effect-correction
workflow-recommendation
paired-data
License:
Download validate_benchmark.py from xiaokui17/GlycoDA-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/datasets/xiaokui17/GlycoDA-Bench/resolve/main/validate_benchmark.py
- Command line
-
hf download hf://datasets/xiaokui17/GlycoDA-Bench/validate_benchmark.py
-
curl -L -o validate_benchmark.py https://huggingface.co/datasets/xiaokui17/GlycoDA-Bench/resolve/main/validate_benchmark.py
1.84 kB
| """Read-only validation for the corrected GlycoDA-Bench dataset.""" | |
| from __future__ import annotations | |
| import argparse | |
| import hashlib | |
| from pathlib import Path | |
| from generate_benchmark import SCRIPT_ROOT, validate_dataset | |
| def _verify_checksums(root: Path) -> tuple[int, list[str]]: | |
| checksum_path = root / "checksums.sha256" | |
| if not checksum_path.is_file(): | |
| return 0, ["checksums.sha256 is missing"] | |
| checked = 0 | |
| errors: list[str] = [] | |
| for line in checksum_path.read_text(encoding="utf-8").splitlines(): | |
| if not line.strip(): | |
| continue | |
| expected, relative = line.split(" ", 1) | |
| path = root / relative | |
| if not path.is_file(): | |
| errors.append(f"missing: {relative}") | |
| continue | |
| digest = hashlib.sha256() | |
| with path.open("rb") as handle: | |
| for chunk in iter(lambda: handle.read(1024 * 1024), b""): | |
| digest.update(chunk) | |
| actual = digest.hexdigest() | |
| checked += 1 | |
| if actual != expected: | |
| errors.append(f"checksum mismatch: {relative}") | |
| return checked, errors | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--root", default=str(SCRIPT_ROOT / "dataset")) | |
| parser.add_argument("--expected-cases", type=int, default=648) | |
| parser.add_argument("--verify-checksums", action="store_true") | |
| args = parser.parse_args() | |
| root = Path(args.root).resolve() | |
| report = validate_dataset(root, expected_cases=args.expected_cases) | |
| if args.verify_checksums: | |
| checked, errors = _verify_checksums(root) | |
| if errors: | |
| raise AssertionError("Checksum validation failed:\n" + "\n".join(errors[:50])) | |
| report["checksums_verified"] = checked | |
| print(report) | |
| if __name__ == "__main__": | |
| main() | |