SAMTOOLS FASTQ INTERLEAVED

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.

URL:

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:
        "v1.2.1/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.

Software dependencies

  • samtools=1.14
  • snakemake-wrapper-utils=0.3

Notes

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}")