AURORA (Architecture Unveiling through RNA Omics and Routine Histology Analysis)
trained_models: Pretrained AURORA models for LUAD, KIRC and BRCA.predictions_112um: Virtual spatial transcriptomics at 112 μm * 112 μm by AURORA of TCGA-LUAD, TCGA-KIRC, TCGA-BRCA and BRCA pre-chemotherapy (https://doi.org/10.1038/s41586-021-04278-5) samples.*.h5file: virtual spatial transcriptomicsgenes: names of predicted genes.cell_types: names of predicted cell types.resolutions: prediction resolutions stored in the file.exp_pred_<patch_size>: predicted gene expression values.prop_pred_<patch_size>: quantized predicted cell type proportions.patch_loc_<patch_size>: spatial coordinates of patches. For 224-pixel patches, these are the coordinates of the upper-left corner.exp_max_<patch_size>andprop_max_<patch_size>: scaling values required to decode theuint8predictions.
predictions_8um: High-resolution virtual spatial transcriptomics at 8 μm * 8 μm by AURORA for TCGA-LUAD, TCGA-KIRC, TCGA-BRCA and BRCA pre-chemotherapy (https://doi.org/10.1038/s41586-021-04278-5) samples.*.h5file: high-resolution virtual spatial transcriptomicsgenes: names of predicted genes.cell_types: names of predicted cell types.resolutions: prediction resolutions stored in the file.exp_pred_<patch_size>: predicted gene expression values.prop_pred_<patch_size>: predicted cell type proportions in log scales.patch_loc_<patch_size>: spatial coordinates of predicted patches.exp_max_<patch_size>andprop_max_<patch_size>: scaling values required to decode theuint8predictions.- The HDF5 files use the
spatial_gene_deltalayout and Zstandard compression (compression level 9).
Loading 112 μm predictions
The 112 μm predictions use patch_size = 224. The HDF5 files are saved as
uint8 arrays to reduce file size. Decode each row and channel using the
corresponding per-channel maximum:
pip install numpy h5py hdf5plugin
import h5py
import numpy as np
with h5py.File("path/to/sample.h5", "r") as f:
patch_size = 224
exp_uint8 = f[f"exp_pred_{patch_size}"][:]
prop_uint8 = f[f"prop_pred_{patch_size}"][:]
exp_max = f[f"exp_max_{patch_size}"][:].astype(np.float32)
prop_max = f[f"prop_max_{patch_size}"][:].astype(np.float32)
# Broadcast one maximum across all patches for each gene or cell type.
expression = exp_uint8.astype(np.float32) * (exp_max[None, :] / 255.0)
celltype_prop = prop_uint8.astype(np.float32) * (prop_max[None, :] / 255.0)
positions = f[f"patch_loc_{patch_size}"][:]
genes = f["genes"].asstr()[:]
cell_types = f["cell_types"].asstr()[:]
expression has shape (n_patches, n_genes) and celltype_prop has shape
(n_patches, n_cell_types). The columns correspond to genes and
cell_types, respectively; the rows are aligned with positions. The
prop_pred_224 values decode to cell-type proportions, while exp_pred_224
values decode to predicted gene expression.
Alternatively, use the
highres_h5_loader.py utility, which performs the
decoding automatically:
from highres_h5_loader import load_highres_h5
data = load_highres_h5(
"path/to/sample.h5",
restore_original_order=True,
dequantize=True,
)
expression = data["exp_pred"][224]
celltype_prop = data["prop_pred"][224]
positions = data["pos"][224]
genes = data["genes"]
cell_types = data["cell_types"]
Loading 28/7 μm high-resolution predictions
The high-resolution files contain multiple prediction levels. With the current
0.5 μm-per-pixel setting, use patch_size = 56 for 28 μm predictions and
patch_size = 14 for 7 μm predictions. The linked
highres_h5_loader.py utility handles the
spatial-gene-delta encoding, Zstandard compression, optional row-order
restoration, and uint8 dequantization:
import numpy as np
from highres_h5_loader import load_highres_h5
data = load_highres_h5(
"path/to/highres_sample.h5",
restore_original_order=True,
dequantize=True,
)
# Choose either high-resolution level.
patch_size = 56 # 28 μm; use 14 for 7 μm
expression = data["exp_pred"][patch_size] # (n_patches, n_genes)
celltype_prop = data["prop_pred"][patch_size] # (n_patches, n_cell_types)
positions = data["pos"][patch_size] # (n_patches, 2)
genes = np.asarray(data["genes"])
cell_types = np.asarray(data["cell_types"])
gene_index = int(np.where(genes == "GENE_NAME")[0][0])
gene_values = expression[:, gene_index]
Use data["patch_sizes"] to inspect the levels available in a file. Set
dequantize=False to return the exact stored uint8 arrays. When
dequantizing, the loader applies
decoded_value = uint8_value * max_value / 255, using the corresponding
exp_max_<patch_size> or prop_max_<patch_size> values. Rows in
positions remain aligned with the expression and cell-type predictions.
For large files, print a summary without loading all prediction matrices:
python path/to/highres_h5_loader.py path/to/sample.h5
- Downloads last month
- 462