SAMTOOLS VIEW

Convert or filter SAM/BAM. For more information see SAMtools documentation.

URL:

Example

This wrapper can be used in the following way:

rule samtools_view:
    input:
        "{sample}.sam"
    output:
        "{sample}.bam"
    log:
        "{sample}.log"
    params:
        extra="" # optional params string
    wrapper:
        "v1.1.0/bio/samtools/view"

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

  • samtools==1.12
  • snakemake-wrapper-utils==0.2.0

Input/Output

Input:

  • SAM/BAM/CRAM file

Output:

  • SAM/BAM/CRAM file

Notes

Authors

  • Johannes Köster
  • Filipe G. Vieira

Code

__author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"


from snakemake.shell import shell
from snakemake_wrapper_utils.samtools import get_samtools_opts


samtools_opts = get_samtools_opts(snakemake)
log = snakemake.log_fmt_shell(stdout=True, stderr=True, append=True)


shell(
    "samtools view {snakemake.params.extra} {samtools_opts} -o {snakemake.output[0]} {snakemake.input[0]} {log}"
)