fix(workflow): skip OME-ZARR conversion when the store already exists - #26
Merged
Conversation
Make the convert rule's output a marker file inside the store (image.zarr/zarr.json) instead of directory(IMAGE), mirroring the sopa ".zgroup trick". Snakemake then natively skips conversion when the store already exists and never wipes the whole store on a re-run, so an expensive convert is not redone. Downstream rules depend on the marker. Drops the earlier overwrite_zarr config flag / in-script existence guard in favour of plain Snakemake DAG semantics. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-running the workflow no longer redoes the (expensive) OME-ZARR conversion if
image.zarralready exists.Adopts the idiomatic Snakemake approach used by imcf/sopa: the
convertrule'soutput:is a single marker file inside the store (image.zarr/zarr.json) instead ofdirectory(IMAGE). Snakemake then:convertwhen the marker exists (no custom guard / config flag), anddirectory()pre-delete hazard).Downstream rules depend on the marker file. Removed the earlier
overwrite_zarrflag and in-script existence check.To force a fresh conversion: delete
image.zarrorsnakemake --forcerun convert.Test
End-to-end on a synthetic CZYX OME-TIFF (
thresholdmethod, no GPU):image.zarr): job stats list onlyprepare+segment+merge—convertabsent, store reused. 11/11 done.🤖 Generated with Claude Code