omero-cli-zarr icon indicating copy to clipboard operation
omero-cli-zarr copied to clipboard

Skip wells

Open will-moore opened this issue 10 months ago • 7 comments

This adds support for excluding Wells from Plate export, based on Key-Value pairs.

E.g. if we have "my_key": "my_value" on a Well, we can exclude that with an exact match or with wildcards:

$ omero zarr export Plate:1 --skip_wells_map my_key:my_value

$ omero zarr export Plate:1 --skip_wells_map my_key:my*
$ omero zarr export Plate:1 --skip_wells_map my_key:*value
$ omero zarr export Plate:1 --skip_wells_map my_key:*val*
$ omero zarr export Plate:1 --skip_wells_map my_key:*

# important to use same value if/when you export masks or polygons for the same Plate:

$ omero zarr masks Plate:1 --skip_wells_map my_key:my*

This PR also adds a --metadata_only option, which skips all the pixel data (no chunks) but still includes array metadata .zarray etc. This allows a fast export of a Plate, e.g. to quickly test the --skip_wells_map above.

$ omero zarr export Plate:1 --metadata_only

cc @jrswedlow

will-moore avatar Jun 04 '25 12:06 will-moore

@jrswedlow You can install from this branch with

$ pip install git+https://github.com/ome/omero-cli-zarr.git@refs/pull/174/head

Probably best to $pip uninstall omero-cli-zarr first if you already have it installed.

will-moore avatar Jun 05 '25 09:06 will-moore

Testing against merge-ci looking good:

 $ omero zarr export Plate:19602 --name_by name --skip_wells_map "Even Columns:*"
 $ omero zarr polygons Plate:19602 --overlaps=dtype_max --name_by name --skip_wells_map "Even Columns:*"
 $ ome_zarr view 10WellPlate.ome.zarr/

Delete $ rm -rf 10WellPlate.ome.zarr/ each time and re-export with other options:

 $ omero zarr export Plate:19602 --name_by name --skip_wells_map "label:*2"
 $ omero zarr export Plate:19602 --name_by name --skip_wells_map "label:B*"

will-moore avatar Jun 05 '25 12:06 will-moore

@jrswedlow I've added support for $ omero zarr export_csv Plate:51 --skip_wells_map drug:ex*

I don't know if you've been using the --name_by name option with these exports (supported by export and masks and export_csv commands), but that will give you a plateName.ome.zarr output instead of PLATE_ID.ome.zarr which can be useful.

will-moore avatar Jun 11 '25 08:06 will-moore

@jrswedlow I've added support for $ omero zarr export_csv Plate:51 --skip_wells_map drug:ex*

I don't know if you've been using the --name_by name option with these exports (supported by export and masks and export_csv commands), but that will give you a plateName.ome.zarr output instead of PLATE_ID.ome.zarr which can be useful.

Have tested --skip_wells_map on Plates from Glencoe OMERO Plus and all seems to work. Great work! I have not tested --name_by

jrswedlow avatar Jun 16 '25 11:06 jrswedlow

A quick thought: though for this workflow having the explicit method is more straight-forward, I think there could be sufficiently many workflows that we wouldn't want individual command-line arguments. An alternative would be to have one command that generates a list of Wells (or any object) and then to take that list of identifiers as a skip list:

./find_identifiers wells_map my_key:my* > my_identifiers.txt
omero zarr export Plate:1 --skip my_identifiers.txt

joshmoore avatar Jun 18 '25 10:06 joshmoore

Thanks @joshmoore - that makes sense.

I'm not even sure at this point that we want to release any of this --skip functionality or if this is just a one-off fork for a particular IDR submission (hence the Draft status). TBD...

will-moore avatar Jul 15 '25 11:07 will-moore

Conflicting PR. Removed from build OMERO-plugins-push#552. See the console output for more details. Possible conflicts:

  • PR #172 will-moore 'Use zarr v3 and updated ome-zarr-py'
    • src/omero_zarr/cli.py
    • src/omero_zarr/util.py
    • src/omero_zarr/masks.py
    • src/omero_zarr/raw_pixels.py
    • test/integration/clitest/test_export.py

~~--conflicts~~ Conflict resolved in build OMERO-plugins-push#576. See the console output for more details.

snoopycrimecop avatar Oct 09 '25 08:10 snoopycrimecop