From a7e11d35a2b961b854e61b8352e9d6d8139a9fe7 Mon Sep 17 00:00:00 2001 From: Justin Lim Date: Mon, 7 Oct 2024 14:16:56 -0400 Subject: [PATCH] Remove INFO/CPX_TYPE from TinyResolve VCFs GATK's SVCluster tool will not accept all SV type / CPX subtype combinations so we remove the CPX subtype annotation from all non-CPX SVs in the VCFs produced by TinyResolve. --- wdl/TinyResolve.wdl | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/wdl/TinyResolve.wdl b/wdl/TinyResolve.wdl index c6fe42c6c..c81e67784 100644 --- a/wdl/TinyResolve.wdl +++ b/wdl/TinyResolve.wdl @@ -15,6 +15,7 @@ workflow TinyResolve { Int samples_per_shard = 25 String sv_pipeline_docker String linux_docker + Boolean rm_cpx_type = true RuntimeAttr? runtime_attr_resolve RuntimeAttr? runtime_attr_untar RuntimeAttr? runtime_attr_concattars @@ -78,6 +79,7 @@ workflow TinyResolve { sv_pipeline_docker = sv_pipeline_docker, cytoband=cytoband, cytoband_idx=cytoband_idx, + rm_cpx_type = rm_cpx_type, discfile=GetShardDiscfiles.shard_items, discfile_idx=GetShardDiscfileIndexes.shard_items, mei_bed=mei_bed, @@ -111,6 +113,7 @@ task ResolveManta { File cytoband File mei_bed String sv_pipeline_docker + Boolean rm_cpx_type RuntimeAttr? runtime_attr_override } @@ -139,9 +142,24 @@ task ResolveManta { pe=${discfiles[$i]} sample_no=`printf %03d $i` bash /opt/sv-pipeline/00_preprocessing/scripts/mantatloccheck.sh $vcf $pe ${sample_id} ~{mei_bed} ~{cytoband} - mv ${sample_id}.manta.complex.vcf.gz tloc_${sample_no}.${sample_id}.manta.complex.vcf.gz - bgzip manta.unresolved.vcf - mv manta.unresolved.vcf.gz ${sample_no}.${sample_id}.manta.unresolved.vcf.gz + if [[ ~{true='true' false='false' rm_cpx_type} = 'true' ]]; then + bcftools annotate --include 'INFO/SVTYPE != "CPX"' --keep-sites \ + --remove 'INFO/CPX_TYPE' \ + --output "tloc_${sample_no}.${sample_id}.manta.complex.vcf.gz" \ + --output-type z \ + "${sample_id}.manta.complex.vcf.gz" + rm "${sample_id}.manta.complex.vcf.gz" + bcftools annotate --include 'INFO/SVTYPE != "CPX"' --keep-sites \ + --remove 'INFO/CPX_TYPE' \ + --output "${sample_no}.${sample_id}.manta.unresolved.vcf.gz" \ + --output-type z \ + manta.unresolved.vcf.gz + rm manta.unresolved.vcf.gz + else + mv ${sample_id}.manta.complex.vcf.gz tloc_${sample_no}.${sample_id}.manta.complex.vcf.gz + bgzip manta.unresolved.vcf + mv manta.unresolved.vcf.gz ${sample_no}.${sample_id}.manta.unresolved.vcf.gz + fi done find . -type f -name '*.complex.vcf.gz' \ | tar --create --file='manta_tloc_~{shard_number}.tar' --files-from=-