From 428dfaa7e66c9f4273c70c30132cfa6105f5183c Mon Sep 17 00:00:00 2001 From: Ayush Kamat Date: Thu, 26 Oct 2023 16:18:55 -0700 Subject: [PATCH] wrapper extractor Signed-off-by: Ayush Kamat --- latch_cli/snakemake/wrappers/__init__.py | 0 latch_cli/snakemake/wrappers/extractor.py | 24 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 latch_cli/snakemake/wrappers/__init__.py create mode 100644 latch_cli/snakemake/wrappers/extractor.py diff --git a/latch_cli/snakemake/wrappers/__init__.py b/latch_cli/snakemake/wrappers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/latch_cli/snakemake/wrappers/extractor.py b/latch_cli/snakemake/wrappers/extractor.py new file mode 100644 index 00000000..a69a1d11 --- /dev/null +++ b/latch_cli/snakemake/wrappers/extractor.py @@ -0,0 +1,24 @@ +from pathlib import Path +from typing import List + +from snakemake.rules import Rule +from snakemake.workflow import Workflow + + +class SnakemakeWrapperExtractor(Workflow): + def __init__(self, pkg_root: Path, snakefile: Path): + self.pkg_root = pkg_root + + super().__init__(snakefile=snakefile) + + def extract_wrappers(self) -> List[str]: + wrappers: List[str] = [] + + rule: Rule + for rule in self.rules: + if not rule.is_wrapper: + continue + + wrappers.append(rule.wrapper) + + return wrappers