Skip to content
Snippets Groups Projects
Commit 4b0fbb40 authored by JB's avatar JB
Browse files

Add "SampleConfigToSampleReadgroupLists" task to common.wdl

parent 4886c4f2
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment