MULTIQC

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

Generate qc report using multiqc.

URL: https://multiqc.info/

Example

This wrapper can be used in the following way:

rule multiqc_dir:
    input:
        expand("samtools_stats/{sample}.txt", sample=["a", "b"])
    output:
        "qc/multiqc.html"
    params:
        extra=""  # Optional: extra parameters for multiqc.
    log:
        "logs/multiqc.log"
    wrapper:
        "v1.20.0-15-g28df43c2/bio/multiqc"

rule multiqc_file:
    input:
        expand("samtools_stats/{sample}.txt", sample=["a"])
    output:
        "qc/multiqc_a.html"
    params:
        extra="",  # Optional: extra parameters for multiqc.
        use_input_files_only=True, # Optional, use only a.txt and don't search folder samtools_stats for files
    log:
        "logs/multiqc.log"
    wrapper:
        "v1.20.0-15-g28df43c2/bio/multiqc"

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

  • multiqc=1.13

Input/Output

Input:

  • input directory containing qc files, default behaviour is to extract folder path from the provided files or parent folder if a folder is provided.

Output:

  • qc report (html)

Params

  • use_input_files_only: if this variable is set to True input will be used as it is, i.e no folder will be extract from provided file names

Authors

  • Julian de Ruiter

Code

"""Snakemake wrapper for trimming paired-end reads using cutadapt."""

__author__ = "Julian de Ruiter"
__copyright__ = "Copyright 2017, Julian de Ruiter"
__email__ = "julianderuiter@gmail.com"
__license__ = "MIT"


from os import path

from snakemake.shell import shell


extra = snakemake.params.get("extra", "")
# Set this to False if multiqc should use the actual input directly
# instead of parsing the folders where the provided files are located
use_input_files_only = snakemake.params.get("use_input_files_only", False)

if not use_input_files_only:
    input_data = set(path.dirname(fp) for fp in snakemake.input)
else:
    input_data = set(snakemake.input)

output_dir = path.dirname(snakemake.output[0])
output_name = path.basename(snakemake.output[0])
log = snakemake.log_fmt_shell(stdout=True, stderr=True)

shell(
    "multiqc"
    " {extra}"
    " --force"
    " -o {output_dir}"
    " -n {output_name}"
    " {input_data}"
    " {log}"
)