-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed 4005ec7 with MkDocs version: 1.6.0
- Loading branch information
1 parent
2e743bf
commit 129af2e
Showing
11 changed files
with
416,070 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Jupyter Notebook Examples | ||
|
||
[Landscape View Xenium](short_notebooks/Landscape_View_Xenium.ipynb) | ||
[Landscape View Xenium](short_notebooks/Landscape_View_Xenium.ipynb) | ||
|
||
[Mouse-Brain_Alpha-Shape-Neighborhood](short_notebooks/Mouse-Brain_Alpha-Shape-Neighborhood.ipynb) |
235 changes: 235 additions & 0 deletions
235
examples/short_notebooks/Celldega-heatmap/Celldega-heatmap.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "a9471991-9d4a-4184-911c-72fe2e93b38f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"env: ANYWIDGET_HMR=1\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"%env ANYWIDGET_HMR=1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "fbf77bae-4979-4020-895c-a77b78a4dbd6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# macOS requirement\n", | ||
"import os\n", | ||
"os.environ['DYLD_LIBRARY_PATH'] = '/opt/homebrew/lib:' + os.environ.get('DYLD_LIBRARY_PATH', '')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "1f498de7-d3d4-4b75-83cd-50b9b56ee705", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from ipywidgets import HBox, Layout, GridBox" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "2a5daa53-ff35-4f57-87d4-43afb3c8358f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import celldega as dega\n", | ||
"from ipywidgets import Widget" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "630e128c-d7bf-4c76-a550-6f22fd9549af", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
">> clustergrammer2 backend version 0.18.0\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from clustergrammer2 import Network, CGM2\n", | ||
"import pandas as pd\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "7026a8eb-4e20-4d36-8781-2c7dc2ff59f9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# generate random matrix\n", | ||
"num_rows = 10\n", | ||
"num_cols = 10\n", | ||
"\n", | ||
"np.random.seed(seed=100)\n", | ||
"mat = np.random.rand(num_rows, num_cols)\n", | ||
"\n", | ||
"# make row and col labels\n", | ||
"rows = range(num_rows)\n", | ||
"cols = range(num_cols)\n", | ||
"rows = ['row-' + str(i) for i in rows]\n", | ||
"cols = ['col-' + str(i) for i in cols]\n", | ||
"\n", | ||
"# make dataframe\n", | ||
"df = pd.DataFrame(data=mat, columns=cols, index=rows)\n", | ||
"df.shape\n", | ||
"\n", | ||
"net = Network(CGM2)\n", | ||
"net.load_df(df)\n", | ||
"net.cluster()\n", | ||
"network = net.viz" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "94df98d9-48fb-40cc-a7f6-28f3da326f8e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"base_path = 'data/visium-hd_data/Visium_HD_Mouse_Lung_Fresh_Frozen_binned_outputs/square_008um/landscape_files'\n", | ||
"\n", | ||
"df_sig = pd.read_parquet(base_path + '/df_sig_marker.parquet')\n", | ||
"df_sig.shape\n", | ||
"\n", | ||
"net = Network(CGM2)\n", | ||
"net.load_df(df_sig)\n", | ||
"net.filter_N_top(axis='row', N_top=5000)\n", | ||
"net.normalize(axis='col', norm_type='umi')\n", | ||
"net.normalize(axis='row', norm_type='zscore')\n", | ||
"net.cluster()\n", | ||
"network = net.viz" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"id": "0ebde5a0-d55d-4be0-be82-c1a51588b6ee", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "b5d9111a52534a7f811c79fa3f5d814d", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"MatrixNew(height=500, network={'row_nodes': [{'name': 'Scgb1a1', 'ini': 635, 'clust': 149, 'rank': 224, 'rankv…" | ||
] | ||
}, | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Widget.close_all()\n", | ||
"mat = dega.viz.MatrixNew(network=network, width=500, height=500)\n", | ||
"mat" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "9f2a89a8-7c21-451f-bb4b-8341c5fd7f0f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"{'type': 'row_label', 'value': {'name': 'Actc1'}}" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"mat.click_info" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "30df5237-af82-45f6-844d-d4f5147423d8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# # Example: Setting width to 'auto' or a specific value\n", | ||
"# mat_1.layout = Layout(width='500px') # Adjust as needed\n", | ||
"# mat_2.layout = Layout(width='500px') # Adjust as needed\n", | ||
"# widgets_side_by_side = HBox([mat_1, mat_2])\n", | ||
"# display(widgets_side_by_side)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c48c1b6c-b8bf-4490-8e51-5c401726288f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "77146e56-73b0-4e3b-8367-3778c6ec26c9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.9.19" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 2, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.