Skip to content

Commit

Permalink
snakemake still supports old pixelsize (deprecation log)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinblampey committed Feb 8, 2024
1 parent 3c7b1b1 commit cdd8573
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## [1.0.3] - tbd

### Breaking changes
- `pixelsize` argument has been renamed to `pixel_size`
- `pixelsize` argument has been renamed to `pixel_size` (the snakemake pipeline is only deprecating it for now)

### Added
- The `phenocycler` reader can now also read `.tif` files (not just `.qptiff`)
Expand Down
14 changes: 14 additions & 0 deletions sopa/cli/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

app_explorer = typer.Typer()

PIXELSIZE_DEPRECATED = (
"`pixelsize` is deprecated and will be removed in future versions. Use `pixel_size` instead."
)


@app_explorer.command()
def write(
Expand All @@ -23,6 +27,10 @@ def write(
0.2125,
help="Number of microns in a pixel. Invalid value can lead to inconsistent scales in the Explorer.",
),
pixelsize: float = typer.Option(
None,
help=PIXELSIZE_DEPRECATED,
),
lazy: bool = typer.Option(
True,
help="If `True`, will not load the full images in memory (except if the image memory is below `ram_threshold_gb`)",
Expand All @@ -41,6 +49,7 @@ def write(
),
):
"""Convert a spatialdata object to Xenium Explorer's inputs"""
import logging
from pathlib import Path

from sopa.io.explorer import write
Expand All @@ -51,6 +60,11 @@ def write(
if output_path is None:
output_path = Path(sdata_path).with_suffix(".explorer")

if pixelsize is not None:
log = logging.getLogger(__name__)
log.critical(PIXELSIZE_DEPRECATED)
pixel_size = pixelsize

write(
output_path,
sdata,
Expand Down
2 changes: 1 addition & 1 deletion workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ rule image_write:
mem_mb=64_000,
partition="longq"
params:
args_explorer = str(args["explorer"].where(keys=['lazy', 'ram_threshold_gb', 'pixel_size'])),
args_explorer = str(args["explorer"].where(keys=['lazy', 'ram_threshold_gb', 'pixel_size', 'pixelsize'])),
shell:
"""
sopa explorer write {paths.sdata_path} --output-path {paths.explorer_directory} {params.args_explorer} --mode '+i' --no-save-h5ad
Expand Down

0 comments on commit cdd8573

Please sign in to comment.