splaisan
splaisan

Reputation: 923

RSeQC with multiQC and snakemake

I want to include RSeQC results using multiQC in a snakemake workflows. I have the issue that one of the RSeQC tool only reports a .r and a .pdf while it seems that multiQC requires a .txt input to create a plot.

Has anyone working code for snakemake that recover info from RSeQC into a multiQC rule.

As this is a combination of three tools, it is difficult to get support.


My code here of which only the geneBodyCoverage.txt RSeQC output is used (not the two .r outputs and especially junctionSaturation_plot.r of which there is nothing else than the .r and the png picture)

rule multiqc_global:
"""
Aggregate all MultiQC reports
"""
  input:
    expand("intermediate/{smp}_fastqc.zip", smp=SAMPLES),
    expand("intermediate/merged_{smp}_fastqc.zip", smp=SAMPLES),
    expand("logs/star/{smp}_Log.final.out", smp=SAMPLES),
    expand("intermediate/{smp}.geneBodyCoverage.txt", smp=SAMPLES),
    expand("intermediate/{smp}.geneBodyCoverage.r", smp=SAMPLES),
    expand("intermediate/{smp}.junctionSaturation_plot.r", smp=SAMPLES),
  output:
    html = "results/global_multiqc.html",
    stats = "intermediate/global_multiqc_general_stats.txt"
  log:
    "logs/multiqc/global_multiqc.log"
  version: "1.0"
  shadow: "minimal"
  shell: 
    """
    # Run multiQC and keep the html report
    multiqc -n multiqc.html {input} 2> {log}
    mv multiqc.html {output.html}
    mv multiqc_data/multiqc_general_stats.txt {output.stats}
    """

Upvotes: 3

Views: 747

Answers (1)

merv
merv

Reputation: 77117

This is sort of anecdotal, since as @JeeYem pointed out in a comment, it could depend on what analysis you're running with RSeQC. Here's how I use the read_distribution.py analysis in snakemake, which generates a compatible file that MultiQC recognizes.

rule read_distribution:
    input:
        bam = "data/bam/{srr}.bam",
        bed = config["gencodeBED"]
    output:
        "qc/aligned/{srr}.read_distribution.txt"
    shell:
        """
        read_distribution.py -i {input.bam} -r {input.bed} &> {output}
        """

Basically, just redirect the stdout and err streams to a file. Hopefully, it's a similar thing for the other RSeQC scripts.

Upvotes: 2

Related Questions