diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fe99330eac590f690d060a3fbb6cba8773b05bd..1ec340e35ba54c7c5edf70ad83655d7643cf86f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ that users understand how the changes affect the new version. version 1.0.0-dev --------------------------- ++ Common: Add "SampleConfigToSampleReadgroupLists" task + MultiQC: the "interactive" input is now set to true by default + Removed deprecated tasks: + bioconda.installPrefix diff --git a/common.wdl b/common.wdl index fdc6d1858b9b4f9bc6b6684974d46e81aa8bf8dd..b533930da9018cc6a2a3c46ed58240786b9d6001 100644 --- a/common.wdl +++ b/common.wdl @@ -134,6 +134,47 @@ task MapMd5 { } } +task SampleConfigToSampleReadgroupLists { + input { + File yaml + String outputJson = "samples.json" + + String dockerImage = "biowdl/pyyaml:3.13-py37-slim" + } + + command <<< + set -e + mkdir -p $(dirname ~{outputJson}) + python <<CODE + import json + import yaml + with open("~{yaml}", "r") as input_yaml: + sample_config = yaml.load(input_yaml) + + sample_rg_lists = [] + for sample in sample_config["samples"]: + new_sample = {"readgroups": [], "id": sample['id']} + for library in sample["libraries"]: + for readgroup in library["readgroups"]: + new_readgroup = {'lib_id': library['id'], 'id': readgroup['id']} + # Having a nested "reads" struct does not make any sense. + new_readgroup.update(readgroup["reads"]) + new_sample['readgroups'].append(new_readgroup) + sample_rg_lists.append(new_sample) + sample_mod_config = {"samples": sample_rg_lists} + with open("~{outputJson}", "w") as output_json: + json.dump(sample_mod_config, output_json) + CODE + >>> + + output { + File json = outputJson + } + + runtime { + docker: dockerImage + } +} task StringArrayMd5 { input {