{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic tutorial - Identifying tissue compartments in the human lymph node" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2023-05-04T10:15:12.879311100Z", "start_time": "2023-05-04T10:15:11.149394900Z" } }, "outputs": [], "source": [ "import chrysalis as ch\n", "import scanpy as sc\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To begin using `chrysalis`, we first load the human lymph node sample. After that, we proceed by removing the low quality capture spots and genes that are expressed in fewer than 10 spots. You can refer to the `scanpy` documentation for a comprehensive quality control (QC) tutorial." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2023-05-04T10:15:14.735979600Z", "start_time": "2023-05-04T10:15:12.879311100Z" } }, "outputs": [], "source": [ "adata = sc.datasets.visium_sge(sample_id='V1_Human_Lymph_Node')\n", "\n", "sc.pp.calculate_qc_metrics(adata, inplace=True)\n", "sc.pp.filter_cells(adata, min_counts=6000)\n", "sc.pp.filter_genes(adata, min_cells=10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Detect spatially variable genes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we detect spatially variable genes (SVGs): `ch.detect_svgs` calculates Moran's I for every gene that is expressed in at least 10% of the capture spots. This can be tuned by setting the `min_spots` parameter." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "