File size: 1,848 Bytes
1bc9257 | 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | {
"nbformat": 4,
"nbformat_minor": 5,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"cells": [
{
"cell_type": "markdown",
"id": "intro",
"metadata": {},
"source": [
"# HESRT: one verified sample\n",
"Run beside hesrt_io.py after installing requirements.txt. No token is needed. The default package is about 3.2 MB.\n"
]
},
{
"cell_type": "code",
"id": "catalog",
"metadata": {},
"execution_count": null,
"outputs": [],
"source": [
"from pathlib import Path\n",
"from hesrt_io import load_catalog, download_sample\n",
"catalog, revision = load_catalog()\n",
"catalog[['gsm_id', 'tissue', 'technology', 'archive_bytes']].head()\n"
]
},
{
"cell_type": "code",
"id": "download",
"metadata": {},
"execution_count": null,
"outputs": [],
"source": [
"row = catalog.loc[catalog.gsm_id.eq('GSM8915497')].iloc[0]\n",
"folder = download_sample(row, Path('hesrt_demo'), revision)\n",
"folder\n"
]
},
{
"cell_type": "code",
"id": "matrix",
"metadata": {},
"execution_count": null,
"outputs": [],
"source": [
"import anndata as ad\n",
"adata = ad.read_h5ad(folder / 'spatial.h5ad', backed='r')\n",
"print(adata.shape, adata.obsm['spatial'].shape)\n",
"adata.file.close()\n"
]
},
{
"cell_type": "code",
"id": "qc",
"metadata": {},
"execution_count": null,
"outputs": [],
"source": [
"from PIL import Image\n",
"with Image.open(folder / 'alignment_qc.png') as im:\n",
" display(im.copy())\n"
]
}
]
}
|