BOWTIE2_BUILD

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

Map reads with bowtie2.

URL: http://bowtie-bio.sourceforge.net/bowtie2/manual.shtml

Example

This wrapper can be used in the following way:

rule bowtie2_build:
    input:
        ref="genome.fasta",
    output:
        multiext(
            "genome",
            ".1.bt2",
            ".2.bt2",
            ".3.bt2",
            ".4.bt2",
            ".rev.1.bt2",
            ".rev.2.bt2",
        ),
    log:
        "logs/bowtie2_build/build.log",
    params:
        extra="",  # optional parameters
    threads: 8
    wrapper:
        "v3.10.2-32-gf4e5b66/bio/bowtie2/build"



rule bowtie2_build_large:
    input:
        ref="genome.fasta",
    output:
        multiext(
            "genome",
            ".1.bt2l",
            ".2.bt2l",
            ".3.bt2l",
            ".4.bt2l",
            ".rev.1.bt2l",
            ".rev.2.bt2l",
        ),
    log:
        "logs/bowtie2_build/build.log",
    params:
        extra="--large-index",  # optional parameters
    threads: 8
    wrapper:
        "v3.10.2-32-gf4e5b66/bio/bowtie2/build"

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 program arguments.

Software dependencies

  • bowtie2=2.5.4

Input/Output

Input:

  • ref: Path to FASTA reference

Output:

  • Path to Bowtie2 reference index

Params

  • extra: additional program arguments besides –threads and io options.

Authors

  • Daniel Standage

  • Filipe G. Vieira

Code

__author__ = "Daniel Standage"
__copyright__ = "Copyright 2020, Daniel Standage"
__email__ = "daniel.standage@nbacc.dhs.gov"
__license__ = "MIT"


import os
from snakemake.shell import shell

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


index = os.path.commonprefix(snakemake.output).rstrip(".")


shell(
    "bowtie2-build"
    " --threads {snakemake.threads}"
    " {extra}"
    " {snakemake.input.ref}"
    " {index}"
    " {log}"
)