-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first prototype of a config-based cli tool
- Loading branch information
1 parent
05f6e8d
commit 0d54161
Showing
4 changed files
with
105 additions
and
15 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
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
32 changes: 32 additions & 0 deletions
32
src/depiction_targeted_preproc/workflow/proc/correct_baseline_config.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# TODO this should be handled better in the future, but for illustrative purposes I'm doing it here | ||
from pathlib import Path | ||
|
||
import cyclopts | ||
import yaml | ||
|
||
from depiction_targeted_preproc.pipeline_config.model import PipelineParameters, BaselineAdjustmentTophat | ||
|
||
app = cyclopts.App() | ||
|
||
|
||
@app.default | ||
def correct_baseline_config(input_config: Path, output_config: Path) -> None: | ||
config = PipelineParameters.parse_yaml(input_config) | ||
args = {"n_jobs": config.n_jobs, "baseline_variant": config.baseline_adjustment.baseline_type or "Zero"} | ||
# TODO fix later | ||
if args["baseline_variant"] == "Tophat": | ||
args["baseline_variant"] = "TopHat" | ||
match config.baseline_adjustment: | ||
case BaselineAdjustmentTophat(window_size=window_size, window_unit=window_unit): | ||
args["window_size"] = window_size | ||
args["window_unit"] = window_unit | ||
case _: | ||
pass | ||
output_path = Path(output_config) | ||
output_path.parent.mkdir(parents=True, exist_ok=True) | ||
with output_path.open("w") as f: | ||
yaml.dump(args, f) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
34 changes: 29 additions & 5 deletions
34
src/depiction_targeted_preproc/workflow/rules/rules_proc.smk
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