AlejandroGZ commited on
Commit
1691349
·
verified ·
1 Parent(s): 73039f1

Delete 02_inspect_anndata.py

Browse files
Files changed (1) hide show
  1. 02_inspect_anndata.py +0 -81
02_inspect_anndata.py DELETED
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Inspect a DRMHB AnnData produced locally from the distributed VibFrame archive.
4
-
5
- The file is opened in backed read-only mode so the raw multi-gigabyte arrays are
6
- not loaded into RAM.
7
-
8
- Install:
9
- python -m pip install "vibframe-anndata==0.2.0" "anndata>=0.10,<0.13"
10
-
11
- Usage:
12
- python examples/02_inspect_anndata.py DRMHB.float32.h5ad
13
- """
14
-
15
- from __future__ import annotations
16
-
17
- import argparse
18
- from pathlib import Path
19
-
20
- import anndata as ad
21
-
22
- from vibframe_anndata import validate_streamed_h5ad
23
-
24
-
25
- def parse_args() -> argparse.Namespace:
26
- parser = argparse.ArgumentParser(
27
- description="Inspect a DRMHB AnnData without loading the full raw payload."
28
- )
29
- parser.add_argument("h5ad", type=Path, help="Path to a generated DRMHB .h5ad.")
30
- return parser.parse_args()
31
-
32
-
33
- def main() -> None:
34
- args = parse_args()
35
-
36
- if not args.h5ad.is_file():
37
- raise FileNotFoundError(args.h5ad)
38
-
39
- validation = validate_streamed_h5ad(args.h5ad)
40
- print("Streamed-H5AD validation:")
41
- print(validation)
42
- print()
43
-
44
- adata = ad.read_h5ad(args.h5ad, backed="r")
45
-
46
- try:
47
- print(adata)
48
- print()
49
- print("X shape:", adata.shape)
50
- print("obs columns:")
51
- for column in adata.obs.columns:
52
- print(" -", column)
53
-
54
- print()
55
- print("obsm keys:")
56
- for key in adata.obsm.keys():
57
- print(" -", key)
58
-
59
- print()
60
- print("uns keys:")
61
- for key in adata.uns.keys():
62
- print(" -", key)
63
-
64
- print()
65
- print("First observations:")
66
- print(adata.obs.head())
67
-
68
- if adata.n_vars == 0:
69
- print(
70
- "\nThis is a featureless base AnnData. "
71
- "Use examples/03_add_features.py to derive features from the "
72
- "raw signals already stored in the H5AD."
73
- )
74
- finally:
75
- # Backed AnnData keeps an HDF5 handle open.
76
- if getattr(adata, "file", None) is not None:
77
- adata.file.close()
78
-
79
-
80
- if __name__ == "__main__":
81
- main()