Upload 4 files
Browse files- examples/01_create_featureless_anndata.py +40 -16
- examples/02_inspect_anndata.py +37 -14
- examples/03_add_features.py +18 -13
- examples/README.md +49 -12
examples/01_create_featureless_anndata.py
CHANGED
|
@@ -1,20 +1,24 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Create a featureless AnnData
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
Install:
|
| 9 |
-
python -m pip install "vibframe-anndata==0.2.
|
| 10 |
|
| 11 |
Usage:
|
| 12 |
python examples/01_create_featureless_anndata.py \
|
| 13 |
DRMHB.vibframe.zip \
|
| 14 |
DRMHB.float32.h5ad
|
| 15 |
-
|
| 16 |
-
The resulting AnnData contains raw spectra/waveforms and metadata, but no
|
| 17 |
-
engineered features in X.
|
| 18 |
"""
|
| 19 |
|
| 20 |
from __future__ import annotations
|
|
@@ -28,20 +32,22 @@ from vibframe_anndata import (
|
|
| 28 |
validate_streamed_h5ad,
|
| 29 |
)
|
| 30 |
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def parse_args() -> argparse.Namespace:
|
| 33 |
parser = argparse.ArgumentParser(
|
| 34 |
-
description="Convert
|
| 35 |
)
|
| 36 |
parser.add_argument(
|
| 37 |
"vibframe",
|
| 38 |
type=Path,
|
| 39 |
-
help="Path to the DRMHB
|
| 40 |
)
|
| 41 |
parser.add_argument(
|
| 42 |
"output",
|
| 43 |
type=Path,
|
| 44 |
-
help="Destination .h5ad
|
| 45 |
)
|
| 46 |
parser.add_argument(
|
| 47 |
"--block-size-mib",
|
|
@@ -55,15 +61,23 @@ def parse_args() -> argparse.Namespace:
|
|
| 55 |
default="float32",
|
| 56 |
help="Numerical storage dtype (default: float32).",
|
| 57 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
return parser.parse_args()
|
| 59 |
|
| 60 |
|
| 61 |
def main() -> None:
|
| 62 |
args = parse_args()
|
| 63 |
|
| 64 |
-
if vibframe_anndata_version !=
|
| 65 |
raise RuntimeError(
|
| 66 |
-
"This example is validated for vibframe-anndata==
|
| 67 |
f"active version: {vibframe_anndata_version!r}"
|
| 68 |
)
|
| 69 |
|
|
@@ -75,16 +89,22 @@ def main() -> None:
|
|
| 75 |
config = {
|
| 76 |
"version": 1,
|
| 77 |
"raw_import": {
|
| 78 |
-
# DRMHB contains both signal families. Keep the explicit settings
|
| 79 |
-
# here so that the example documents the intended conversion.
|
| 80 |
"waveforms": True,
|
| 81 |
"spectra": True,
|
| 82 |
"on_missing_signal": "nan",
|
| 83 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
"output": {
|
| 85 |
"dtype": args.dtype,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
},
|
| 87 |
-
# Empty by design: the base AnnData
|
| 88 |
"features": [],
|
| 89 |
}
|
| 90 |
|
|
@@ -100,7 +120,11 @@ def main() -> None:
|
|
| 100 |
print(f"Created: {output}")
|
| 101 |
print(f"Observations: {validation['n_obs']:,}")
|
| 102 |
print(f"Variables/features: {validation['n_vars']:,}")
|
| 103 |
-
print("
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
if __name__ == "__main__":
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Create a featureless DRMHB AnnData from the distributed VibFrame archive.
|
| 4 |
|
| 5 |
+
Validated with:
|
| 6 |
+
vibframe-anndata==0.2.2
|
| 7 |
+
|
| 8 |
+
DRMHB is distributed canonically as VibFrame. This script demonstrates the
|
| 9 |
+
recommended out-of-core conversion into a reusable featureless H5AD.
|
| 10 |
+
|
| 11 |
+
The 0.2.2 release can also ingest DRMHB snapshot-level evaluation truth from
|
| 12 |
+
evaluation/snapshot_truth/ and store it in obsm["ground_truth"] without exposing
|
| 13 |
+
those labels as model features.
|
| 14 |
|
| 15 |
Install:
|
| 16 |
+
python -m pip install "vibframe-anndata==0.2.2"
|
| 17 |
|
| 18 |
Usage:
|
| 19 |
python examples/01_create_featureless_anndata.py \
|
| 20 |
DRMHB.vibframe.zip \
|
| 21 |
DRMHB.float32.h5ad
|
|
|
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
from __future__ import annotations
|
|
|
|
| 32 |
validate_streamed_h5ad,
|
| 33 |
)
|
| 34 |
|
| 35 |
+
EXPECTED_VERSION = "0.2.2"
|
| 36 |
+
|
| 37 |
|
| 38 |
def parse_args() -> argparse.Namespace:
|
| 39 |
parser = argparse.ArgumentParser(
|
| 40 |
+
description="Convert DRMHB VibFrame into a featureless AnnData."
|
| 41 |
)
|
| 42 |
parser.add_argument(
|
| 43 |
"vibframe",
|
| 44 |
type=Path,
|
| 45 |
+
help="Path to the DRMHB VibFrame ZIP archive.",
|
| 46 |
)
|
| 47 |
parser.add_argument(
|
| 48 |
"output",
|
| 49 |
type=Path,
|
| 50 |
+
help="Destination .h5ad path.",
|
| 51 |
)
|
| 52 |
parser.add_argument(
|
| 53 |
"--block-size-mib",
|
|
|
|
| 61 |
default="float32",
|
| 62 |
help="Numerical storage dtype (default: float32).",
|
| 63 |
)
|
| 64 |
+
parser.add_argument(
|
| 65 |
+
"--without-ground-truth",
|
| 66 |
+
action="store_true",
|
| 67 |
+
help=(
|
| 68 |
+
"Do not ingest evaluation/snapshot_truth into obsm['ground_truth']. "
|
| 69 |
+
"By default DRMHB ground truth is imported explicitly for evaluation."
|
| 70 |
+
),
|
| 71 |
+
)
|
| 72 |
return parser.parse_args()
|
| 73 |
|
| 74 |
|
| 75 |
def main() -> None:
|
| 76 |
args = parse_args()
|
| 77 |
|
| 78 |
+
if vibframe_anndata_version != EXPECTED_VERSION:
|
| 79 |
raise RuntimeError(
|
| 80 |
+
f"This example is validated for vibframe-anndata=={EXPECTED_VERSION}; "
|
| 81 |
f"active version: {vibframe_anndata_version!r}"
|
| 82 |
)
|
| 83 |
|
|
|
|
| 89 |
config = {
|
| 90 |
"version": 1,
|
| 91 |
"raw_import": {
|
|
|
|
|
|
|
| 92 |
"waveforms": True,
|
| 93 |
"spectra": True,
|
| 94 |
"on_missing_signal": "nan",
|
| 95 |
},
|
| 96 |
+
"ground_truth": {
|
| 97 |
+
"enabled": not args.without_ground_truth,
|
| 98 |
+
"on_missing": "error",
|
| 99 |
+
},
|
| 100 |
"output": {
|
| 101 |
"dtype": args.dtype,
|
| 102 |
+
# Explicitly use the 0.2.2 default. Compression is lossless but the
|
| 103 |
+
# package benchmark shows that compressed raw payloads materially
|
| 104 |
+
# slow later feature enrichment for this DRMHB-sized workload.
|
| 105 |
+
"raw_compression": "none",
|
| 106 |
},
|
| 107 |
+
# Empty by design: the base AnnData contains raw reusable signals only.
|
| 108 |
"features": [],
|
| 109 |
}
|
| 110 |
|
|
|
|
| 120 |
print(f"Created: {output}")
|
| 121 |
print(f"Observations: {validation['n_obs']:,}")
|
| 122 |
print(f"Variables/features: {validation['n_vars']:,}")
|
| 123 |
+
print("Expected featureless base: n_vars = 0")
|
| 124 |
+
print(
|
| 125 |
+
"Ground truth:",
|
| 126 |
+
"disabled" if args.without_ground_truth else "stored in obsm['ground_truth']",
|
| 127 |
+
)
|
| 128 |
|
| 129 |
|
| 130 |
if __name__ == "__main__":
|
examples/02_inspect_anndata.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Inspect a DRMHB AnnData
|
| 4 |
|
| 5 |
-
The
|
| 6 |
-
not loaded into RAM.
|
| 7 |
|
| 8 |
Install:
|
| 9 |
-
python -m pip install "vibframe-anndata==0.2.
|
| 10 |
|
| 11 |
Usage:
|
| 12 |
python examples/02_inspect_anndata.py DRMHB.float32.h5ad
|
|
@@ -19,12 +19,17 @@ from pathlib import Path
|
|
| 19 |
|
| 20 |
import anndata as ad
|
| 21 |
|
| 22 |
-
from vibframe_anndata import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def parse_args() -> argparse.Namespace:
|
| 26 |
parser = argparse.ArgumentParser(
|
| 27 |
-
description="Inspect a
|
| 28 |
)
|
| 29 |
parser.add_argument("h5ad", type=Path, help="Path to a generated DRMHB .h5ad.")
|
| 30 |
return parser.parse_args()
|
|
@@ -33,6 +38,12 @@ def parse_args() -> argparse.Namespace:
|
|
| 33 |
def main() -> None:
|
| 34 |
args = parse_args()
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
if not args.h5ad.is_file():
|
| 37 |
raise FileNotFoundError(args.h5ad)
|
| 38 |
|
|
@@ -47,24 +58,37 @@ def main() -> None:
|
|
| 47 |
print(adata)
|
| 48 |
print()
|
| 49 |
print("X shape:", adata.shape)
|
| 50 |
-
|
|
|
|
| 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. "
|
|
@@ -72,7 +96,6 @@ def main() -> None:
|
|
| 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 |
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Inspect a DRMHB AnnData generated with vibframe-anndata 0.2.2.
|
| 4 |
|
| 5 |
+
The H5AD is opened in backed read-only mode, so the multi-gigabyte raw signal
|
| 6 |
+
payload is not loaded into RAM.
|
| 7 |
|
| 8 |
Install:
|
| 9 |
+
python -m pip install "vibframe-anndata==0.2.2" "anndata>=0.10,<0.13"
|
| 10 |
|
| 11 |
Usage:
|
| 12 |
python examples/02_inspect_anndata.py DRMHB.float32.h5ad
|
|
|
|
| 19 |
|
| 20 |
import anndata as ad
|
| 21 |
|
| 22 |
+
from vibframe_anndata import (
|
| 23 |
+
__version__ as vibframe_anndata_version,
|
| 24 |
+
validate_streamed_h5ad,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
EXPECTED_VERSION = "0.2.2"
|
| 28 |
|
| 29 |
|
| 30 |
def parse_args() -> argparse.Namespace:
|
| 31 |
parser = argparse.ArgumentParser(
|
| 32 |
+
description="Inspect a locally generated DRMHB AnnData."
|
| 33 |
)
|
| 34 |
parser.add_argument("h5ad", type=Path, help="Path to a generated DRMHB .h5ad.")
|
| 35 |
return parser.parse_args()
|
|
|
|
| 38 |
def main() -> None:
|
| 39 |
args = parse_args()
|
| 40 |
|
| 41 |
+
if vibframe_anndata_version != EXPECTED_VERSION:
|
| 42 |
+
raise RuntimeError(
|
| 43 |
+
f"This example is validated for vibframe-anndata=={EXPECTED_VERSION}; "
|
| 44 |
+
f"active version: {vibframe_anndata_version!r}"
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
if not args.h5ad.is_file():
|
| 48 |
raise FileNotFoundError(args.h5ad)
|
| 49 |
|
|
|
|
| 58 |
print(adata)
|
| 59 |
print()
|
| 60 |
print("X shape:", adata.shape)
|
| 61 |
+
|
| 62 |
+
print("\nobs columns:")
|
| 63 |
for column in adata.obs.columns:
|
| 64 |
print(" -", column)
|
| 65 |
|
| 66 |
+
print("\nobsm keys:")
|
|
|
|
| 67 |
for key in adata.obsm.keys():
|
| 68 |
print(" -", key)
|
| 69 |
|
| 70 |
+
print("\nuns keys:")
|
|
|
|
| 71 |
for key in adata.uns.keys():
|
| 72 |
print(" -", key)
|
| 73 |
|
| 74 |
+
print("\nFirst observations:")
|
|
|
|
| 75 |
print(adata.obs.head())
|
| 76 |
|
| 77 |
+
if "ground_truth" in adata.obsm:
|
| 78 |
+
gt = adata.obsm["ground_truth"]
|
| 79 |
+
print("\nGround truth:")
|
| 80 |
+
print(" - location: obsm['ground_truth']")
|
| 81 |
+
print(" - shape:", gt.shape)
|
| 82 |
+
print(
|
| 83 |
+
" - note: evaluation-only metadata; do not include it "
|
| 84 |
+
"automatically in unsupervised model inputs"
|
| 85 |
+
)
|
| 86 |
+
else:
|
| 87 |
+
print(
|
| 88 |
+
"\nGround truth was not imported. Recreate the H5AD without "
|
| 89 |
+
"--without-ground-truth if evaluation labels are required."
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
if adata.n_vars == 0:
|
| 93 |
print(
|
| 94 |
"\nThis is a featureless base AnnData. "
|
|
|
|
| 96 |
"raw signals already stored in the H5AD."
|
| 97 |
)
|
| 98 |
finally:
|
|
|
|
| 99 |
if getattr(adata, "file", None) is not None:
|
| 100 |
adata.file.close()
|
| 101 |
|
examples/03_add_features.py
CHANGED
|
@@ -1,21 +1,23 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Materialize a
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
Install:
|
| 9 |
-
python -m pip install "vibframe-anndata==0.2.
|
| 10 |
|
| 11 |
Usage:
|
| 12 |
python examples/03_add_features.py \
|
| 13 |
DRMHB.float32.h5ad \
|
| 14 |
DRMHB.example-features.h5ad
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
https://413hq.github.io/vibframe-anndata-docs/latest/
|
| 19 |
"""
|
| 20 |
|
| 21 |
from __future__ import annotations
|
|
@@ -29,6 +31,8 @@ from vibframe_anndata import (
|
|
| 29 |
validate_streamed_h5ad,
|
| 30 |
)
|
| 31 |
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def parse_args() -> argparse.Namespace:
|
| 34 |
parser = argparse.ArgumentParser(
|
|
@@ -37,7 +41,7 @@ def parse_args() -> argparse.Namespace:
|
|
| 37 |
parser.add_argument(
|
| 38 |
"source",
|
| 39 |
type=Path,
|
| 40 |
-
help="Featureless DRMHB .h5ad
|
| 41 |
)
|
| 42 |
parser.add_argument(
|
| 43 |
"output",
|
|
@@ -56,9 +60,9 @@ def parse_args() -> argparse.Namespace:
|
|
| 56 |
def main() -> None:
|
| 57 |
args = parse_args()
|
| 58 |
|
| 59 |
-
if vibframe_anndata_version !=
|
| 60 |
raise RuntimeError(
|
| 61 |
-
"This example is validated for vibframe-anndata==
|
| 62 |
f"active version: {vibframe_anndata_version!r}"
|
| 63 |
)
|
| 64 |
|
|
@@ -67,9 +71,6 @@ def main() -> None:
|
|
| 67 |
|
| 68 |
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 69 |
|
| 70 |
-
# A deliberately compact demonstration spanning spectral and waveform
|
| 71 |
-
# features. Catalog-backed spectral descriptors use the metric metadata
|
| 72 |
-
# persisted in the source AnnData.
|
| 73 |
config = {
|
| 74 |
"version": 1,
|
| 75 |
"output": {"dtype": "float32"},
|
|
@@ -99,6 +100,10 @@ def main() -> None:
|
|
| 99 |
print(f"Created: {output}")
|
| 100 |
print(f"Observations: {validation['n_obs']:,}")
|
| 101 |
print(f"Variables/features: {validation['n_vars']:,}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
if __name__ == "__main__":
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Materialize a compact example feature set from a DRMHB AnnData.
|
| 4 |
|
| 5 |
+
Validated with:
|
| 6 |
+
vibframe-anndata==0.2.2
|
| 7 |
+
|
| 8 |
+
This step works exclusively from raw signals already persisted in the H5AD and
|
| 9 |
+
does not reopen the original VibFrame archive.
|
| 10 |
|
| 11 |
Install:
|
| 12 |
+
python -m pip install "vibframe-anndata==0.2.2"
|
| 13 |
|
| 14 |
Usage:
|
| 15 |
python examples/03_add_features.py \
|
| 16 |
DRMHB.float32.h5ad \
|
| 17 |
DRMHB.example-features.h5ad
|
| 18 |
|
| 19 |
+
Documentation:
|
| 20 |
+
https://413hq.github.io/vibframe-anndata-docs/latest/
|
|
|
|
| 21 |
"""
|
| 22 |
|
| 23 |
from __future__ import annotations
|
|
|
|
| 31 |
validate_streamed_h5ad,
|
| 32 |
)
|
| 33 |
|
| 34 |
+
EXPECTED_VERSION = "0.2.2"
|
| 35 |
+
|
| 36 |
|
| 37 |
def parse_args() -> argparse.Namespace:
|
| 38 |
parser = argparse.ArgumentParser(
|
|
|
|
| 41 |
parser.add_argument(
|
| 42 |
"source",
|
| 43 |
type=Path,
|
| 44 |
+
help="Featureless DRMHB .h5ad generated from the VibFrame archive.",
|
| 45 |
)
|
| 46 |
parser.add_argument(
|
| 47 |
"output",
|
|
|
|
| 60 |
def main() -> None:
|
| 61 |
args = parse_args()
|
| 62 |
|
| 63 |
+
if vibframe_anndata_version != EXPECTED_VERSION:
|
| 64 |
raise RuntimeError(
|
| 65 |
+
f"This example is validated for vibframe-anndata=={EXPECTED_VERSION}; "
|
| 66 |
f"active version: {vibframe_anndata_version!r}"
|
| 67 |
)
|
| 68 |
|
|
|
|
| 71 |
|
| 72 |
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 73 |
|
|
|
|
|
|
|
|
|
|
| 74 |
config = {
|
| 75 |
"version": 1,
|
| 76 |
"output": {"dtype": "float32"},
|
|
|
|
| 100 |
print(f"Created: {output}")
|
| 101 |
print(f"Observations: {validation['n_obs']:,}")
|
| 102 |
print(f"Variables/features: {validation['n_vars']:,}")
|
| 103 |
+
print(
|
| 104 |
+
"If ground truth was present in the source base H5AD, it remains "
|
| 105 |
+
"evaluation metadata rather than an X feature."
|
| 106 |
+
)
|
| 107 |
|
| 108 |
|
| 109 |
if __name__ == "__main__":
|
examples/README.md
CHANGED
|
@@ -1,17 +1,23 @@
|
|
| 1 |
# DRMHB examples
|
| 2 |
|
| 3 |
The Hugging Face repository distributes **DRMHB in VibFrame form only**. AnnData
|
| 4 |
-
|
| 5 |
[`vibframe-anndata`](https://413hq.github.io/vibframe-anndata-docs/latest/)
|
| 6 |
package.
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
```bash
|
| 11 |
-
python -m pip install "vibframe-anndata==0.2.
|
| 12 |
```
|
| 13 |
|
| 14 |
-
## 1. Create
|
| 15 |
|
| 16 |
```bash
|
| 17 |
python examples/01_create_featureless_anndata.py \
|
|
@@ -19,8 +25,36 @@ python examples/01_create_featureless_anndata.py \
|
|
| 19 |
DRMHB.float32.h5ad
|
| 20 |
```
|
| 21 |
|
| 22 |
-
This
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## 2. Inspect the generated AnnData
|
| 26 |
|
|
@@ -28,8 +62,8 @@ VibFrame signals and metadata but leaves `X` with zero variables/features.
|
|
| 28 |
python examples/02_inspect_anndata.py DRMHB.float32.h5ad
|
| 29 |
```
|
| 30 |
|
| 31 |
-
The script opens the H5AD in backed read-only mode
|
| 32 |
-
`uns`
|
| 33 |
|
| 34 |
## 3. Materialize a small feature set
|
| 35 |
|
|
@@ -39,10 +73,13 @@ python examples/03_add_features.py \
|
|
| 39 |
DRMHB.example-features.h5ad
|
| 40 |
```
|
| 41 |
|
| 42 |
-
This demonstrates the second stage of the package:
|
| 43 |
-
signals already stored in AnnData, without reopening the original VibFrame.
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
For the complete API, configuration schema,
|
| 46 |
-
see:
|
| 47 |
|
| 48 |
https://413hq.github.io/vibframe-anndata-docs/latest/
|
|
|
|
| 1 |
# DRMHB examples
|
| 2 |
|
| 3 |
The Hugging Face repository distributes **DRMHB in VibFrame form only**. AnnData
|
| 4 |
+
representations are generated locally with the companion
|
| 5 |
[`vibframe-anndata`](https://413hq.github.io/vibframe-anndata-docs/latest/)
|
| 6 |
package.
|
| 7 |
|
| 8 |
+
These examples target and validate against:
|
| 9 |
+
|
| 10 |
+
```text
|
| 11 |
+
vibframe-anndata==0.2.2
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
Install it with:
|
| 15 |
|
| 16 |
```bash
|
| 17 |
+
python -m pip install "vibframe-anndata==0.2.2"
|
| 18 |
```
|
| 19 |
|
| 20 |
+
## 1. Create a featureless AnnData
|
| 21 |
|
| 22 |
```bash
|
| 23 |
python examples/01_create_featureless_anndata.py \
|
|
|
|
| 25 |
DRMHB.float32.h5ad
|
| 26 |
```
|
| 27 |
|
| 28 |
+
This performs the recommended out-of-core conversion and leaves `X` with zero
|
| 29 |
+
engineered features.
|
| 30 |
+
|
| 31 |
+
With version 0.2.2, DRMHB's partitioned snapshot truth under
|
| 32 |
+
`evaluation/snapshot_truth/` is also imported explicitly into:
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
adata.obsm["ground_truth"]
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
It remains separate from `X` and `obs`, so it is available for evaluation
|
| 39 |
+
without becoming an implicit model input.
|
| 40 |
+
|
| 41 |
+
If a pure learning representation without evaluation truth is desired:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
python examples/01_create_featureless_anndata.py \
|
| 45 |
+
DRMHB.vibframe.zip \
|
| 46 |
+
DRMHB.float32.h5ad \
|
| 47 |
+
--without-ground-truth
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The example also explicitly keeps:
|
| 51 |
+
|
| 52 |
+
```yaml
|
| 53 |
+
raw_compression: none
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
which is the 0.2.2 default and the recommended setting for DRMHB when repeated
|
| 57 |
+
feature materialization/read performance matters.
|
| 58 |
|
| 59 |
## 2. Inspect the generated AnnData
|
| 60 |
|
|
|
|
| 62 |
python examples/02_inspect_anndata.py DRMHB.float32.h5ad
|
| 63 |
```
|
| 64 |
|
| 65 |
+
The script opens the H5AD in backed read-only mode and reports `obs`, `obsm`,
|
| 66 |
+
`uns`, feature geometry and whether `obsm["ground_truth"]` is available.
|
| 67 |
|
| 68 |
## 3. Materialize a small feature set
|
| 69 |
|
|
|
|
| 73 |
DRMHB.example-features.h5ad
|
| 74 |
```
|
| 75 |
|
| 76 |
+
This demonstrates the second stage of the package: features are derived from
|
| 77 |
+
raw signals already stored in AnnData, without reopening the original VibFrame.
|
| 78 |
+
|
| 79 |
+
The example intentionally materializes only a compact set of waveform and
|
| 80 |
+
spectral descriptors.
|
| 81 |
|
| 82 |
+
For the complete API, configuration schema, ground-truth semantics, compression
|
| 83 |
+
options, supported metrics and limitations, see:
|
| 84 |
|
| 85 |
https://413hq.github.io/vibframe-anndata-docs/latest/
|