{ "cells": [ { "cell_type": "markdown", "id": "8ef9e021-1b2e-4086-868a-86d7e77b6f04", "metadata": {}, "source": [ "# MERFISH mouse liver\n", "\n", "In this notebook, we will use ovrlpy to investigate the [Vizgen MERFISH's mouse liver dataset](https://info.vizgen.com/mouse-liver-data).\n", "\n", "We want to create a signal embedding of the transcriptome, and a vertical signal incoherence map to identify locations with a high risk of containing spatial doublets." ] }, { "attachments": {}, "cell_type": "markdown", "id": "c88b9df5", "metadata": {}, "source": [ "## Settings and Imports\n", "\n", "First, let's define settings and input files." ] }, { "cell_type": "code", "execution_count": 1, "id": "7f26e482-97a7-4c1b-99f6-13f86119e183", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "import matplotlib.pyplot as plt\n", "\n", "import ovrlpy" ] }, { "cell_type": "code", "execution_count": 2, "id": "59c7c39e-3c57-413c-b295-dad2b315b3fa", "metadata": {}, "outputs": [], "source": [ "sample_nr = 1\n", "slice_nr = 1\n", "\n", "data_path = Path(\"/dh-projects/ag-ishaque/raw_data/vizgen-merfish/vz-liver-showcase\")\n", "\n", "coordinate_file = (\n", " data_path / f\"Liver{sample_nr}Slice{slice_nr}\" / \"detected_transcripts.csv\"\n", ")" ] }, { "cell_type": "markdown", "id": "e7d943a4-4ff9-4b03-83f9-a78b860a18d7", "metadata": {}, "source": [ "## Loading the data\n", "\n", "Next, we want to load the data." ] }, { "cell_type": "code", "execution_count": 3, "id": "dd6576df-592f-4c2a-8e18-9706d4a4462b", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of transcripts: 417,243,171\n" ] } ], "source": [ "coordinate_df = ovrlpy.io.read_MERFISH(coordinate_file)\n", "\n", "print(f\"Number of transcripts: {len(coordinate_df):,}\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "a02c7877-0633-4971-bef6-d9ae338bd65c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | x | \n", "y | \n", "z | \n", "gene | \n", "
|---|---|---|---|---|
| 0 | \n", "2506.4070 | \n", "-95.451480 | \n", "0.0 | \n", "Comt | \n", "
| 1 | \n", "2531.8447 | \n", "-95.187020 | \n", "0.0 | \n", "Comt | \n", "
| 2 | \n", "2483.7969 | \n", "-91.360115 | \n", "0.0 | \n", "Comt | \n", "
| 3 | \n", "2505.7693 | \n", "-84.081650 | \n", "0.0 | \n", "Comt | \n", "
| 4 | \n", "2501.3940 | \n", "-81.387090 | \n", "0.0 | \n", "Comt | \n", "