Skip to content

[Mosdepth] In the absolute coverage distribution, 99% bases are covered at different coverages #1960

Closed

Description

@leonorpalmeira

Description of bug

The "Coverage distribution" figure (Mosdepth module) shows a weird behavior on a set of samples. For example, below, we see 99% of bases being covered at 365X and then again at 375X (true for other coverages and other samples as well).

When looking at the MultiQC module code for the mosdepth, I notice that the cov_dist_data variable is plotted on that figure and that the following code is used to derive absolute coverage values from the cumulative coverage values given by Mosdepth:

                        if x + 1 not in cumcov_dist_data[s_name]:
                            cov_dist_data[s_name][x] = cumcov
                        else:
                            cov_dist_data[s_name][x] = cumcov - cumcov_dist_data[s_name][x + 1]

When there is no value for a given coverage, this results in the cumulative coverage (cumcov) being displayed instead of the absolute coverage. In our case, this is indeed what is happening based on the values in the *region.dist.txt file (no value available for 376X, so 375X displays the cumulative coverage):

grep 375 -A 2 -B 2 14-230615-0043_230724_PanelTwistADRH_25_mosdepth.mosdepth.region.dist.txt | grep total
total    378    0.99
total    377    0.99
total    375    0.99
total    374    0.99
total    373    0.99 

File that triggers the error

Here is what the MultiQC Mosdepth module is showing for the Coverage distribution figure:

Capture d’écran du 2023-07-26 13-37-12

Full MultiQC report:
MultiQC_report.zip

Here is the *region.dist.txt file for one of our samples:

14-230615-0043_230724_PanelTwistADRH_25_mosdepth.mosdepth.region.dist.txt

MultiQC Error log

Our command line:


multiqc --force \
    --ignore somalier.* \
    -n MultiQC_report_${runID} \
    -c multiQC_config.yaml ${qcdir}


The full log:
```bash
********** Launch MultiQC without Somalier **********

  /// MultiQC 🔍 | v1.14

|           multiqc | Report title: HUMANOMICS Quality Control
|           multiqc | Search path : /scratch/CHU/humanomics/res/230724_PanelTwistADRH_25/QC
|         searching | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 1363/1363  
|          mosdepth | Found 64 reports
|            picard | Found 64 AlignmentSummaryMetrics reports
|            picard | Found 64 HsMetrics reports
|            picard | Found 64 InsertSizeMetrics reports
|            picard | Found 64 MarkDuplicates reports
|            picard | Found 64 QualityYieldMetrics reports
|            picard | Found 64 VariantCallingMetrics reports
|           multiqc | Compressing plot data
|           multiqc | Report      : MultiQC_report_230724_PanelTwistADRH_25.html
|           multiqc | Data        : MultiQC_report_230724_PanelTwistADRH_25_data
|           multiqc | MultiQC complete
MultiQC report generated without Somalier
********** Transfer Somalier outputs **********
sending incremental file list
14-230606-0084.somalier

         32,768  15%    0.00kB/s    0:00:00  
        213,214 100%  172.09MB/s    0:00:00 (xfr#1, to-chk=67/68)
14-230606-0085.somalier

         32,768  15%   10.42MB/s    0:00:00  
        213,214 100%   50.83MB/s    0:00:00 (xfr#2, to-chk=66/68)
14-230606-0090.somalier

         32,768  15%    5.21MB/s    0:00:00  
        213,214 100%   29.05MB/s    0:00:00 (xfr#3, to-chk=65/68)
14-230606-0100.somalier

         32,768  15%    3.91MB/s    0:00:00  
        213,214 100%   22.59MB/s    0:00:00 (xfr#4, to-chk=64/68)
14-230607-0010.somalier

         32,768  15%    3.12MB/s    0:00:00  
        213,214 100%   18.49MB/s    0:00:00 (xfr#5, to-chk=63/68)
14-230607-0044.somalier

         32,768  15%    2.60MB/s    0:00:00  
        213,214 100%   15.64MB/s    0:00:00 (xfr#6, to-chk=62/68)
14-230608-0021.somalier

         32,768  15%    2.23MB/s    0:00:00  
        213,214 100%   13.56MB/s    0:00:00 (xfr#7, to-chk=61/68)
14-230608-0083.somalier

         32,768  15%    1.95MB/s    0:00:00  
        213,214 100%   11.96MB/s    0:00:00 (xfr#8, to-chk=60/68)
14-230608-0096.somalier

         32,768  15%    1.74MB/s    0:00:00  
        213,214 100%   10.70MB/s    0:00:00 (xfr#9, to-chk=59/68)
14-230609-0011.somalier

         32,768  15%    1.56MB/s    0:00:00  
        213,214 100%    9.68MB/s    0:00:00 (xfr#10, to-chk=58/68)
14-230609-0049.somalier

         32,768  15%    1.42MB/s    0:00:00  
        213,214 100%    8.84MB/s    0:00:00 (xfr#11, to-chk=57/68)
14-230609-0051.somalier

         32,768  15%    1.36MB/s    0:00:00  
        213,214 100%    8.13MB/s    0:00:00 (xfr#12, to-chk=56/68)
14-230609-0069.somalier

         32,768  15%    1.20MB/s    0:00:00  
        213,214 100%    7.53MB/s    0:00:00 (xfr#13, to-chk=55/68)
14-230612-0040.somalier

         32,768  15%    1.12MB/s    0:00:00  
        213,214 100%    7.01MB/s    0:00:00 (xfr#14, to-chk=54/68)
14-230612-0086.somalier

         32,768  15%    1.04MB/s    0:00:00  
        213,214 100%    6.56MB/s    0:00:00 (xfr#15, to-chk=53/68)
14-230613-0033.somalier

         32,768  15% 1000.00kB/s    0:00:00  
        213,214 100%    6.16MB/s    0:00:00 (xfr#16, to-chk=52/68)
14-230613-0037.somalier

         32,768  15%  941.18kB/s    0:00:00  
        213,214 100%    5.65MB/s    0:00:00 (xfr#17, to-chk=51/68)
14-230613-0075.somalier

         32,768  15%  888.89kB/s    0:00:00  
        213,214 100%    5.35MB/s    0:00:00 (xfr#18, to-chk=50/68)
14-230613-0076.somalier

         32,768  15%  842.11kB/s    0:00:00  
        213,214 100%    5.08MB/s    0:00:00 (xfr#19, to-chk=49/68)
14-230614-0026.somalier

         32,768  15%  780.49kB/s    0:00:00  
        213,214 100%    4.84MB/s    0:00:00 (xfr#20, to-chk=48/68)
14-230615-0025.somalier

         32,768  15%  744.19kB/s    0:00:00  
        213,214 100%    4.62MB/s    0:00:00 (xfr#21, to-chk=47/68)
14-230615-0040.somalier

         32,768  15%  727.27kB/s    0:00:00  
        213,214 100%    4.42MB/s    0:00:00 (xfr#22, to-chk=46/68)
14-230615-0043.somalier

         32,768  15%  695.65kB/s    0:00:00  
        213,214 100%    4.24MB/s    0:00:00 (xfr#23, to-chk=45/68)
14-230615-0093.somalier

         32,768  15%  666.67kB/s    0:00:00  
        213,214 100%    4.07MB/s    0:00:00 (xfr#24, to-chk=44/68)
14-230616-0052.somalier

         32,768  15%  640.00kB/s    0:00:00  
        213,214 100%    3.99MB/s    0:00:00 (xfr#25, to-chk=43/68)
14-230619-0035.somalier

         32,768  15%  615.38kB/s    0:00:00  
        213,214 100%    3.84MB/s    0:00:00 (xfr#26, to-chk=42/68)
14-230619-0088.somalier

         32,768  15%  571.43kB/s    0:00:00  
        213,214 100%    3.57MB/s    0:00:00 (xfr#27, to-chk=41/68)
14-230619-0097.somalier

         32,768  15%  551.72kB/s    0:00:00  
        213,214 100%    3.45MB/s    0:00:00 (xfr#28, to-chk=40/68)
14-230619-0120.somalier

         32,768  15%  533.33kB/s    0:00:00  
        213,214 100%    3.33MB/s    0:00:00 (xfr#29, to-chk=39/68)
14-230620-0035.somalier

         32,768  15%  516.13kB/s    0:00:00  
        213,214 100%    3.23MB/s    0:00:00 (xfr#30, to-chk=38/68)
14-230620-0041.somalier

         32,768  15%  500.00kB/s    0:00:00  
        213,214 100%    3.13MB/s    0:00:00 (xfr#31, to-chk=37/68)
14-230620-0053.somalier

         32,768  15%  484.85kB/s    0:00:00  
        213,214 100%    3.03MB/s    0:00:00 (xfr#32, to-chk=36/68)
14-230620-0091.somalier

         32,768  15%  470.59kB/s    0:00:00  
        213,214 100%    2.95MB/s    0:00:00 (xfr#33, to-chk=35/68)
14-230621-0030.somalier

         32,768  15%  457.14kB/s    0:00:00  
        213,214 100%    2.86MB/s    0:00:00 (xfr#34, to-chk=34/68)
14-230621-0031.somalier

         32,768  15%  444.44kB/s    0:00:00  
        213,214 100%    2.79MB/s    0:00:00 (xfr#35, to-chk=33/68)
14-230621-0083.somalier

         32,768  15%  432.43kB/s    0:00:00  
        213,214 100%    2.71MB/s    0:00:00 (xfr#36, to-chk=32/68)
14-230622-0030.somalier

         32,768  15%  421.05kB/s    0:00:00  
        213,214 100%    2.64MB/s    0:00:00 (xfr#37, to-chk=31/68)
14-230622-0031.somalier

         32,768  15%  410.26kB/s    0:00:00  
        213,214 100%    2.57MB/s    0:00:00 (xfr#38, to-chk=30/68)
14-230623-0022.somalier

         32,768  15%  400.00kB/s    0:00:00  
        213,214 100%    2.51MB/s    0:00:00 (xfr#39, to-chk=29/68)
14-230623-0035.somalier

         32,768  15%  380.95kB/s    0:00:00  
        213,214 100%    2.39MB/s    0:00:00 (xfr#40, to-chk=28/68)
14-230623-0036.somalier

         32,768  15%  372.09kB/s    0:00:00  
        213,214 100%    2.34MB/s    0:00:00 (xfr#41, to-chk=27/68)
14-230623-0037.somalier

         32,768  15%  363.64kB/s    0:00:00  
        213,214 100%    2.28MB/s    0:00:00 (xfr#42, to-chk=26/68)
14-230623-0039.somalier

         32,768  15%  351.65kB/s    0:00:00  
        213,214 100%    2.21MB/s    0:00:00 (xfr#43, to-chk=25/68)
14-230626-0012.somalier

         32,768  15%  344.09kB/s    0:00:00  
        213,214 100%    2.16MB/s    0:00:00 (xfr#44, to-chk=24/68)
14-230626-0014.somalier

         32,768  15%  336.84kB/s    0:00:00  
        213,214 100%    2.12MB/s    0:00:00 (xfr#45, to-chk=23/68)
14-230626-0029.somalier

         32,768  15%  329.90kB/s    0:00:00  
        213,214 100%    2.07MB/s    0:00:00 (xfr#46, to-chk=22/68)
14-230627-0022.somalier

         32,768  15%  323.23kB/s    0:00:00  
        213,214 100%    2.03MB/s    0:00:00 (xfr#47, to-chk=21/68)
14-230627-0030.somalier

         32,768  15%  316.83kB/s    0:00:00  
        213,214 100%    1.99MB/s    0:00:00 (xfr#48, to-chk=20/68)
14-230628-0024.somalier

         32,768  15%  310.68kB/s    0:00:00  
        213,214 100%    1.96MB/s    0:00:00 (xfr#49, to-chk=19/68)
14-230628-0047.somalier

         32,768  15%  304.76kB/s    0:00:00  
        213,214 100%    1.92MB/s    0:00:00 (xfr#50, to-chk=18/68)
14-230628-0071.somalier

         32,768  15%  299.07kB/s    0:00:00  
        213,214 100%    1.88MB/s    0:00:00 (xfr#51, to-chk=17/68)
14-230628-0102.somalier

         32,768  15%  293.58kB/s    0:00:00  
        213,214 100%    1.85MB/s    0:00:00 (xfr#52, to-chk=16/68)
14-230628-0110.somalier

         32,768  15%  288.29kB/s    0:00:00  
        213,214 100%    1.82MB/s    0:00:00 (xfr#53, to-chk=15/68)
14-230629-0071.somalier

         32,768  15%  283.19kB/s    0:00:00  
        213,214 100%    1.78MB/s    0:00:00 (xfr#54, to-chk=14/68)
14-230630-0103.somalier

         32,768  15%  278.26kB/s    0:00:00  
        213,214 100%    1.75MB/s    0:00:00 (xfr#55, to-chk=13/68)
14-230704-0053.somalier

         32,768  15%  273.50kB/s    0:00:00  
        213,214 100%    1.72MB/s    0:00:00 (xfr#56, to-chk=12/68)
14-230704-0149.somalier

         32,768  15%  268.91kB/s    0:00:00  
        213,214 100%    1.69MB/s    0:00:00 (xfr#57, to-chk=11/68)
14-230705-0002.somalier

         32,768  15%  264.46kB/s    0:00:00  
        213,214 100%    1.67MB/s    0:00:00 (xfr#58, to-chk=10/68)
14-230705-0006.somalier

         32,768  15%  260.16kB/s    0:00:00  
        213,214 100%    1.64MB/s    0:00:00 (xfr#59, to-chk=9/68)
14-230705-0012.somalier

         32,768  15%  256.00kB/s    0:00:00  
        213,214 100%    1.61MB/s    0:00:00 (xfr#60, to-chk=8/68)
14-230705-0045.somalier

         32,768  15%  251.97kB/s    0:00:00  
        213,214 100%    1.59MB/s    0:00:00 (xfr#61, to-chk=7/68)
14-230705-0055.somalier

         32,768  15%  248.06kB/s    0:00:00  
        213,214 100%    1.56MB/s    0:00:00 (xfr#62, to-chk=6/68)
14-230706-0021.somalier

         32,768  15%  244.27kB/s    0:00:00  
        213,214 100%    1.54MB/s    0:00:00 (xfr#63, to-chk=5/68)
14-230706-0025.somalier

         32,768  15%  240.60kB/s    0:00:00  
        213,214 100%    1.52MB/s    0:00:00 (xfr#64, to-chk=4/68)
somalier.groups.tsv

         23,345 100%  168.87kB/s    0:00:00  
         23,345 100%  168.87kB/s    0:00:00 (xfr#65, to-chk=3/68)
somalier.html

         32,768  17%  235.29kB/s    0:00:00  
        191,619 100%    1.30MB/s    0:00:00 (xfr#66, to-chk=2/68)
somalier.pairs.tsv

         32,768  22%  222.22kB/s    0:00:00  
        147,197 100%  945.70kB/s    0:00:00 (xfr#67, to-chk=1/68)
somalier.samples.tsv

          7,593 100%   48.46kB/s    0:00:00  
          7,593 100%   48.46kB/s    0:00:00 (xfr#68, to-chk=0/68)

sent 100,136 bytes  received 1,308 bytes  67,629.33 bytes/sec
total size is 14,015,450  speedup is 138.16
Wed Jul 26 06:22:37 CEST 2023


### Before submitting

- [X] I have read the [troubleshooting documentation](https://multiqc.info/docs/#troubleshooting-1).
- [X] I am using the latest release of MultiQC.
- [X] I have included a full MultiQC log, not truncated.
- [X] I have attached an input file (**.zip** if necessary) that triggers the error.

Activity

  1. added a commit that references this issue on Jul 27, 2023
    1c2a291
  2. pontushojer commented on Jul 27, 2023

    @pontushojer
    Contributor

    I update PR #1931 so that this should no longer happen if there are missing coverage x-values in the *.dist.txt file.

    I am however not sure how useful this particular plot is in your case since the coverage distribution is so wide. Possibly it would be beneficial to increase the precision of the cumulative coverage values recovered from mosdepth. The default precision is 2 but you can change it set the envar MOSDEPTH_PRECISION to your required precision, for example like this

  3. leonorpalmeira commented on Jul 28, 2023

    @leonorpalmeira
    Author

    Thanks a lot for your quick answer! This is just a standard plot we do in our pipeline for different applications, it is indeed not always very useful ;-)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions