Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosdepth: Add additional summaries to general stats #2257

Merged
merged 10 commits into from
Jan 8, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

### Module updates

- **mosdepth**: Add additional summaries to general stats #2257 ([#2257](https://github.com/MultiQC/MultiQC/pull/2257))

## [MultiQC v1.19](https://github.com/ewels/MultiQC/releases/tag/v1.19) - 2023-12-18

### MultiQC updates
Expand Down
3 changes: 1 addition & 2 deletions docs/modules/mosdepth.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ This will then print a debug log message (use `multiqc -v`) for each excluded co
This is disabled by default as there can be very many in some cases.

Besides the `{prefix}.mosdepth.global.dist.txt` and `{prefix}.mosdepth.region.dist.txt`
files, the `{prefix}.mosdepth.summary.txt` file is used to get the mean coverage for the
General Stats table.
files, the `{prefix}.mosdepth.summary.txt` file is used for the General Stats table.

The module also plots an X/Y relative chromosome coverage per sample. By default, it finds chromosome named X/Y or chrX/chrY, but that can be customised:

Expand Down
51 changes: 43 additions & 8 deletions multiqc/modules/mosdepth/mosdepth.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ def __init__(self):
# assume it will override the information collected for "total":
if line.startswith("total\t") or line.startswith("total_region\t"):
contig, length, bases, mean, min_cov, max_cov = line.split("\t")
genstats[s_name]["mean_coverage"] = mean
genstats[s_name]["mean_coverage"] = float(mean)
genstats[s_name]["min_coverage"] = float(min_cov)
genstats[s_name]["max_coverage"] = float(max_cov)
genstats[s_name]["coverage_bases"] = int(bases)
genstats[s_name]["length"] = int(length)
self.add_data_source(f, s_name=s_name, section="summary")

# Filter out any samples from --ignore-samples
Expand Down Expand Up @@ -320,13 +324,44 @@ def __init__(self):
self.genstats_cov_thresholds(genstats, genstats_headers, cumcov_dist_data, threshs, hidden_threshs)
self.genstats_mediancov(genstats, genstats_headers, cumcov_dist_data)

# Add mean coverage to General Stats
genstats_headers["mean_coverage"] = {
"title": "Mean Cov.",
"description": "Mean coverage",
"min": 0,
"suffix": "X",
"scale": "BuPu",
# Add mosdepth summary to General Stats
genstats_headers = {
"mean_coverage": {
"title": "Mean Cov.",
"description": "Mean coverage",
"min": 0,
"scale": "BuPu",
},
"min_coverage": {
"title": "Min Cov.",
"description": "Minimum coverage",
"min": 0,
"scale": "BuPu",
"hidden": True,
},
"max_coverage": {
"title": "Max Cov.",
"description": "Maximum coverage",
"min": 0,
"scale": "BuPu",
vladsavelyev marked this conversation as resolved.
Show resolved Hide resolved
"hidden": True,
},
"coverage_bases": {
"title": f"{config.base_count_prefix} Total Coverage Bases",
"description": f"Total coverage of bases ({config.base_count_desc})",
"min": 0,
"shared_key": "base_count",
"scale": "Greens",
"hidden": True,
},
"length": {
"title": "Genome length",
"description": "Total length of the genome",
"min": 0,
"scale": "Greys",
"format": "{:,d}",
"hidden": True,
},
}
self.general_stats_addcols(genstats, genstats_headers)

Expand Down