Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 27 additions & 28 deletions docs/Tutorials/T1_ImageAnalysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "29cad22f",
"metadata": {},
"source": [
"# Image single-cell analysis"
"# T1: Image single-cell analysis"
]
},
{
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "8e40b139",
"metadata": {},
"outputs": [
Expand All @@ -42,7 +42,6 @@
}
],
"source": [
"#lets take a quick look\n",
"import skimage.io as io\n",
"import numpy as np\n",
"import opendvp as dvp\n",
Expand Down Expand Up @@ -70,7 +69,7 @@
"outputs": [],
"source": [
"url = \"https://zenodo.org/records/15830141/files/data.tar.gz?download=1\"\n",
"output_path = \"demodata.gz\" \n",
"output_path = \"../data/demodata.gz\" \n",
"\n",
"import requests\n",
"response = requests.get(url, stream=True)\n",
Expand Down Expand Up @@ -112,13 +111,13 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "2383e316",
"metadata": {},
"outputs": [],
"source": [
"# let's perform some quick QC\n",
"path_to_segmentation = \"data/segmentation/segmentation_mask.tif\"\n",
"path_to_segmentation = \"../data/segmentation/segmentation_mask.tif\"\n",
"seg = io.imread(path_to_segmentation)"
]
},
Expand Down Expand Up @@ -367,7 +366,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "b84aeade",
"metadata": {},
"outputs": [
Expand All @@ -382,7 +381,7 @@
],
"source": [
"# now lets write that geodataframe into a file\n",
"gdf.to_file(\"outputs/segmentation_for_qupath.geojson\")"
"gdf.to_file(\"../outputs/segmentation_for_qupath.geojson\")"
]
},
{
Expand Down Expand Up @@ -411,13 +410,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "28c2f46e",
"metadata": {},
"outputs": [],
"source": [
"#load image\n",
"image = io.imread(\"data/image/mIF.ome.tif\")"
"image = io.imread(\"../data/image/mIF.ome.tif\")"
]
},
{
Expand Down Expand Up @@ -472,7 +471,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "ed1f9c70",
"metadata": {},
"outputs": [
Expand All @@ -487,7 +486,7 @@
],
"source": [
"#transform the .csv matrix to an AnnData object\n",
"adata = dvp.io.quant_to_adata(\"data/quantification/quant.csv\")"
"adata = dvp.io.quant_to_adata(\"../data/quantification/quant.csv\")"
]
},
{
Expand Down Expand Up @@ -1014,13 +1013,13 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": null,
"id": "6ad690cd",
"metadata": {},
"outputs": [],
"source": [
"#check annotations\n",
"gdf = gpd.read_file(\"data/manual_artefact_annotations/artefacts.geojson\")"
"gdf = gpd.read_file(\"../data/manual_artefact_annotations/artefacts.geojson\")"
]
},
{
Expand Down Expand Up @@ -1156,7 +1155,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "07e5d802",
"metadata": {},
"outputs": [
Expand All @@ -1173,7 +1172,7 @@
"source": [
"adata = dvp.tl.filter_by_annotation(\n",
" adata=adata, \n",
" path_to_geojson=\"data/manual_artefact_annotations/artefacts.geojson\")"
" path_to_geojson=\"../data/manual_artefact_annotations/artefacts.geojson\")"
]
},
{
Expand Down Expand Up @@ -1414,7 +1413,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"id": "482a0b18",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1494,7 +1493,7 @@
}
],
"source": [
"gdf = gpd.read_file(\"outputs/segmentation_for_qupath.geojson\")\n",
"gdf = gpd.read_file(\"../outputs/segmentation_for_qupath.geojson\")\n",
"gdf.head()"
]
},
Expand Down Expand Up @@ -1527,13 +1526,13 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"id": "44441f39",
"metadata": {},
"outputs": [],
"source": [
"# let's save the file to drag it into qupath\n",
"cells.to_file(\"outputs/filtered_cells.geojson\")"
"cells.to_file(\"../outputs/filtered_cells.geojson\")"
]
},
{
Expand Down Expand Up @@ -1587,7 +1586,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": null,
"id": "0da35a57",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1693,7 +1692,7 @@
],
"source": [
"# this function loads and processes the values ready for the phenotyping\n",
"thresholds = dvp.io.import_thresholds(gates_csv_path=\"data/phenotyping/gates.csv\")\n",
"thresholds = dvp.io.import_thresholds(gates_csv_path=\"../data/phenotyping/gates.csv\")\n",
"thresholds"
]
},
Expand Down Expand Up @@ -1779,7 +1778,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"id": "fd0f28f3",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1925,7 +1924,7 @@
"# we must load the phenotyping workflow\n",
"# this is the set of biological knowledge we have about the markers\n",
"# and what they mean to classify the cells\n",
"phenotype = pd.read_csv('data/phenotyping/celltype_matrix.csv')\n",
"phenotype = pd.read_csv('../data/phenotyping/celltype_matrix.csv')\n",
"# this just shows you the table \n",
"phenotype.style.format(na_rep='')"
]
Expand Down Expand Up @@ -2255,12 +2254,12 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": null,
"id": "a7598b49",
"metadata": {},
"outputs": [],
"source": [
"phenotypes.to_file(\"outputs/phenotypes.geojson\")"
"phenotypes.to_file(\"../outputs/phenotypes.geojson\")"
]
},
{
Expand Down Expand Up @@ -2453,7 +2452,7 @@
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": null,
"id": "a0164589",
"metadata": {},
"outputs": [
Expand All @@ -2468,7 +2467,7 @@
],
"source": [
"#save to file\n",
"voronoi.to_file(\"outputs/voronoi_neighborhoods.geojson\")"
"voronoi.to_file(\"../outputs/voronoi_neighborhoods.geojson\")"
]
}
],
Expand Down
Loading
Loading