File size: 1,761 Bytes
2ad85cb
881cb3b
2ad85cb
 
 
 
 
 
881cb3b
 
70a5538
2ad85cb
 
881cb3b
 
 
 
 
2ad85cb
881cb3b
2ad85cb
 
881cb3b
70a5538
881cb3b
 
2ad85cb
 
 
 
 
881cb3b
 
2ad85cb
 
881cb3b
 
2ad85cb
881cb3b
 
2ad85cb
 
881cb3b
 
70a5538
881cb3b
70a5538
881cb3b
2ad85cb
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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()