SAMTOOLS FASTQ INTERLEAVED#

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

Convert a bam file back to unaligned reads in a single fastq file with samtools. For paired end reads, this results in an unsorted interleaved file.

Example#

This wrapper can be used in the following way:

rule samtools_fastq_interleaved:
    input:
        "mapped/{sample}.bam",
    output:
        "reads/{sample}.fq",
    log:
        "{sample}.interleaved.log",
    params:
        " ",
    threads: 3
    wrapper:
        "v3.0.1-5-gc155ca9/bio/samtools/fastq/interleaved"

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#

Software dependencies#

  • samtools=1.14

  • snakemake-wrapper-utils=0.5.2

Authors#

  • David Laehnemann

  • Victoria Sack

  • Filipe G. Vieira

Code#

__author__ = "David Laehnemann, Victoria Sack"
__copyright__ = "Copyright 2018, David Laehnemann, Victoria Sack"
__email__ = "david.laehnemann@hhu.de"
__license__ = "MIT"


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

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

shell("samtools fastq {samtools_opts} {extra} {snakemake.input[0]} {log}")