Skip to content

Commit

Permalink
fix in params uri
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed Jul 18, 2024
1 parent 78d2d66 commit 6d3b57b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
1 change: 0 additions & 1 deletion workflow/lib/cloud_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def is_remote(uri_string):
def get_fsspec(uri_string,storage_provider_settings=None,creds=None):
uri = Path(uri_string)
if uri.protocol == 'gcs':
print('is gcs')
from gcsfs import GCSFileSystem
gcsfs_opts={}
gcsfs_opts={'project': storage_provider_settings['gcs'].get_settings().project,
Expand Down
11 changes: 0 additions & 11 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@ def get_extension_ome_zarr():
return "ome.zarr"


def strip_snakemake_touch(path):
"""This strips the .snakemake_touch (see get_extension_ome_zarr)
from the given path. Use this with params to obtain a uri for the
remote file."""
suffix = ".zarr/" + ".snakemake_touch"
if path.endswith(suffix):
return path[: -len(suffix)] + ".zarr"
else:
return path


# targets
def get_all_targets():
targets = []
Expand Down
27 changes: 24 additions & 3 deletions workflow/rules/ome_zarr.smk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ rule zarr_to_ome_zarr:
scaling_method=config["ome_zarr"]["scaling_method"],
downsampling=config["bigstitcher"]["fuse_dataset"]["downsampling"],
stains=get_stains,
uri=lambda wildcards, output: strip_snakemake_touch(output.zarr),
uri=_bids(
root=root,
subject="{subject}",
datatype="micr",
sample="{sample}",
acq="{acq}",
suffix="SPIM.ome.zarr",
),
storage_provider_settings=workflow.storage_provider_settings,
output:
**get_output_ome_zarr("blaze"),
Expand Down Expand Up @@ -60,7 +67,14 @@ rule tif_stacks_to_ome_zarr:
scaling_method=config["ome_zarr"]["scaling_method"],
downsampling=config["bigstitcher"]["fuse_dataset"]["downsampling"],
stains=get_stains,
uri=lambda wildcards, output: strip_snakemake_touch(output.zarr),
uri=_bids(
root=root,
subject="{subject}",
datatype="micr",
sample="{sample}",
acq="{acq}",
suffix="SPIM.ome.zarr",
),
storage_provider_settings=workflow.storage_provider_settings,
output:
**get_output_ome_zarr("prestitched"),
Expand Down Expand Up @@ -121,7 +135,14 @@ rule ome_zarr_to_nii:
zarr=get_input_ome_zarr_to_nii(),
params:
channel_index=lambda wildcards: get_stains(wildcards).index(wildcards.stain),
uri=lambda wildcards, input: strip_snakemake_touch(input.zarr),
uri=_bids(
root=root,
subject="{subject}",
datatype="micr",
sample="{sample}",
acq="{acq}",
suffix="SPIM.ome.zarr",
),
storage_provider_settings=workflow.storage_provider_settings,
output:
nii=bids(
Expand Down

0 comments on commit 6d3b57b

Please sign in to comment.