Skip to content

Commit

Permalink
add plugin decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyphelan committed Nov 18, 2024
1 parent 82236e3 commit bdbaed0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tb-profiler
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bdbaed0

Please sign in to comment.