From 06e8b77c649c608b258fe82eddc289e8f2f64972 Mon Sep 17 00:00:00 2001 From: Andreas Bueckle Date: Mon, 2 Feb 2026 14:39:42 -0500 Subject: [PATCH 01/11] Added new HRA template for Workspaces --- .../templates/hra_cde_tutorial/README.md | 0 .../templates/hra_cde_tutorial/metadata.json | 13 + .../templates/hra_cde_tutorial/render.py | 6 + .../templates/hra_cde_tutorial/template.ipynb | 871 ++++++++++++++++++ 4 files changed, 890 insertions(+) create mode 100644 src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/README.md create mode 100644 src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/metadata.json create mode 100644 src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/render.py create mode 100644 src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb diff --git a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/README.md b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/metadata.json b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/metadata.json new file mode 100644 index 0000000..4747f21 --- /dev/null +++ b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/metadata.json @@ -0,0 +1,13 @@ +{ + "title": "Human Reference Atlas (HRA) Cell Distance Explorer (CDE) Tutorial", + "description": "This notebook shows users how to get a sample dataset for the CDE and visualize it with the node-dist-vis and CDE Jupyter widget.", + "tags": [ + "hra", + "api", + "cde" + ], + "is_multi_dataset_template": true, + "template_format": "jinja", + "is_hidden": false, + "last_modified_unix_timestamp": 1770060963 +} diff --git a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/render.py b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/render.py new file mode 100644 index 0000000..7fec3bd --- /dev/null +++ b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/render.py @@ -0,0 +1,6 @@ +from user_templates_api.templates.jupyter_lab.render import JupyterLabRender + + +class JupyterLabExampleJinjaRender(JupyterLabRender): + def __init__(self): + pass diff --git a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb new file mode 100644 index 0000000..6a98c4b --- /dev/null +++ b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb @@ -0,0 +1,871 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "879b7334", + "metadata": {}, + "source": [ + "# A notebook to demonstrate usage of the Jupyter Widget for the Cell Distance Explorer" + ] + }, + { + "cell_type": "markdown", + "id": "8b4cdba9", + "metadata": {}, + "source": [ + "In this notebook, we download a sample dataset with 3D cell positions from the [Cell Distance Explorer (CDE)](https://apps.humanatlas.io/cde/) and then visualize if with the `node-dist-vis` and `CdeVisualization` Jupyter widgets." + ] + }, + { + "cell_type": "markdown", + "id": "a124cb13", + "metadata": {}, + "source": [ + "# Install and import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "d88ba163", + "metadata": {}, + "outputs": [], + "source": [ + "# Import native packages\n", + "import os\n", + "from pprint import pprint" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "8919f99f", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "[notice] A new release of pip is available: 25.0.1 -> 25.3\n", + "[notice] To update, run: python.exe -m pip install --upgrade pip\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: requests in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (2.32.5)\n", + "Requirement already satisfied: pandas in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (2.3.3)\n", + "Requirement already satisfied: ipywidgets in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (8.1.8)\n", + "Requirement already satisfied: hra_jupyter_widgets in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (0.4.1)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (3.4.4)\n", + "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (3.11)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (2.5.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (2025.10.5)\n", + "Requirement already satisfied: numpy>=1.26.0 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2.3.4)\n", + "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from pandas) (2.9.0.post0)\n", + "Requirement already satisfied: pytz>=2020.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2025.2)\n", + "Requirement already satisfied: tzdata>=2022.7 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2025.2)\n", + "Requirement already satisfied: comm>=0.1.3 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (0.2.3)\n", + "Requirement already satisfied: ipython>=6.1.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (9.6.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (5.14.3)\n", + "Requirement already satisfied: widgetsnbextension~=4.0.14 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from ipywidgets) (4.0.15)\n", + "Requirement already satisfied: jupyterlab_widgets~=3.0.15 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from ipywidgets) (3.0.16)\n", + "Requirement already satisfied: anywidget in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from hra_jupyter_widgets) (0.9.21)\n", + "Requirement already satisfied: colorama in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.4.6)\n", + "Requirement already satisfied: decorator in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (5.2.1)\n", + "Requirement already satisfied: ipython-pygments-lexers in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (1.1.1)\n", + "Requirement already satisfied: jedi>=0.16 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.19.2)\n", + "Requirement already satisfied: matplotlib-inline in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.1.7)\n", + "Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (3.0.52)\n", + "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (2.19.2)\n", + "Requirement already satisfied: stack_data in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.6.3)\n", + "Requirement already satisfied: six>=1.5 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n", + "Requirement already satisfied: psygnal>=0.8.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from anywidget->hra_jupyter_widgets) (0.15.1)\n", + "Requirement already satisfied: typing-extensions>=4.2.0 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from anywidget->hra_jupyter_widgets) (4.15.0)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets) (0.8.5)\n", + "Requirement already satisfied: wcwidth in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets) (0.2.14)\n", + "Requirement already satisfied: executing>=1.2.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (2.2.1)\n", + "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (3.0.0)\n", + "Requirement already satisfied: pure-eval in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (0.2.3)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "#Install and import external packages\n", + "%pip install requests pandas ipywidgets hra_jupyter_widgets\n", + "\n", + "import requests\n", + "import pandas as pd\n", + "import ipywidgets as widgets\n", + "\n", + "# Import hra-jupyter-widgets. For documentation, please see https://github.com/x-atlas-consortia/hra-jupyter-widgets/blob/main/usage.ipynb\n", + "from hra_jupyter_widgets import (\n", + " # BodyUi,\n", + " CdeVisualization, # in this example, we will use this one...\n", + " # Eui,\n", + " # EuiOrganInformation,\n", + " # FtuExplorer,\n", + " # FtuExplorerSmall,\n", + " # MedicalIllustration,\n", + " # ModelViewer,\n", + " NodeDistVis, # ...and this one, but all of them are usable for different purposes!\n", + " # Rui,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "e3e9d5ff", + "metadata": {}, + "source": [ + "# Global variables" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "572c2376", + "metadata": {}, + "outputs": [], + "source": [ + "output_file = \"sample_data.csv\"\n", + "output_folder = \"data\"\n", + "path = os.path.join(output_folder, output_file)" + ] + }, + { + "cell_type": "markdown", + "id": "ede91205", + "metadata": {}, + "source": [ + "# Download data" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "19495224", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Success: saved to data\\sample_data.csv\n" + ] + } + ], + "source": [ + "def download_public_sheet_as_csv(file_id, gid, path):\n", + " \n", + " # ensure output folder exists\n", + " os.makedirs(os.path.dirname(path), exist_ok=True)\n", + " \n", + " url = (\n", + " f\"https://docs.google.com/spreadsheets/d/{file_id}/export?format=csv&gid={gid}\"\n", + " )\n", + " response = requests.get(url)\n", + " if response.status_code == 200:\n", + " with open(path, \"wb\") as f:\n", + " f.write(response.content)\n", + " print(f\"Success: saved to {path}\")\n", + " else:\n", + " print(f\"Error {response.status_code}: could not download sheet\")\n", + "\n", + "\n", + "# Your sheet’s IDs\n", + "file_id = \"1EUf7CUZb0NprgxBeX3nS3GXyUM89edIRH6NSeUsR3nY\"\n", + "gid = \"47698780\"\n", + "\n", + "download_public_sheet_as_csv(file_id, gid,path)" + ] + }, + { + "cell_type": "markdown", + "id": "fc56fffb", + "metadata": {}, + "source": [ + "## Read data as DataFrame" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "ab2354e9", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.microsoft.datawrangler.viewer.v0+json": { + "columns": [ + { + "name": "index", + "rawType": "int64", + "type": "integer" + }, + { + "name": "x", + "rawType": "float64", + "type": "float" + }, + { + "name": "y", + "rawType": "float64", + "type": "float" + }, + { + "name": "z", + "rawType": "int64", + "type": "integer" + }, + { + "name": "Cell Type", + "rawType": "object", + "type": "string" + } + ], + "ref": "7527bb4f-cd5b-46d5-b7d2-d2dc1a567f6d", + "rows": [ + [ + "0", + "188.5", + "342.5", + "10", + "T-Killer" + ], + [ + "1", + "136.6", + "161.4", + "20", + "T-Killer" + ], + [ + "2", + "437.5", + "363.5", + "20", + "T-Killer" + ], + [ + "3", + "203.5", + "512.0", + "20", + "T-Killer" + ], + [ + "4", + "155.579", + "204.895", + "0", + "T-Helper" + ], + [ + "5", + "107.5", + "223.5", + "0", + "T-Helper" + ], + [ + "6", + "180.593", + "226.519", + "0", + "T-Helper" + ], + [ + "7", + "188.5", + "226.778", + "0", + "T-Helper" + ], + [ + "8", + "198.579", + "231.895", + "0", + "T-Helper" + ], + [ + "9", + "478.5", + "232.0", + "0", + "T-Helper" + ], + [ + "10", + "191.0", + "236.0", + "0", + "T-Helper" + ], + [ + "11", + "97.5", + "259.0", + "0", + "T-Helper" + ], + [ + "12", + "177.714", + "290.286", + "0", + "T-Helper" + ], + [ + "13", + "300.5", + "320.0", + "0", + "T-Helper" + ], + [ + "14", + "207.5", + "321.0", + "0", + "T-Helper" + ], + [ + "15", + "217.5", + "339.0", + "0", + "T-Helper" + ], + [ + "16", + "164.389", + "353.778", + "0", + "T-Helper" + ], + [ + "17", + "656.7", + "365.4", + "0", + "T-Helper" + ], + [ + "18", + "447.667", + "369.833", + "0", + "T-Helper" + ], + [ + "19", + "96.4516", + "372.613", + "0", + "T-Helper" + ], + [ + "20", + "576.421", + "379.895", + "0", + "T-Helper" + ], + [ + "21", + "98.7586", + "384.207", + "0", + "T-Helper" + ], + [ + "22", + "473.933", + "383.267", + "0", + "T-Helper" + ], + [ + "23", + "123.5", + "389.0", + "0", + "T-Helper" + ], + [ + "24", + "467.0", + "393.5", + "0", + "T-Helper" + ], + [ + "25", + "657.0", + "401.0", + "0", + "T-Helper" + ], + [ + "26", + "252.0", + "400.5", + "0", + "T-Helper" + ], + [ + "27", + "505.125", + "417.125", + "0", + "T-Helper" + ], + [ + "28", + "404.5", + "424.5", + "0", + "T-Helper" + ], + [ + "29", + "616.0", + "430.0", + "0", + "T-Helper" + ], + [ + "30", + "438.611", + "442.222", + "0", + "T-Helper" + ], + [ + "31", + "414.0", + "443.0", + "0", + "T-Helper" + ], + [ + "32", + "449.0", + "452.0", + "0", + "T-Helper" + ], + [ + "33", + "356.421", + "459.105", + "0", + "T-Helper" + ], + [ + "34", + "217.421", + "461.105", + "0", + "T-Helper" + ], + [ + "35", + "195.75", + "461.5", + "0", + "T-Helper" + ], + [ + "36", + "526.381", + "463.524", + "0", + "T-Helper" + ], + [ + "37", + "562.0", + "468.0", + "0", + "T-Helper" + ], + [ + "38", + "623.667", + "472.833", + "0", + "T-Helper" + ], + [ + "39", + "580.261", + "476.565", + "0", + "T-Helper" + ], + [ + "40", + "575.65", + "485.15", + "0", + "T-Helper" + ], + [ + "41", + "661.5", + "515.222", + "0", + "T-Helper" + ], + [ + "42", + "655.5", + "518.636", + "0", + "T-Helper" + ], + [ + "43", + "155.579", + "204.895", + "1", + "T-Helper" + ], + [ + "44", + "107.5", + "223.5", + "1", + "T-Helper" + ], + [ + "45", + "180.593", + "226.519", + "1", + "T-Helper" + ], + [ + "46", + "188.5", + "226.778", + "1", + "T-Helper" + ], + [ + "47", + "198.579", + "231.895", + "1", + "T-Helper" + ], + [ + "48", + "478.5", + "232.0", + "1", + "T-Helper" + ], + [ + "49", + "191.0", + "236.0", + "1", + "T-Helper" + ] + ], + "shape": { + "columns": 4, + "rows": 2868 + } + }, + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
xyzCell Type
0188.500342.50010T-Killer
1136.600161.40020T-Killer
2437.500363.50020T-Killer
3203.500512.00020T-Killer
4155.579204.8950T-Helper
...............
2863155.500133.50020DDB2
2864102.500251.50020DDB2
2865133.905378.38120DDB2
2866439.846378.23120DDB2
2867193.000501.50020DDB2
\n", + "

2868 rows × 4 columns

\n", + "
" + ], + "text/plain": [ + " x y z Cell Type\n", + "0 188.500 342.500 10 T-Killer\n", + "1 136.600 161.400 20 T-Killer\n", + "2 437.500 363.500 20 T-Killer\n", + "3 203.500 512.000 20 T-Killer\n", + "4 155.579 204.895 0 T-Helper\n", + "... ... ... .. ...\n", + "2863 155.500 133.500 20 DDB2\n", + "2864 102.500 251.500 20 DDB2\n", + "2865 133.905 378.381 20 DDB2\n", + "2866 439.846 378.231 20 DDB2\n", + "2867 193.000 501.500 20 DDB2\n", + "\n", + "[2868 rows x 4 columns]" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Read the CSV file and convert it to a df\n", + "df = pd.read_csv(path)\n", + "df" + ] + }, + { + "cell_type": "markdown", + "id": "0ab66bee", + "metadata": {}, + "source": [ + "## Visualize wit CDE" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "e92f490f", + "metadata": {}, + "outputs": [], + "source": [ + "# Next, let's define a function that turns a DataFrame into a node list that can then be passed into the CdeVisualization or NodeDistVis widget\n", + "def make_node_list(df: pd.DataFrame, is_3d: bool = False):\n", + " \"\"\"Turn a DataFrame into a list of dicts for passing them into a HRA widget\n", + "\n", + " Args:\n", + " df (pd.DataFrame): A DataFrame with cells\n", + " \"\"\"\n", + "\n", + " # If the df does not have a z-axis column, let's add one and set all cells to 0\n", + " if not is_3d:\n", + " df.loc[:, (\"z\")] = 0\n", + " \n", + " node_list = [\n", + " {\"x\": row[\"x\"], \"y\": row[\"y\"], \"z\": row[\"z\"], \"Cell Type\": row[\"Cell Type\"]}\n", + " for index, row in df.iterrows()\n", + " ]\n", + "\n", + " return node_list" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "9d51eff4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[{'Cell Type': 'T-Killer', 'x': 188.5, 'y': 342.5, 'z': 10},\n", + " {'Cell Type': 'T-Killer', 'x': 136.6, 'y': 161.4, 'z': 20},\n", + " {'Cell Type': 'T-Killer', 'x': 437.5, 'y': 363.5, 'z': 20},\n", + " {'Cell Type': 'T-Killer', 'x': 203.5, 'y': 512.0, 'z': 20},\n", + " {'Cell Type': 'T-Helper', 'x': 155.579, 'y': 204.895, 'z': 0}]\n" + ] + } + ], + "source": [ + "# Prepare df_cells for visualization with NodeDistVis widget\n", + "node_list = make_node_list(df, True)\n", + "\n", + "# Let's inspect the first 5 rows\n", + "pprint(node_list[:5])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "7614f172", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e6a853df513f435f81ad054fc0083635", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Finally, let's instantiate the NodeDistVis class with some parameters. We pass in the node_list, indicate Endothelial cells as targets for the edges.\n", + "# As we are not supplying an edge list, we need to provide a max_edge_distance, which is set to 1000 (generiously)\n", + "node_dist_vis = NodeDistVis(\n", + " nodes=node_list,\n", + " node_target_key=\"Cell Type\",\n", + " node_target_value=\"Endothelial\",\n", + " max_edge_distance=1000,\n", + ")\n", + "\n", + "# Display our new widget\n", + "display(node_dist_vis)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "9e9d46d5", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5266c003b29141afb5dac6b0efe21c13", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Finally, let's instantiate the CDEVisualization class with our node_list as parameter.\n", + "cde = CdeVisualization(nodes=node_list)\n", + "\n", + "# Display our new widget\n", + "display(cde)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From caaa6c1af2a3e4b872a5a0d9efa264267465dc61 Mon Sep 17 00:00:00 2001 From: jpuerto-psc <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:43:55 +0000 Subject: [PATCH 02/11] Generate new BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index c85f015..2338685 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -4bbb195 +a5cbc8c From a6fc6e8578491d6a36f2a7bca30da20260851891 Mon Sep 17 00:00:00 2001 From: Juan Puerto <=> Date: Tue, 3 Feb 2026 15:45:58 -0500 Subject: [PATCH 03/11] General: Add cde tag --- src/tags.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tags.json b/src/tags.json index 71c1cc6..54277b5 100644 --- a/src/tags.json +++ b/src/tags.json @@ -13,5 +13,6 @@ "hra": "Human Reference Atlas data", "sc": "Single cell analysis", "R": "Template written in R", - "zarr": "Using zarr file format" + "zarr": "Using zarr file format", + "cde": "Cell Distance Explorer" } \ No newline at end of file From dabc48494bb762f54babaecd7531a633ee609d44 Mon Sep 17 00:00:00 2001 From: jpuerto-psc <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:46:13 +0000 Subject: [PATCH 04/11] Generate new BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 2338685..7c73ad1 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -a5cbc8c +cc38e42 From 948a3bc6cef49b561077fe33ea6094766af994a4 Mon Sep 17 00:00:00 2001 From: Juan Puerto <=> Date: Tue, 3 Feb 2026 15:47:03 -0500 Subject: [PATCH 05/11] General: Syntax fix --- src/manage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/manage.py b/src/manage.py index 9a237f8..6a57c48 100755 --- a/src/manage.py +++ b/src/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" + import os import sys From 91955799bae5e83c82c2292d11c5066ad519498c Mon Sep 17 00:00:00 2001 From: jpuerto-psc <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:47:32 +0000 Subject: [PATCH 06/11] Generate new BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 7c73ad1..df430ef 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -cc38e42 +c568c8e From a28d5b1711726511227db9bbea147cde1b1a28c6 Mon Sep 17 00:00:00 2001 From: Juan Puerto <=> Date: Tue, 3 Feb 2026 15:48:45 -0500 Subject: [PATCH 07/11] General: Update github workflows --- .github/workflows/check_tags.yml | 2 +- .github/workflows/django.yml | 2 +- .github/workflows/linters.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_tags.yml b/.github/workflows/check_tags.yml index d519d74..d4c87e0 100644 --- a/.github/workflows/check_tags.yml +++ b/.github/workflows/check_tags.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index bbfe56e..eb0b4bb 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -11,7 +11,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.8', '3.9'] + python-version: ['3.9', '3.10'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 82643ef..7b6cebd 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From d5c670928ebcaf4ea007fd886aa040193459e7e8 Mon Sep 17 00:00:00 2001 From: jpuerto-psc <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:54:04 +0000 Subject: [PATCH 08/11] Generate new BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index df430ef..37741b7 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -c568c8e +e0098c1 From 07012800675b694f10c5ad82633b7e26e3bac98f Mon Sep 17 00:00:00 2001 From: Juan Puerto <=> Date: Tue, 3 Feb 2026 15:58:51 -0500 Subject: [PATCH 09/11] General: Minor mods --- .../templates/hra_cde_tutorial/template.ipynb | 685 +----------------- 1 file changed, 31 insertions(+), 654 deletions(-) diff --git a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb index 6a98c4b..c29fc58 100644 --- a/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb +++ b/src/user_templates_api/templates/jupyter_lab/templates/hra_cde_tutorial/template.ipynb @@ -12,9 +12,7 @@ "cell_type": "markdown", "id": "8b4cdba9", "metadata": {}, - "source": [ - "In this notebook, we download a sample dataset with 3D cell positions from the [Cell Distance Explorer (CDE)](https://apps.humanatlas.io/cde/) and then visualize if with the `node-dist-vis` and `CdeVisualization` Jupyter widgets." - ] + "source": "In this notebook, we download a sample dataset with 3D cell positions from the [Cell Distance Explorer (CDE)](https://apps.humanatlas.io/cde/) and then visualize it with the `node-dist-vis` and `CdeVisualization` Jupyter widgets." }, { "cell_type": "markdown", @@ -26,73 +24,20 @@ }, { "cell_type": "code", - "execution_count": 1, "id": "d88ba163", "metadata": {}, - "outputs": [], "source": [ "# Import native packages\n", "import os\n", "from pprint import pprint" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": 2, "id": "8919f99f", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n", - "[notice] A new release of pip is available: 25.0.1 -> 25.3\n", - "[notice] To update, run: python.exe -m pip install --upgrade pip\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: requests in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (2.32.5)\n", - "Requirement already satisfied: pandas in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (2.3.3)\n", - "Requirement already satisfied: ipywidgets in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (8.1.8)\n", - "Requirement already satisfied: hra_jupyter_widgets in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (0.4.1)\n", - "Requirement already satisfied: charset_normalizer<4,>=2 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (3.4.4)\n", - "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (3.11)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (2.5.0)\n", - "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests) (2025.10.5)\n", - "Requirement already satisfied: numpy>=1.26.0 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2.3.4)\n", - "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from pandas) (2.9.0.post0)\n", - "Requirement already satisfied: pytz>=2020.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2025.2)\n", - "Requirement already satisfied: tzdata>=2022.7 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pandas) (2025.2)\n", - "Requirement already satisfied: comm>=0.1.3 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (0.2.3)\n", - "Requirement already satisfied: ipython>=6.1.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (9.6.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipywidgets) (5.14.3)\n", - "Requirement already satisfied: widgetsnbextension~=4.0.14 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from ipywidgets) (4.0.15)\n", - "Requirement already satisfied: jupyterlab_widgets~=3.0.15 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from ipywidgets) (3.0.16)\n", - "Requirement already satisfied: anywidget in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from hra_jupyter_widgets) (0.9.21)\n", - "Requirement already satisfied: colorama in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.4.6)\n", - "Requirement already satisfied: decorator in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (5.2.1)\n", - "Requirement already satisfied: ipython-pygments-lexers in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (1.1.1)\n", - "Requirement already satisfied: jedi>=0.16 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.19.2)\n", - "Requirement already satisfied: matplotlib-inline in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.1.7)\n", - "Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (3.0.52)\n", - "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (2.19.2)\n", - "Requirement already satisfied: stack_data in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from ipython>=6.1.0->ipywidgets) (0.6.3)\n", - "Requirement already satisfied: six>=1.5 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n", - "Requirement already satisfied: psygnal>=0.8.1 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from anywidget->hra_jupyter_widgets) (0.15.1)\n", - "Requirement already satisfied: typing-extensions>=4.2.0 in c:\\users\\abueckle\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from anywidget->hra_jupyter_widgets) (4.15.0)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets) (0.8.5)\n", - "Requirement already satisfied: wcwidth in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets) (0.2.14)\n", - "Requirement already satisfied: executing>=1.2.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (2.2.1)\n", - "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (3.0.0)\n", - "Requirement already satisfied: pure-eval in c:\\users\\abueckle\\appdata\\roaming\\python\\python312\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (0.2.3)\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], "source": [ "#Install and import external packages\n", "%pip install requests pandas ipywidgets hra_jupyter_widgets\n", @@ -114,7 +59,9 @@ " NodeDistVis, # ...and this one, but all of them are usable for different purposes!\n", " # Rui,\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -126,15 +73,15 @@ }, { "cell_type": "code", - "execution_count": 3, "id": "572c2376", "metadata": {}, - "outputs": [], "source": [ "output_file = \"sample_data.csv\"\n", "output_folder = \"data\"\n", "path = os.path.join(output_folder, output_file)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -146,18 +93,8 @@ }, { "cell_type": "code", - "execution_count": 4, "id": "19495224", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Success: saved to data\\sample_data.csv\n" - ] - } - ], "source": [ "def download_public_sheet_as_csv(file_id, gid, path):\n", " \n", @@ -181,7 +118,9 @@ "gid = \"47698780\"\n", "\n", "download_public_sheet_as_csv(file_id, gid,path)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -193,548 +132,26 @@ }, { "cell_type": "code", - "execution_count": 5, "id": "ab2354e9", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.microsoft.datawrangler.viewer.v0+json": { - "columns": [ - { - "name": "index", - "rawType": "int64", - "type": "integer" - }, - { - "name": "x", - "rawType": "float64", - "type": "float" - }, - { - "name": "y", - "rawType": "float64", - "type": "float" - }, - { - "name": "z", - "rawType": "int64", - "type": "integer" - }, - { - "name": "Cell Type", - "rawType": "object", - "type": "string" - } - ], - "ref": "7527bb4f-cd5b-46d5-b7d2-d2dc1a567f6d", - "rows": [ - [ - "0", - "188.5", - "342.5", - "10", - "T-Killer" - ], - [ - "1", - "136.6", - "161.4", - "20", - "T-Killer" - ], - [ - "2", - "437.5", - "363.5", - "20", - "T-Killer" - ], - [ - "3", - "203.5", - "512.0", - "20", - "T-Killer" - ], - [ - "4", - "155.579", - "204.895", - "0", - "T-Helper" - ], - [ - "5", - "107.5", - "223.5", - "0", - "T-Helper" - ], - [ - "6", - "180.593", - "226.519", - "0", - "T-Helper" - ], - [ - "7", - "188.5", - "226.778", - "0", - "T-Helper" - ], - [ - "8", - "198.579", - "231.895", - "0", - "T-Helper" - ], - [ - "9", - "478.5", - "232.0", - "0", - "T-Helper" - ], - [ - "10", - "191.0", - "236.0", - "0", - "T-Helper" - ], - [ - "11", - "97.5", - "259.0", - "0", - "T-Helper" - ], - [ - "12", - "177.714", - "290.286", - "0", - "T-Helper" - ], - [ - "13", - "300.5", - "320.0", - "0", - "T-Helper" - ], - [ - "14", - "207.5", - "321.0", - "0", - "T-Helper" - ], - [ - "15", - "217.5", - "339.0", - "0", - "T-Helper" - ], - [ - "16", - "164.389", - "353.778", - "0", - "T-Helper" - ], - [ - "17", - "656.7", - "365.4", - "0", - "T-Helper" - ], - [ - "18", - "447.667", - "369.833", - "0", - "T-Helper" - ], - [ - "19", - "96.4516", - "372.613", - "0", - "T-Helper" - ], - [ - "20", - "576.421", - "379.895", - "0", - "T-Helper" - ], - [ - "21", - "98.7586", - "384.207", - "0", - "T-Helper" - ], - [ - "22", - "473.933", - "383.267", - "0", - "T-Helper" - ], - [ - "23", - "123.5", - "389.0", - "0", - "T-Helper" - ], - [ - "24", - "467.0", - "393.5", - "0", - "T-Helper" - ], - [ - "25", - "657.0", - "401.0", - "0", - "T-Helper" - ], - [ - "26", - "252.0", - "400.5", - "0", - "T-Helper" - ], - [ - "27", - "505.125", - "417.125", - "0", - "T-Helper" - ], - [ - "28", - "404.5", - "424.5", - "0", - "T-Helper" - ], - [ - "29", - "616.0", - "430.0", - "0", - "T-Helper" - ], - [ - "30", - "438.611", - "442.222", - "0", - "T-Helper" - ], - [ - "31", - "414.0", - "443.0", - "0", - "T-Helper" - ], - [ - "32", - "449.0", - "452.0", - "0", - "T-Helper" - ], - [ - "33", - "356.421", - "459.105", - "0", - "T-Helper" - ], - [ - "34", - "217.421", - "461.105", - "0", - "T-Helper" - ], - [ - "35", - "195.75", - "461.5", - "0", - "T-Helper" - ], - [ - "36", - "526.381", - "463.524", - "0", - "T-Helper" - ], - [ - "37", - "562.0", - "468.0", - "0", - "T-Helper" - ], - [ - "38", - "623.667", - "472.833", - "0", - "T-Helper" - ], - [ - "39", - "580.261", - "476.565", - "0", - "T-Helper" - ], - [ - "40", - "575.65", - "485.15", - "0", - "T-Helper" - ], - [ - "41", - "661.5", - "515.222", - "0", - "T-Helper" - ], - [ - "42", - "655.5", - "518.636", - "0", - "T-Helper" - ], - [ - "43", - "155.579", - "204.895", - "1", - "T-Helper" - ], - [ - "44", - "107.5", - "223.5", - "1", - "T-Helper" - ], - [ - "45", - "180.593", - "226.519", - "1", - "T-Helper" - ], - [ - "46", - "188.5", - "226.778", - "1", - "T-Helper" - ], - [ - "47", - "198.579", - "231.895", - "1", - "T-Helper" - ], - [ - "48", - "478.5", - "232.0", - "1", - "T-Helper" - ], - [ - "49", - "191.0", - "236.0", - "1", - "T-Helper" - ] - ], - "shape": { - "columns": 4, - "rows": 2868 - } - }, - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
xyzCell Type
0188.500342.50010T-Killer
1136.600161.40020T-Killer
2437.500363.50020T-Killer
3203.500512.00020T-Killer
4155.579204.8950T-Helper
...............
2863155.500133.50020DDB2
2864102.500251.50020DDB2
2865133.905378.38120DDB2
2866439.846378.23120DDB2
2867193.000501.50020DDB2
\n", - "

2868 rows × 4 columns

\n", - "
" - ], - "text/plain": [ - " x y z Cell Type\n", - "0 188.500 342.500 10 T-Killer\n", - "1 136.600 161.400 20 T-Killer\n", - "2 437.500 363.500 20 T-Killer\n", - "3 203.500 512.000 20 T-Killer\n", - "4 155.579 204.895 0 T-Helper\n", - "... ... ... .. ...\n", - "2863 155.500 133.500 20 DDB2\n", - "2864 102.500 251.500 20 DDB2\n", - "2865 133.905 378.381 20 DDB2\n", - "2866 439.846 378.231 20 DDB2\n", - "2867 193.000 501.500 20 DDB2\n", - "\n", - "[2868 rows x 4 columns]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ "# Read the CSV file and convert it to a df\n", "df = pd.read_csv(path)\n", "df" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", "id": "0ab66bee", "metadata": {}, - "source": [ - "## Visualize wit CDE" - ] + "source": "## Visualize with CDE" }, { "cell_type": "code", - "execution_count": 6, "id": "e92f490f", "metadata": {}, - "outputs": [], "source": [ "# Next, let's define a function that turns a DataFrame into a node list that can then be passed into the CdeVisualization or NodeDistVis widget\n", "def make_node_list(df: pd.DataFrame, is_3d: bool = False):\n", @@ -754,58 +171,31 @@ " ]\n", "\n", " return node_list" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": 7, "id": "9d51eff4", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[{'Cell Type': 'T-Killer', 'x': 188.5, 'y': 342.5, 'z': 10},\n", - " {'Cell Type': 'T-Killer', 'x': 136.6, 'y': 161.4, 'z': 20},\n", - " {'Cell Type': 'T-Killer', 'x': 437.5, 'y': 363.5, 'z': 20},\n", - " {'Cell Type': 'T-Killer', 'x': 203.5, 'y': 512.0, 'z': 20},\n", - " {'Cell Type': 'T-Helper', 'x': 155.579, 'y': 204.895, 'z': 0}]\n" - ] - } - ], "source": [ "# Prepare df_cells for visualization with NodeDistVis widget\n", "node_list = make_node_list(df, True)\n", "\n", "# Let's inspect the first 5 rows\n", "pprint(node_list[:5])" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": 8, "id": "7614f172", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "e6a853df513f435f81ad054fc0083635", - "version_major": 2, - "version_minor": 1 - }, - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], "source": [ - "# Finally, let's instantiate the NodeDistVis class with some parameters. We pass in the node_list, indicate Endothelial cells as targets for the edges.\n", - "# As we are not supplying an edge list, we need to provide a max_edge_distance, which is set to 1000 (generiously)\n", + "# Let's instantiate the NodeDistVis class with some parameters. We pass in the node_list, indicate Endothelial cells as targets for the edges.\n", + "# As we are not supplying an edge list, we need to provide a max_edge_distance, which is set to 1000 (generously)\n", "node_dist_vis = NodeDistVis(\n", " nodes=node_list,\n", " node_target_key=\"Cell Type\",\n", @@ -815,36 +205,23 @@ "\n", "# Display our new widget\n", "display(node_dist_vis)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": 9, "id": "9e9d46d5", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5266c003b29141afb5dac6b0efe21c13", - "version_major": 2, - "version_minor": 1 - }, - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], "source": [ "# Finally, let's instantiate the CDEVisualization class with our node_list as parameter.\n", "cde = CdeVisualization(nodes=node_list)\n", "\n", "# Display our new widget\n", "display(cde)" - ] + ], + "outputs": [], + "execution_count": null } ], "metadata": { From 4ce1f23b2637e6e5ff742b1c623d33496b4b5911 Mon Sep 17 00:00:00 2001 From: jpuerto-psc <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:59:29 +0000 Subject: [PATCH 10/11] Generate new BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 37741b7..98c70f3 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -e0098c1 +72de749 From 1629cb7eb80de356d7fb067688aef683e564eb6d Mon Sep 17 00:00:00 2001 From: Juan Muerto <68066250+jpuerto-psc@users.noreply.github.com> Date: Tue, 3 Feb 2026 16:04:14 -0500 Subject: [PATCH 11/11] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 197c4d5..437459c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.4.0 +2.5.0