From bdbaed04b09bc9e991f5ac05858d1197ca89d3af Mon Sep 17 00:00:00 2001 From: Jody Phelan Date: Mon, 18 Nov 2024 15:39:23 +0100 Subject: [PATCH] add plugin decorator --- tb-profiler | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tb-profiler b/tb-profiler index 0ea6137..f1d421a 100644 --- a/tb-profiler +++ b/tb-profiler @@ -101,6 +101,18 @@ def create_output_directories(args,directories=["bam","vcf","results"]): if pp.nofolder(args.dir+"/"+d): os.mkdir(args.dir+"/"+d) +def plugin_decorator(func): + def wrapper(args): + for plugin in tbp.ProfilePlugin.__subclasses__(): + logging.debug(f"Running pre process for {plugin}") + plugin().pre_process(args) + func(args) + for plugin in tbp.ProfilePlugin.__subclasses__(): + logging.debug(f"Running post process for {plugin}") + plugin().post_process(args) + return wrapper + +@plugin_decorator def main_profile(args): pp.process_args(args)