BWA ALN

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

Map reads with bwa aln. For more information about BWA see BWA documentation.

URL: https://github.com/lh3/bwa

Example

This wrapper can be used in the following way:

rule bwa_aln:
    input:
        fastq="reads/{sample}.{pair}.fastq",
        idx=multiext("genome", ".amb", ".ann", ".bwt", ".pac", ".sa"),
    output:
        "sai/{sample}.{pair}.sai",
    params:
        extra="",
    log:
        "logs/bwa_aln/{sample}.{pair}.log",
    threads: 8
    wrapper:
        "v4.6.0/bio/bwa/aln"

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.

Notes

  • The extra param allows for additional arguments for bwa-mem.

  • The sorting param allows to enable sorting, and can be either ‘none’, ‘samtools’ or ‘picard’.

  • The sort_extra allows for extra arguments for samtools/picard

Software dependencies

  • bwa=0.7.18

Input/Output

Input:

  • fastq” FASTQ file(s)

  • idx: BWA reference genome index

Output:

  • SAI file

Authors

  • Julian de Ruiter

  • Filipe G. Vieira

Code

"""Snakemake wrapper for bwa aln."""

__author__ = "Julian de Ruiter"
__copyright__ = "Copyright 2017, Julian de Ruiter"
__email__ = "julianderuiter@gmail.com"
__license__ = "MIT"

from os import path
from snakemake.shell import shell


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

index = snakemake.input.idx
if isinstance(index, str):
    index = path.splitext(snakemake.input.idx)[0]
else:
    index = path.splitext(snakemake.input.idx[0])[0]

shell(
    "bwa aln"
    " {extra}"
    " -t {snakemake.threads}"
    " {index}"
    " {snakemake.input.fastq}"
    " > {snakemake.output[0]} {log}"
)