Skip to content

Commit

Permalink
minkr fixes to get cloud input wprking - note tar remote not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed Aug 17, 2024
1 parent 15a01fc commit 3c41cec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,16 @@ def get_bids_toplevel_targets():

def get_input_dataset(wildcards):
"""returns path to extracted dataset or path to provided input folder"""
in_dataset = get_dataset_path(wildcards)

dataset_path = Path(get_dataset_path(wildcards))
suffix = dataset_path.suffix

if dataset_path.is_dir():
# we have a directory already, just point to it
return str(dataset_path)
print('is a dir')
return get_dataset_path_remote(wildcards)

elif tarfile.is_tarfile(dataset_path):
# dataset was a tar file, so point to the extracted folder
print('is a tar')
return rules.extract_dataset.output.ome_dir.format(**wildcards)

else:
Expand Down Expand Up @@ -173,6 +172,12 @@ def cmd_extract_dataset(wildcards, input, output):

return " && ".join(cmds)

def get_dataset_path_remote(wildcards):
path=get_dataset_path(wildcards)
if is_remote(path):
return storage(path)
else:
return path

def get_dataset_path(wildcards):
df = datasets.query(
Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/import.smk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

rule extract_dataset:
input:
dataset_path=get_dataset_path,
dataset_path=get_dataset_path_remote,
params:
cmd=cmd_extract_dataset,
output:
Expand Down

0 comments on commit 3c41cec

Please sign in to comment.