From 0ff77eccbdad4560214692eebaa0854d202f88cc Mon Sep 17 00:00:00 2001 From: Andrey Aristov <aaristov@pasteur.fr> Date: Mon, 13 Mar 2023 13:43:04 +0100 Subject: [PATCH] remove conversion, combine directly nd2 --- Snakefile | 14 +++++++++++--- combine.py | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Snakefile b/Snakefile index 2ed2a08..c783a79 100644 --- a/Snakefile +++ b/Snakefile @@ -18,7 +18,7 @@ rule align_and_count: input: data="{folder}/day{day}/BF_TRITC_maxZ.zarr", concentrations="{folder}/concentrations.yaml", - template="template16_pad100-adj-sm2.tif", + template="v3/template_bin16_v3.tif", labels="v3/labels_bin2_v4.tif" output: zarr = directory("{folder}/day{day}/BF_TRITC_aligned.zarr"), @@ -26,6 +26,14 @@ rule align_and_count: shell: "python align.py {input.data} {output.zarr} {input.concentrations} {input.template} {input.labels} {output.table} 1" +rule correct_xy: + input: + zarr = "{folder}/day{day}/BF_TRITC_aligned-to-correct.zarr", + table = "{folder}/day{day}/correction.csv" + output: + zarr = directory("{folder}/day{day}/BF_TRITC_aligned-corrected.zarr") + shell: + "python correct.py {input.zarr} {input.table} {output.zarr}" rule align_and_count_2D: input: @@ -50,8 +58,8 @@ rule get_sizes_nd2: rule combine_BF_TRITC_3D_maxZ: input: - bf="{folder}/day{day}/BF-2D.zarr", - fluo="{folder}/day{day}/TRITC-3D.zarr" + bf="{folder}/day{day}/BF-2D.nd2", + fluo="{folder}/day{day}/TRITC-3D.nd2" output: directory("{folder}/day{day}/BF_TRITC_maxZ.zarr") shell: diff --git a/combine.py b/combine.py index b50dd92..10b142e 100644 --- a/combine.py +++ b/combine.py @@ -2,11 +2,12 @@ import dask.array as da import os from zarr_tools.convert import to_zarr import fire +import nd2 -def combine(BF_zarr_2D_path:str, TRITC_zarr_3D_path:str, out_zarr_path:str): - bd2d = da.from_zarr(os.path.join(BF_zarr_2D_path,'0/')) +def combine(BF_2D_path:str, TRITC_3D_path:str, out_zarr_path:str): + bd2d = nd2.ND2File(BF_2D_path).to_dask() print('Opened BF:', bd2d) - fd3d = da.from_zarr(os.path.join(TRITC_zarr_3D_path,'0/')) + fd3d = nd2.ND2File(TRITC_3D_path).to_dask() print('Opened TRITC:', fd3d) fd2d = fd3d.max(axis=1) bd2d = da.stack([bd2d, fd2d], axis=1) -- GitLab