REBALER

Reference-based long read assemblies of bacterial genomes

Example

This wrapper can be used in the following way:

rule rebaler:
    input:
        reference="ref.fa",
        reads="{sample}.fq",
    output:
        assembly="{sample}.asm.fa",
    log:
        "logs/rebaler/{sample}.log",
    params:
        extra="",
    wrapper:
        "0.75.0-7-g74e079c/bio/rebaler"

Note that input, output and log file paths can be chosen freely. When running with

snakemake --use-conda

the software dependencies will be automatically deployed into an isolated environment before execution.

Software dependencies

  • rebaler==0.2.0

Authors

  • Michael Hall

Code

"""Snakemake wrapper for Rebaler - https://github.com/rrwick/Rebaler"""

__author__ = "Michael Hall"
__copyright__ = "Copyright 2020, Michael Hall"
__email__ = "michael@mbh.sh"
__license__ = "MIT"

from snakemake.shell import shell


def get_named_input(name):
    value = snakemake.input.get(name)
    if value is None:
        raise NameError("Missing input named '{}'".format(name))
    return value


def get_named_output(name):
    return snakemake.output.get(name, snakemake.output[0])


log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")

reference = get_named_input("reference")
reads = get_named_input("reads")
output = get_named_output("assembly")

shell("rebaler {extra} -t {snakemake.threads} {reference} {reads} > {output} {log}")