{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"# pyHiM in 3D\n",
"\n",
"## Tutorial for an analysis of sequential DNA-FISH data\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"This notebook describes basic functioning of pyHiM.\n",
"It is divided into 6 sections corresponding to the different steps of sequential DNA-FISH data analysis.\n",
"\n",
"- Section 0: Selection of dataset \n",
"- Section 1: Creation of Z-projections\n",
"- Section 2: Global 2D registration\n",
"- Section 3: Local 3D registration\n",
"- Section 4: Segmentation and localization\n",
"- Section 5: Building chromatin traces and pair-wise distance matrices"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Import python packages\n",
"from jupyter_functions_plots import *\n",
"import os\n",
"\n",
"# Enable inline plots\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[VERSION] pyHiM 0.9.1\n",
"usage: pyHiM.py [-h] [-C CMD] [-F ROOTFOLDER] [-P PARAMETERS] [-T THREADS]\n",
"\n",
"optional arguments:\n",
" -h, --help show this help message and exit\n",
" -C CMD, --cmd CMD Comma-separated list of routines to run. DEFAULT: proj\n",
" ect,register_global,register_local,mask_2d,localize_2d\n",
" ,mask_3d,localize_3d,filter_localizations,register_loc\n",
" alizations,build_traces,build_matrix\n",
" -F ROOTFOLDER, --rootFolder ROOTFOLDER\n",
" Folder path with input images. DEFAULT: Current\n",
" directory\n",
" -P PARAMETERS, --parameters PARAMETERS\n",
" Path of the parameters.json file. DEFAULT: pyHiM\n",
" expect this file inside your current directory\n",
" -T THREADS, --threads THREADS\n",
" Thread number to run with parallel mode. DEFAULT: 1\n",
" (sequential mode)\n"
]
}
],
"source": [
"# Basic check of PyHiM installation\n",
"!pyhim --help"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 0. Selection of dataset\n",
"\n",
"
*To run on your computer, download* [*this jupyter lab*](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/pyHi-M/pyHiM/tree/development/docs/source/getting_started/tutorials/notebooks).\n",
"\n",
"
*If you are not familiar with jupyter notebooks, you can find* [*a tutorial here*](../run_pyhim_nb.md).\n",
"\n",
"### Download data\n",
"\n",
"
Download the [raw data from OSF](https://osf.io/82fdg). These datasets were acquired using [Qudi-HiM](https://open-research-europe.ec.europa.eu/articles/2-46) (Barho et al. 2022).\n",
"\n",
"\n",
"[](https://osf.io/82fdg)\n",
"\n",
"- Unzip the dataset in a folder of your choice.\n",
"- The folder containing the dataset has to be indicated in the next block under the variable `input_folder`."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Indicate the directory that contain the dataset to use\n",
"input_folder =r'/path/to/your/pyHiM_test_dataset/'\n",
"os.chdir(input_folder)\n",
"print(f\"The current working directory: {os.path.abspath(os.curdir)}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Download parameters file\n",
"\n",
"
Download the [parameters file](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/marcnol/pyHiM/blob/development/src/toolbox/parameter_file/parameters.json) and move it inside your `input_folder`.\n",
"\n",
"Your folder structure should look like this:\n",
"\n",
"```markdown\n",
".\n",
"├── notebooks\n",
"│ ├── full_pyHiM_run.ipynb\n",
"│ ├── jupyter_functions_plots.py\n",
"│ └── _static\n",
"└── test_dataset\n",
" ├── localizations_3D_barcode_example.dat\n",
" **├── parameters.json**\n",
" ├── scan_001_DAPI_005_ROI_converted_decon_ch00.tif\n",
" ├── scan_001_DAPI_005_ROI_converted_decon_ch01.tif\n",
" ├── scan_001_RT26_005_ROI_converted_decon_ch00.tif\n",
" ├── scan_001_RT26_005_ROI_converted_decon_ch01.tif\n",
" ├── scan_001_RT27_005_ROI_converted_decon_ch00.tif\n",
" └── scan_001_RT27_005_ROI_converted_decon_ch01.tif\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Dataset description\n",
"\n",
"#### Nuclei\n",
"\n",
"- A DAPI image of nuclei (collected at 405 nm): `scan_006_DAPI_001_ROI_converted_decon_ch00.tif`\n",
"\n",
"- The corresponding fiducial for the DAPI image (collected at 561 nm): `scan_006_DAPI_001_ROI_converted_decon_ch01.tif`\n",
"\n",
"*These 3D images are collected only once per Region Of Interest (ROI).*\n",
"\n",
"#### Barcodes\n",
"- Barcode image for cycle `RTX` (collected at 647nm): `scan_001_RTX_001_ROI_converted_decon_ch01.tif`\n",
"\n",
"- The corresponding fiducial for cycle `RTX` (collected at 561nm): `scan_001_RTX_001_ROI_converted_decon_ch00.tif`\n",
"\n",
"*These 3D images are collected for each cycle of hybridization, for each ROI.*\n",
"\n",
"