SHOVILL

Assemble bacterial isolate genomes from Illumina paired-end reads.

Example

This wrapper can be used in the following way:

rule shovill:
  input:
    r1="reads/{sample}_R1.fq.gz",
    r2="reads/{sample}_R2.fq.gz"
  output:
    raw_assembly="assembly/{sample}.{assembler}.assembly.fa",
    contigs="assembly/{sample}.{assembler}.contigs.fa"
  params:
    extra=""
  log:
    "logs/shovill/{sample}.{assembler}.log"
  threads: 1
  wrapper:
    "0.75.0-13-g0997adf/bio/shovill"

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

  • shovill==1.1.0

Authors

  • Sangram Keshari Sahu

Code

"""Snakemake wrapper for shovill."""

__author__ = "Sangram Keshari Sahu"
__copyright__ = "Copyright 2020, Sangram Keshari Sahu"
__email__ = "sangramsahu15@gmail.com"
__license__ = "MIT"

from snakemake.shell import shell
from tempfile import TemporaryDirectory

# Placeholder for optional parameters
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
params = snakemake.params.get("extra", "")

with TemporaryDirectory() as tempdir:
    shell(
        "(shovill"
        " --assembler {snakemake.wildcards.assembler}"
        " --outdir {tempdir} --force"
        " --R1 {snakemake.input.r1}"
        " --R2 {snakemake.input.r2}"
        " --cpus {snakemake.threads}"
        " {params}) {log}"
    )

    shell(
        "mv {tempdir}/{snakemake.wildcards.assembler}.fasta {snakemake.output.raw_assembly}"
        " && mv {tempdir}/contigs.fa {snakemake.output.contigs}"
    )