This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Flagstats and multiqc

Hi everyone,

I'm curently trying to use multiqc to collect flagstats .json outputs. Unfortunately it doesn't seem to work as expected.

Here's how I proceeded :

-How I made the flagstats json : samtools flagstat X.sam -O json -@ 2 > X_flagstat.json

-How I used multiqc : multiqc . -c ./multiqc_config.yaml

My multiqc_config.yaml :

sp:
  samtools/flagstat:
    contents: >
      in total (QC-passed reads + QC-failed
      reads)
    shared: true
    fn: '*flagstat*'

Thanks for the help.

multiqc samtools flagstat

Any specific reason you are creating a .json output using samtools? A general .txt file should be enough and multiqc will be able to easily collate those text files into a report.

it does work with a .txt but I need json format for various data storage reasons

1 answer

MultiQC only knows how to parse the .txt output from samtools flagstat currently, so updating the search pattern won't help here. Even if MultiQC finds the files the module won't know what to do with them.

You're welcome to submit a pull-request to add JSON parsing capability to the module so that it can handle both file formats. The relevant code is here: https://github.com/ewels/MultiQC/blob/master/multiqc/modules/samtools/flagstat.py (or you can create an issue with some example files).

Note that MultiQC normalises and saves all data that it processes, and you can choose from csv, tsv, json and yaml for that. So another option would be to get samtools to generate .txt files and then use -k json with MultiQC and use the files in multiqc_data for your downstream work.

Phil

Log in to answer this question.