UNICYCLER

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/unicycler?label=version%20update%20pull%20requests

Assemble bacterial genomes with Unicycler.

You may find additional information on Unicycler’s github page.

Example

This wrapper can be used in the following way:

rule test_unicycler:
    input:
        # R1 and R2 short reads:
        paired = expand(
            "reads/{sample}.{read}.fq.gz",
            read=["R1", "R2"],
            allow_missing=True
        )
        # Long reads:
        # long = long_reads/{sample}.fq.gz
        # Unpaired reads:
        # unpaired = reads/{sample}.fq.gz
    output:
        "result/{sample}/assembly.fasta"
    log:
        "logs/{sample}.log"
    params:
        extra=""
    wrapper:
        "v1.20.0-15-g28df43c2/bio/unicycler"

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

  • bowtie2=2.4.5
  • bcftools=1.16
  • spades=3.15.5
  • samtools=1.16.1
  • pilon=1.24
  • racon=1.5.0
  • blast=2.13.0
  • unicycler=0.5.0

Input/Output

Input:

  • Fastq-formatted reads

Output:

  • Assembled reads

Authors

  • Thibault Dayris

Code

"""Snakemake wrapper for Unicycler"""

__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2020, Dayris Thibault"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"

from os.path import dirname
from snakemake.shell import shell

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

input_reads = ""
if "paired" in snakemake.input.keys():
    input_reads += " --short1 {} --short2 {}".format(*snakemake.input.paired)
if "unpaired" in snakemake.input.keys():
    input_reads += " --unpaired {} ".format(snakemake.input["unpaired"])
if "long" in snakemake.input.keys():
    input_reads += " --long {} ".format(snakemake.input["long"])

output_dir = " --out {} ".format(dirname(snakemake.output[0]))

shell(
    " unicycler "
    " {input_reads} "
    " --threads {snakemake.threads} "
    " {output_dir} "
    " {extra} "
    " {log} "
)