rebaler rebaler __main__

rebaler __main__

Version:
0.2.0
Identifier: TL_065334_54.44
Tool
1"""Snakemake wrapper for Rebaler - https://github.com/rrwick/Rebaler"""
2# Snakemake wrappers are provided by Truwl to teach the internal mechanics of Snakemake recipes. View https://github.com/snakemake/snakemake-wrappers to learn how to use wrappers.
3
4__author__ = "Michael Hall"
5__copyright__ = "Copyright 2020, Michael Hall"
6__email__ = "michael@mbh.sh"
7__license__ = "MIT"
8
9from snakemake.shell import shell
10
11
12def get_named_input(name):
13    value = snakemake.input.get(name)
14    if value is None:
15        raise NameError("Missing input named '{}'".format(name))
16    return value
17
18
19def get_named_output(name):
20    return snakemake.output.get(name, snakemake.output[0])
21
22
23log = snakemake.log_fmt_shell(stdout=False, stderr=True)
24extra = snakemake.params.get("extra", "")
25
26reference = get_named_input("reference")
27reads = get_named_input("reads")
28output = get_named_output("assembly")
29
30shell("rebaler {extra} -t {snakemake.threads} {reference} {reads} > {output} {log}")
31