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

feat: extract additional WGS metrics #907

Merged
merged 9 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions BALSAMIC/assets/scripts/collect_qc_metrics.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def collect_qc_metrics(

def capture_kit_resolve_type(capture_kit: str):
"""Resolves the capture_kit type (NoneType or String)"""

if capture_kit == "None":
return None
else:
Expand All @@ -67,9 +68,12 @@ def get_multiqc_data_source(multiqc_data: dict, sample: str, tool: str) -> str:
A source file that was used to produce a specific metric
"""

# Use case: splits multiqc_picard_dups into ['multiqc', 'picard', 'dup'] in order to retrieve the
# ["report_data_sources"]["Picard"]["DuplicationMetrics"] values from multiqc_data.json
subtool_name = tool[:-1].split("_")
if tool == "multiqc_general_stats":
subtool_name = ["multiqc", "FastQC", "all_sections"]
else:
# Use case: splits multiqc_picard_dups into ['multiqc', 'picard', 'dup'] in order to retrieve the
# ["report_data_sources"]["Picard"]["DuplicationMetrics"] values from multiqc_data.json
subtool_name = tool[:-1].split("_")

# Nested json fetching
for source_tool in multiqc_data["report_data_sources"]:
Expand Down Expand Up @@ -139,15 +143,16 @@ def extract(data, output_metrics, sample=None, source=None):

if isinstance(data, dict):
for k in data:
if "umi" not in k:
# Ignore UMI and reverse reads metrics
if "umi" not in k and "R_2" not in str(sample):
if k in requested_metrics:
output_metrics.append(
MetricModel(
id=sample.split("_")[1],
input=get_multiqc_data_source(
multiqc_data, sample, source
),
name=k,
name=k if "FastQC" not in k else "PERCENT_DUPLICATION",
step=source,
value=data[k],
condition=requested_metrics[k]["condition"],
Expand Down
12 changes: 11 additions & 1 deletion BALSAMIC/constants/quality_check_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,15 @@
"FOLD_80_BASE_PENALTY": {"condition": {"norm": "lt", "threshold": 1.8}},
},
},
"wgs": {"FOLD_80_BASE_PENALTY": {"condition": {"norm": "lt", "threshold": 1.8}}},
"wgs": {
"MEAN_INSERT_SIZE": {"condition": None},
"MEDIAN_COVERAGE": {"condition": None},
"FastQC_mqc-generalstats-fastqc-percent_duplicates": {"condition": None},
"PCT_5X": {"condition": None},
keyvanelhami marked this conversation as resolved.
Show resolved Hide resolved
"PCT_15X": {"condition": None},
"PCT_30X": {"condition": None},
"PCT_60X": {"condition": None},
"PCT_100X": {"condition": None},
"FOLD_80_BASE_PENALTY": {"condition": {"norm": "lt", "threshold": 1.8}},
ivadym marked this conversation as resolved.
Show resolved Hide resolved
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"DuplicationMetrics": {
"concatenated_tumor_XXXXXX_R": "tests/test_data/qc_files/analysis/bam/concatenated_tumor_XXXXXX_R.sorted.mrkdup.txt"
}
},
"FastQC": {
"all_sections": {
"concatenated_tumor_XXXXXX_R_2": "tests/test_data/qc_files/analysis/fastqc/concatenated_tumor_XXXXXX_R_2_fastqc.zip",
"concatenated_normal_XXXXXX_R_1": "tests/test_data/qc_files/analysis/fastqc/concatenated_normal_XXXXXX_R_1_fastqc.zip",
"concatenated_normal_XXXXXX_R_2": "tests/test_data/qc_files/analysis/fastqc/concatenated_normal_XXXXXX_R_2_fastqc.zip",
"concatenated_tumor_XXXXXX_R_1": "tests/test_data/qc_files/analysis/fastqc/concatenated_tumor_XXXXXX_R_1_fastqc.zip"
}
}
},
"report_saved_raw_data": {
Expand Down Expand Up @@ -76,6 +84,24 @@
"READ_PAIR_DUPLICATES": 18741892.0,
"PERCENT_DUPLICATION": 0.391429
}
},
"multiqc_general_stats": {
"concatenated_tumor_XXXXXX_R_2": {
"FastQC_mqc-generalstats-fastqc-percent_duplicates": 15.03521942842923,
"FastQC_mqc-generalstats-fastqc-total_sequences": 600529762.0
},
"concatenated_normal_XXXXXX_R_1": {
"FastQC_mqc-generalstats-fastqc-percent_duplicates": 14.426654287440797,
"FastQC_mqc-generalstats-fastqc-total_sequences": 464581551.0
},
"concatenated_normal_XXXXXX_R_2": {
"FastQC_mqc-generalstats-fastqc-percent_duplicates": 14.214689357571501,
"FastQC_mqc-generalstats-fastqc-total_sequences": 464581551.0
},
"concatenated_tumor_XXXXXX_R_1": {
"FastQC_mqc-generalstats-fastqc-percent_duplicates": 15.213739762327492,
"FastQC_mqc-generalstats-fastqc-total_sequences": 600529762.0
}
}
}
}