Skip to content

Commit

Permalink
Merge pull request #348 from arayabrain/feature/improve-snakemake-runner
Browse files Browse the repository at this point in the history
improve snakemake runner
  • Loading branch information
emuemuJP authored Jun 11, 2024
2 parents 9b0e3f1 + c580332 commit e9cf786
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions studio/app/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ else:
FILETYPE.MICROSCOPE,
]:
rule:
name:
rule_name
input:
SmkUtils.input(details)
output:
Expand All @@ -36,6 +38,8 @@ else:
f"{DIRPATH.APP_DIR}/common/core/rules/data.py"
else:
rule:
name:
rule_name
input:
SmkUtils.input(details)
output:
Expand Down
6 changes: 6 additions & 0 deletions studio/app/common/core/rules/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ def read_input_info(cls, input_files):
input_info = {}
for filepath in input_files:
load_data = PickleReader.read(filepath)

# validate load_data content
assert (
type(load_data) is dict
), f"Invalid node input data content. [{filepath}]"

merged_nwb = cls.deep_merge(
load_data.pop("nwbfile", {}), input_info.pop("nwbfile", {})
)
Expand Down
8 changes: 5 additions & 3 deletions studio/app/common/core/snakemake/snakemake_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def __init__(
)

def image(self) -> Rule:
return self.builder.set_type("image").build()
return self.builder.set_type(FILETYPE.IMAGE).build()

def csv(self, nodeType="csv") -> Rule:
def csv(self, nodeType=FILETYPE.CSV) -> Rule:
return self.builder.set_type(nodeType).build()

def hdf5(self) -> Rule:
return (
self.builder.set_type("hdf5").set_hdf5Path(self._node.data.hdf5Path).build()
self.builder.set_type(FILETYPE.HDF5)
.set_hdf5Path(self._node.data.hdf5Path)
.build()
)

def mat(self) -> Rule:
Expand Down

0 comments on commit e9cf786

Please sign in to comment.