-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from oist/feature/debug
Feature/debug
- Loading branch information
Showing
47 changed files
with
121 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
import os | ||
from optinist.api.dir_path import DIRPATH | ||
from optinist.api.utils.filepath_creater import join_filepath | ||
from optinist.api.snakemake.smk_utils import smk_input, smk_output, smk_conda | ||
from optinist.routers.model import FILETYPE | ||
|
||
configfile: join_filepath([DIRPATH.ROOT_DIR, 'config.yaml']) | ||
|
||
for rule, details in config["rules"].items(): | ||
include: details["rule_file"] | ||
|
||
rule all: | ||
input: [join_filepath([DIRPATH.OUTPUT_DIR, x]) for x in config["last_output"]] | ||
input: [join_filepath([DIRPATH.OUTPUT_DIR, x]) for x in config["last_output"]] | ||
|
||
|
||
for rule_name, details in config["rules"].items(): | ||
if details["type"] in [FILETYPE.IMAGE, FILETYPE.CSV, FILETYPE.BEHAVIOR, FILETYPE.HDF5]: | ||
rule: | ||
input: | ||
smk_input(details) | ||
output: | ||
smk_output(details) | ||
params: | ||
name = details | ||
script: | ||
f"{DIRPATH.ROOT_DIR}/rules/scripts/data.py" | ||
else: | ||
rule: | ||
input: | ||
smk_input(details) | ||
output: | ||
smk_output(details) | ||
params: | ||
name = details | ||
conda: | ||
smk_conda(details) | ||
script: | ||
f"{DIRPATH.ROOT_DIR}/rules/scripts/func.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
|
||
@dataclass | ||
class Rule: | ||
rule_file: str | ||
input: list | ||
return_arg: Union[str, Dict[str, str]] | ||
params: dict | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from optinist.api.dir_path import DIRPATH | ||
from optinist.api.utils.filepath_creater import join_filepath | ||
from optinist.routers.model import FILETYPE | ||
from optinist.wrappers import wrapper_dict | ||
|
||
|
||
def smk_input(details): | ||
if details["type"] in [FILETYPE.IMAGE]: | ||
return [ | ||
join_filepath([DIRPATH.INPUT_DIR, x]) | ||
for x in details["input"] | ||
] | ||
elif details["type"] in [FILETYPE.CSV, FILETYPE.BEHAVIOR, FILETYPE.HDF5]: | ||
return join_filepath([DIRPATH.INPUT_DIR, details["input"]]) | ||
else: | ||
return [ | ||
join_filepath([DIRPATH.OUTPUT_DIR, x]) | ||
for x in details["input"] | ||
] | ||
|
||
|
||
def smk_output(details): | ||
return join_filepath([ | ||
DIRPATH.OUTPUT_DIR, | ||
details["output"] | ||
]) | ||
|
||
|
||
def smk_conda(details): | ||
if details["type"] in [FILETYPE.IMAGE, FILETYPE.CSV, FILETYPE.BEHAVIOR, FILETYPE.HDF5]: | ||
return None | ||
|
||
wrapper = _dict2leaf( | ||
wrapper_dict, | ||
details["path"].split('/') | ||
) | ||
|
||
if "conda" in wrapper: | ||
env_filename = wrapper['conda'] | ||
return f"{DIRPATH.ROOT_DIR}/rules/envs/{env_filename}" | ||
else: | ||
return None | ||
|
||
|
||
def _dict2leaf(root_dict: dict, path_list): | ||
path = path_list.pop(0) | ||
if len(path_list) > 0: | ||
return _dict2leaf(root_dict[path], path_list) | ||
else: | ||
return root_dict[path] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
optinist/rules/smk/dummy/dummy_image2image8roi8time8heat.smk
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.