Download examples/01_create_featureless_anndata.py from AlejandroGZ/DRMHB: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/datasets/AlejandroGZ/DRMHB/resolve/main/examples/01_create_featureless_anndata.py
- Command line
-
hf download hf://datasets/AlejandroGZ/DRMHB/examples/01_create_featureless_anndata.py
-
curl -L -o 01_create_featureless_anndata.py https://huggingface.co/datasets/AlejandroGZ/DRMHB/resolve/main/examples/01_create_featureless_anndata.py
1.76 kB
| #!/usr/bin/env python3 | |
| """Import a DRMHB ZIP or directory with full ground truth (no features).""" | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from drmhb_workflow import create_base, positive_int | |
| from vibframe_anndata import validate_streamed_h5ad | |
| def parse_args() -> argparse.Namespace: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("vibframe", type=Path) | |
| parser.add_argument("output", type=Path) | |
| parser.add_argument("--block-size-mib", type=positive_int, default=8) | |
| parser.add_argument("--dtype", choices=("float32", "float64"), default="float32") | |
| parser.add_argument( | |
| "--ground-truth-scope", choices=("all", "snapshot", "none"), default="all" | |
| ) | |
| parser.add_argument( | |
| "--without-ground-truth", action="store_true", help="Alias for scope=none" | |
| ) | |
| parser.add_argument("--max-sidecar-mib", type=positive_int, default=512) | |
| parser.add_argument("--overwrite", action="store_true") | |
| return parser.parse_args() | |
| def main() -> None: | |
| args = parse_args() | |
| scope = "none" if args.without_ground_truth else args.ground_truth_scope | |
| output = create_base( | |
| args.vibframe, | |
| args.output, | |
| scope=scope, | |
| dtype=args.dtype, | |
| block_size_mib=args.block_size_mib, | |
| max_sidecar_mib=args.max_sidecar_mib, | |
| overwrite=args.overwrite, | |
| ) | |
| print(f"Created: {output}") | |
| for key, value in validate_streamed_h5ad(output).items(): | |
| print(f"{key}: {value}") | |
| print( | |
| f"File size: {output.stat().st_size / 1024**3:.3f} GiB; ground truth scope: {scope}" | |
| ) | |
| print("Evaluation is outside X/obs. block-size-mib is not a total RAM limit.") | |
| if __name__ == "__main__": | |
| main() | |