Commit 5a37ebb5 authored by van den Berg's avatar van den Berg
Browse files

Add picard AlignmentSummaryMetrics

parent 02d7cd72
......@@ -525,6 +525,7 @@ rule multiqc:
output:
html = "multiqc_report/multiqc_report.html",
insert = "multiqc_report/multiqc_data/multiqc_picard_insertSize.json",
AlignmentMetrics = "multiqc_report/multiqc_data/multiqc_picard_AlignmentSummaryMetrics.json",
HsMetrics = "multiqc_report/multiqc_data/multiqc_picard_HsMetrics.json" if "baitsfile" in config else []
container: containers["multiqc"]
shell: "multiqc --data-format json --force --outdir multiqc_report . "
......@@ -537,11 +538,13 @@ rule merge_stats:
sample=config['samples']),
mpy = config["merge_stats"],
insertSize = rules.multiqc.output.insert,
AlignmentMetrics = rules.multiqc.output.AlignmentMetrics,
HsMetrics = rules.multiqc.output.HsMetrics
output: "stats.json"
container: containers["vtools"]
shell: "python {input.mpy} --collectstats {input.cols} "
"--picard-insertSize {input.insertSize} "
"--picard-AlignmentMetrics {input.AlignmentMetrics} "
"--picard-HsMetrics {input.HsMetrics} > {output}"
rule stats_tsv:
......
......@@ -58,6 +58,18 @@ def add_picard_HsMetrics(data, filename):
raise RuntimeError(f"Unknown sample {sample}")
def add_picard_AlignmentMetrics(data, filename):
AlignmentMetrics = parse_json(filename)
for sample in AlignmentMetrics:
for d in data['sample_stats']:
if d['sample_name'] == sample:
d['picard_AlignmentSummaryMetrics'] = AlignmentMetrics[sample]
break
else:
raise RuntimeError(f"Unknown sample {sample}")
def main(args):
data = dict()
data["sample_stats"] = list()
......@@ -71,6 +83,11 @@ def main(args):
if args.picard_HsMetrics:
add_picard_HsMetrics(data, args.picard_HsMetrics)
if args.picard_AlignmentMetrics:
add_picard_AlignmentMetrics(data,
args.picard_AlignmentMetrics)
print(json.dumps(data))
......@@ -90,5 +107,10 @@ if __name__ == "__main__":
nargs='?',
help=('Path to multiQC json summary for picard '
'HsMetrics'))
parser.add_argument('--picard-AlignmentMetrics',
required=False,
nargs='?',
help=('Path to multiQC json summary for picard '
'AlignmentSummaryMetrics'))
args = parser.parse_args()
main(args)
......@@ -39,6 +39,7 @@
contains:
- MEDIAN_INSERT_SIZE
- WIDTH_OF_99_PERCENT
- picard_AlignmentSummaryMetrics
- name: test-integration-small-scatter
tags:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment