QUALIMAP RNASEQ

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

Run qualimap bamqc to create a QC report for aligned NGS data data. It can be used for WGS, WES, RNA, ChIP-Seq, etc.

URL: http://qualimap.conesalab.org/doc_html/analysis.html#bam-qc

Example

This wrapper can be used in the following way:

rule qualimap:
    input:
        # BAM aligned, splicing-aware, to reference genome
        bam="mapped/a.bam",
    output:
        directory("qc/a"),
    log:
        "logs/qualimap/bamqc/a.log",
    # optional specification of memory usage of the JVM that snakemake will respect with global
    # resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources)
    # and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`:
    # https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties
    resources:
        mem_mb=4096,
    wrapper:
        "v3.8.0-1-g149ef14/bio/qualimap/bamqc"

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

  • qualimap=2.3

  • snakemake-wrapper-utils=0.6.2

Input/Output

Input:

  • BAM file of data aligned to genome

Output:

  • QC report in TXT format (genome_results.txt)

Authors

  • Fritjof Lammers

  • Brett Copeland

Code

__author__ = "Fritjof Lammers"
__copyright__ = "Copyright 2022, Fritjof Lammers"
__email__ = "f.lammers@dkfz.de"

__license__ = "MIT"


import os

from snakemake.shell import shell
from snakemake_wrapper_utils.java import get_java_opts

java_opts = get_java_opts(snakemake)

if java_opts:
    java_opts_str = f'JAVA_OPTS="{java_opts}"'
else:
    java_opts_str = ""

# unset DISPLAY environment variable to avoid X11 error message issued by qualimap
if os.environ.get("DISPLAY"):
    del os.environ["DISPLAY"]

extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
shell(
    "{java_opts_str} qualimap bamqc {extra} "
    "-bam {snakemake.input.bam} "
    "-outdir {snakemake.output} "
    "{log}"
)