Skip to content

Faulty mosdepth integration #1868

Closed

Description

@a-frantz

Description of bug

We've noticed a few problems with the mosdepth module of MultiQC.

  • Some samples (very few) have partial dropouts. In the general stats table, they'll have a value for "Mean Coverage", but no other columns and they don't appear in the figures. I can't find anything malformed in the files, but I've attached an example: SJBT033512_G2.WholeGenome.mosdepth.global.dist.txt. Haven't seen anything in the MultiQC logs indicating what's happening.
  • In the multiqc_data dir, mosdepth_cov_dist.txt and mosdepth_cumcov_dist.txt aren't being populated with any data. mosdepth_perchrom.txt seems to be fine though.
  • The scaling for the Coverage distribution and Avg. coverage per contig figures isn't sensible.
    • For Coverage distribution, our test set of WGS samples was never above 7% at any data point, so the default Y-axis of 0-100% makes the data indistinguishable. Disabling Y-limits helps quite a bit, and should be the default.
      • We also found the "spiky lines" make the figure too hard to read with significant overlap of samples. We think this can be significantly improved by smoothing the slopes of the lines between data points
    • Average coverage per contig should be log scaled.

File that triggers the error

SJBT033512_G2.WholeGenome.mosdepth.global.dist.txt

MultiQC Error log

/// MultiQC � | v1.14

[2023-02-13 10:17:47,493] multiqc                                            [DEBUG  ]  This is MultiQC v1.14
[2023-02-13 10:17:47,497] multiqc                                            [DEBUG  ]  Loading config settings from: /research_jude/rgs01_jude/groups/zhanggrp/projects/SJCloud/common/qc/multiqc_config.yaml
[2023-02-13 10:17:47,497] multiqc                                            [DEBUG  ]  New config: {'plots_force_interactive': True}
[2023-02-13 10:17:47,497] multiqc                                            [DEBUG  ]  Added to filename clean extensions: [['.qualimap_bamqc_results', '.subsampled', '.ValidateSamFile']]
[2023-02-13 10:17:47,497] multiqc                                            [DEBUG  ]  Command used: /home/afrantz/miniconda3/bin/multiqc -vvv -f -z -c /research_jude/rgs01_jude/groups/zhanggrp/projects/SJCloud/common/qc/multiqc_config.yaml .
[2023-02-13 10:17:48,091] multiqc                                            [DEBUG  ]  Latest MultiQC version is v1.14
[2023-02-13 10:17:48,091] multiqc                                            [DEBUG  ]  Working dir : /lustre_scratch/user_scratch/afrantz/replace_outputs/WGS
[2023-02-13 10:17:48,091] multiqc                                            [DEBUG  ]  Template    : default
[2023-02-13 10:17:48,091] multiqc                                            [DEBUG  ]  Running Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:20:04) [GCC 11.3.0]
[2023-02-13 10:17:48,092] multiqc                                            [DEBUG  ]  Analysing modules: custom_content, ccs, ngsderive, purple, conpair, lima, peddy, somalier, methylQA, mosdepth, phantompeakqualtools, qualimap, preseq, hifiasm, quast, qorts, rna_seqc, rockhopper, rsem, rseqc, busco, bustools, goleft_indexcov, gffcompare, disambiguate, supernova, deeptools, sargasso, verifybamid, mirtrace, happy, mirtop, sambamba, gopeaks, homer, hops, macs2, theta2, snpeff, gatk, htseq, bcftools, featureCounts, fgbio, dragen, dragen_fastqc, dedup, pbmarkdup, damageprofiler, biobambam2, jcvi, mtnucratio, picard, vep, sentieon, prokka, qc3C, nanostat, samblaster, samtools, sexdeterrmine, eigenstratdatabasetools, bamtools, jellyfish, vcftools, longranger, stacks, varscan2, snippy, umitools, bbmap, bismark, biscuit, diamond, hicexplorer, hicup, hicpro, salmon, kallisto, slamdunk, star, hisat2, tophat, bowtie2, bowtie1, cellranger, snpsplit, odgi, pangolin, nextclade, humid, kat, leeho
 m, adapterRemoval, bbduk, clipandmerge, cutadapt, flexbar, kaiju, kraken, malt, motus, trimmomatic, sickle, skewer, sortmerna, biobloomtools, fastq_screen, afterqc, fastp, fastqc, filtlong, prinseqplusplus, pychopper, porechop, pycoqc, minionqc, anglerfish, multivcfanalyzer, clusterflow, checkqc, bcl2fastq, bclconvert, interop, ivar, flash, seqyclean, optitype, whatshap
[2023-02-13 10:17:48,092] multiqc                                            [DEBUG  ]  Using temporary directory for creating report: /lsf_tmp/182103854.tmpdir/tmpayz8qkc9
[2023-02-13 10:17:48,239] multiqc                                            [INFO   ]  Search path : /lustre_scratch/user_scratch/afrantz/replace_outputs/WGS
|         searching | ���������������������������������������� 100% 3475/3475  
[2023-02-13 10:39:50,589] multiqc                                            [DEBUG  ]  Summary of files that were skipped by the search: [skipped_module_specific_max_filesize: 8201] // [skipped_no_match: 1392] // [skipped_ignore_pattern: 695] // [skipped_directory_fn_ignore_dirs: 139] // [skipped_filesize_limit: 2]
[2023-02-13 10:39:51,364] multiqc.plots.bargraph                             [DEBUG  ]  Using matplotlib version 3.6.3
[2023-02-13 10:39:51,365] multiqc.plots.linegraph                            [DEBUG  ]  Using matplotlib version 3.6.3
[2023-02-13 10:39:51,365] multiqc                                            [DEBUG  ]  No samples found: custom_content
[2023-02-13 10:39:53,861] multiqc.modules.ngsderive.ngsderive                [INFO   ]  Found 139 reports
[2023-02-13 10:39:53,945] multiqc.modules.mosdepth.mosdepth                  [DEBUG  ]  include_contigs: []
[2023-02-13 10:39:53,946] multiqc.modules.mosdepth.mosdepth                  [DEBUG  ]  exclude_contigs: []
[2023-02-13 10:40:22,048] multiqc.modules.mosdepth.mosdepth                  [INFO   ]  Found 139 reports
[2023-02-13 10:40:22,256] multiqc.modules.mosdepth.mosdepth                  [DEBUG  ]  Using default coverage thresholds: 1, 5, 10, 30, 50
[2023-02-13 10:40:24,102] multiqc.modules.picard.picard                      [INFO   ]  Found 139 AlignmentSummaryMetrics reports
[2023-02-13 10:40:25,752] multiqc.modules.picard.picard                      [INFO   ]  Found 139 GcBiasMetrics reports
[2023-02-13 10:40:28,893] multiqc.modules.picard.picard                      [INFO   ]  Found 139 InsertSizeMetrics reports
[2023-02-13 10:40:29,770] multiqc.modules.picard.picard                      [INFO   ]  Found 139 QualityScoreDistributionMetrics reports
[2023-02-13 10:40:33,733] multiqc.modules.picard.picard                      [INFO   ]  Found 139 ValidateSamFile reports
[2023-02-13 10:40:35,571] multiqc.modules.picard.picard                      [INFO   ]  Found 139 WgsMetrics reports
[2023-02-13 10:40:36,408] multiqc.modules.samtools.samtools                  [INFO   ]  Found 139 flagstat reports
[2023-02-13 10:40:36,974] multiqc.modules.fastq_screen.fastq_screen          [INFO   ]  Found 139 reports
[2023-02-13 10:40:57,182] multiqc.modules.fastqc.fastqc                      [INFO   ]  Found 139 reports
[2023-02-13 10:40:59,654] multiqc                                            [INFO   ]  Compressing plot data
[2023-02-13 10:41:10,321] multiqc                                            [INFO   ]  Report      : multiqc_report.html
[2023-02-13 10:41:10,322] multiqc                                            [INFO   ]  Data        : multiqc_data
[2023-02-13 10:41:10,322] multiqc                                            [DEBUG  ]  Moving data file from '/lsf_tmp/182103854.tmpdir/tmpayz8qkc9/multiqc_data' to '/lustre_scratch/user_scratch/afrantz/replace_outputs/WGS/multiqc_data'
[2023-02-13 10:41:11,600] multiqc                                            [INFO   ]  MultiQC complete

Before submitting

  • I have read the troubleshooting documentation.
  • I am using the latest release of MultiQC.
  • I have included a full MultiQC log, not truncated.
  • I have attached an input file (.zip if necessary) that triggers the error.

Activity

  1. a-frantz commented on Feb 16, 2023

    @a-frantz
    ContributorAuthor

    An additional issue I just discovered. The documentation (both official docs and comments in the code) say that the supported mosdepth file types are *.global.dist.txt and *.region.dist.txt. However the Mean Cov. metric in the general stats table comes *.summary.txt. Appears that is the only thing that gets pulled from the file, but it should be noted in the documentation that the summary file needs to be present for a complete report.

  2. a-frantz commented on Feb 17, 2023

    @a-frantz
    ContributorAuthor

    Ahha! Solved one of the above issues. Fairly straightforward, but I couldn't see it at first due to the incorrect documentation.

    The "partial dropout" issue is caused by the *.summary.txt file being parsed for "Mean Cov.", and the *.global.dist.txt being ignored for one reason or the other (in our case, filesize limit). This was tougher to figure out than it should be because *.summary.txt files don't show up in multiqc_sources.txt. Meaning I couldn't find the source of the "Mean Cov." stat and had to codedive to figure it out.

  3. added
    bug: module
    on Mar 12, 2023
  4. a-frantz commented on May 27, 2023

    @a-frantz
    ContributorAuthor

    @ewels found another bug with this module. Took me a long time to figure out, as it's another "partial dropout" case but a different cause than what I've already alerted you to. Haven't check the code but I assume this particular bug will be trivial to fix.

    The >30x % metric is parsed from the *[global,region].dist.txt file. If the value the module is looking for is equal to 0.00 nothing gets displayed and the cell in "General Stats" is empty.
    Obviously the correct behavior is to display 0%. This was very confusing to figure out because I assumed the file wasn't being picked up, but the logs showed all the files being selected as expected.

  5. pontushojer commented on May 29, 2023

    @pontushojer
    Contributor

    @a-frantz I have now implemented some of the changes in PR #1931. Please try it out and see if it improves things for you.

    • Some samples (very few) have partial dropouts. In the general stats table, they'll have a value for "Mean Coverage", but no other columns and they don't appear in the figures. I can't find anything malformed in the files, but I've attached an example: SJBT033512_G2.WholeGenome.mosdepth.global.dist.txt. Haven't seen anything in the MultiQC logs indicating what's happening.

    The reason for the file SJBT033512_G2.WholeGenome.mosdepth.global.dist.txt not appearing in the report is that it is too large (>10MB) and is thus filtered out, see https://multiqc.info/docs/usage/troubleshooting/#big-log-files.

    • We also found the "spiky lines" make the figure too hard to read with significant overlap of samples. We think this can be significantly improved by smoothing the slopes of the lines between data points

    It this is an issue you should probably rely on the Cumulative coverage distribution plot instead, it appears much less noisy for changes in coverage.

    Compare this
    mosdepth-cumcoverage-dist-id

    to this
    mosdepth-coverage-dist-id (1)

    To fix the Coverage distribution plot one would have to compute some kind of moving average and I am not sure that is appropriate for MultiQC.

  6. ewels commented on Aug 3, 2023

    @ewels
    Member

    @a-frantz - closed by merging PR #1931. Please shout if there's anything that's wrong (either in a new issue or we can reopen this one).

    Thanks @pontushojer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: module

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions