From b16f6923e644dde124271dd3ebe105e970108c45 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Tue, 11 Jul 2023 16:50:30 -0400 Subject: [PATCH 1/6] Fixed typo --- cwl/fillout_maf2vcf.cwl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwl/fillout_maf2vcf.cwl b/cwl/fillout_maf2vcf.cwl index 714c872..0777d97 100644 --- a/cwl/fillout_maf2vcf.cwl +++ b/cwl/fillout_maf2vcf.cwl @@ -26,7 +26,7 @@ requirements: vcf_sorted_gz="${ return inputs.sample_id + '.sorted.vcf.gz' }" sample_id="${ return inputs.sample_id }" # convert maf to vcf - num_lines=num_lines="\$(wc -l < \${input_maf})" + num_lines="\$(wc -l < \${input_maf})" more_than_five="\$(( \${num_lines} > 5))" if [ "\${more_than_five}" == "1" ] then From a58679b828fe496a53cc4b4ebc0d973595d67e6d Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Tue, 11 Jul 2023 16:50:53 -0400 Subject: [PATCH 2/6] Create empty output vcf if input is empty --- cwl/samples_fillout_workflow.cwl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/cwl/samples_fillout_workflow.cwl b/cwl/samples_fillout_workflow.cwl index 5c22526..51b6a63 100644 --- a/cwl/samples_fillout_workflow.cwl +++ b/cwl/samples_fillout_workflow.cwl @@ -136,7 +136,30 @@ steps: fasta="${ return inputs.ref_fasta.path; }" vcf="${ return inputs.targets_vcf.path }" fillout_vcf="fillout.vcf" - GetBaseCountsMultiSample --fasta "\${fasta}" --vcf "\${vcf}" --maq 20 --baq 20 --filter_improper_pair 0 --thread 8 --output "\${fillout_vcf}" \${bams_arg} + num_lines="\$(grep -v '^[#]' \${input_maf} | wc -l)" + more_than_zero="\$(( \${num_lines} > 0))" + if [ "\${more_than_zero}" == "1" ] + then + GetBaseCountsMultiSample --fasta "\${fasta}" --vcf "\${vcf}" --maq 20 --baq 20 --filter_improper_pair 0 --thread 8 --output "\${fillout_vcf}" \${bams_arg} + else + cat << EOF > "\${fillout_vcf}" + ##fileformat=VCFv4.2 + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + ##FORMAT= + #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT P-\${sample_id} \${sample_id} + EOF + fi inputs: sample_ids: string[] ref_fasta: From 02644425c35fe3ac65528f0cd89c72c4ef26ef38 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Wed, 12 Jul 2023 13:54:41 -0400 Subject: [PATCH 3/6] Added sample ids to the vcf --- cwl/samples_fillout_workflow.cwl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cwl/samples_fillout_workflow.cwl b/cwl/samples_fillout_workflow.cwl index 51b6a63..3e9717a 100644 --- a/cwl/samples_fillout_workflow.cwl +++ b/cwl/samples_fillout_workflow.cwl @@ -133,6 +133,7 @@ steps: var args2 = args1.map( (a) => "--bam " + a ) return args2.join(" ") ; }' + sample_ids="${ return inputs.sample_ids.join("\t"); }" fasta="${ return inputs.ref_fasta.path; }" vcf="${ return inputs.targets_vcf.path }" fillout_vcf="fillout.vcf" @@ -157,7 +158,7 @@ steps: ##FORMAT= ##FORMAT= ##FORMAT= - #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT P-\${sample_id} \${sample_id} + #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT P-\${sample_ids} EOF fi inputs: From 13833c39c870dc3046983e4dbb0d2f554440cc28 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Wed, 12 Jul 2023 13:54:59 -0400 Subject: [PATCH 4/6] Fixed typo in num lines check --- cwl/samples_fillout_workflow.cwl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwl/samples_fillout_workflow.cwl b/cwl/samples_fillout_workflow.cwl index 3e9717a..919c526 100644 --- a/cwl/samples_fillout_workflow.cwl +++ b/cwl/samples_fillout_workflow.cwl @@ -137,7 +137,7 @@ steps: fasta="${ return inputs.ref_fasta.path; }" vcf="${ return inputs.targets_vcf.path }" fillout_vcf="fillout.vcf" - num_lines="\$(grep -v '^[#]' \${input_maf} | wc -l)" + num_lines="\$(grep -v '^[#]' \${vcf} | wc -l)" more_than_zero="\$(( \${num_lines} > 0))" if [ "\${more_than_zero}" == "1" ] then From 13b40607323c000599cd61ba7800499ab5b29177 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Wed, 12 Jul 2023 14:52:15 -0400 Subject: [PATCH 5/6] Set header line to be tab delimited --- cwl/samples_fillout_workflow.cwl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cwl/samples_fillout_workflow.cwl b/cwl/samples_fillout_workflow.cwl index 919c526..5c9704b 100644 --- a/cwl/samples_fillout_workflow.cwl +++ b/cwl/samples_fillout_workflow.cwl @@ -133,7 +133,12 @@ steps: var args2 = args1.map( (a) => "--bam " + a ) return args2.join(" ") ; }' - sample_ids="${ return inputs.sample_ids.join("\t"); }" + header_line='${ + var headers = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"] + var sample_ids = inputs.sample_ids + var header_list = headers.concat(sample_ids) + return header_list.join("\t"); + }' fasta="${ return inputs.ref_fasta.path; }" vcf="${ return inputs.targets_vcf.path }" fillout_vcf="fillout.vcf" @@ -158,7 +163,7 @@ steps: ##FORMAT= ##FORMAT= ##FORMAT= - #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT P-\${sample_ids} + #\${header_line} EOF fi inputs: From bd38a858f740b285010c2b640a27383361e3010c Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Thu, 13 Jul 2023 15:03:05 -0400 Subject: [PATCH 6/6] Fixed bug to properly detect empty mafs --- cwl/fillout_maf2vcf.cwl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cwl/fillout_maf2vcf.cwl b/cwl/fillout_maf2vcf.cwl index 0777d97..14ecbd6 100644 --- a/cwl/fillout_maf2vcf.cwl +++ b/cwl/fillout_maf2vcf.cwl @@ -26,9 +26,9 @@ requirements: vcf_sorted_gz="${ return inputs.sample_id + '.sorted.vcf.gz' }" sample_id="${ return inputs.sample_id }" # convert maf to vcf - num_lines="\$(wc -l < \${input_maf})" - more_than_five="\$(( \${num_lines} > 5))" - if [ "\${more_than_five}" == "1" ] + num_lines="\$(grep -v '^[#]' \${input_maf} | wc -l)" + more_than_one="\$(( \${num_lines} > 1))" + if [ "\${more_than_one}" == "1" ] then maf2vcf.pl --output-dir . --input-maf "\${input_maf}" --output-vcf "\${vcf}" --ref-fasta "\${fasta}" else