input type coercion
Hi! I'm trying to run BAM files on MuTect and SelectVariants afterwards. I provide BAM/BAI files as Array[File] to MuTect and its output is used as File input for SelectVariants. I'm getting the error below and wonder anyone can help to resolve this.
SelectVariantsFailed to evaluate input 'VCF_pre' (reason 1 of 1): No coercion defined from wom value(s) '["C239.TCGA-04-1332-10A-01W.2"]' of type 'Array[String]' to 'String'.
Here is my tool.
}%MCEPASTEBIN%workflow M1_PON {
# inputs
Array[File] normal_bams
Array[File] normal_bais
File ref_fasta
File ref_fai
File ref_dict
String mutect1_docker
String gatk_docker
Array[Pair[File,File]] normal_bam_pairs = zip(normal_bams, normal_bais)
scatter (normal_bam_pair in normal_bam_pairs) {
File normal_bam = normal_bam_pair.left
File normal_bai = normal_bam_pair.right
call M1 {
input:
normal_bam = normal_bam,
normal_bai = normal_bai,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
mutect1_docker = mutect1_docker
}
}
call SelectVariants {
input:
input_vcf = M1.output_pon_vcf,
input_vcf_idx = M1.output_pon_vcf_index,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
gatk_docker = gatk_docker,
VCF_pre = M1.fname
}
call CombineVariants {
input:
input_filtered_vcfs = SelectVariants.filtered_vcf,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
gatk_docker = gatk_docker
}
output {
File pon = CombineVariants.pon
}
meta {
author: "Sehyun Oh"
email: "shbrief@gmail.com"
description: "Build Pool of Normal (PoN) using MuTect v.1.1.7 for PureCN"
}
}
task M1 {
# input
File normal_bam
File normal_bai
File dbsnp_vcf
File dbsnp_vcf_idx
File cosmicVCF
File ref_fasta
File ref_fai
File ref_dict
String BAM_pre = basename(normal_bam, ".bam")
# runtime
String mutect1_docker
Int disk_size = ceil(size(normal_bam, "GB")) + 30
command <<<
java -jar -Xmx4g /home/mutect-1.1.7.jar \
--analysis_type MuTect \
-R ${ref_fasta} \
--artifact_detection_mode \
--dbsnp ${dbsnp_vcf} \
--cosmic ${cosmicVCF} \
-dt None \
-I:tumor ${normal_bam} \
-o ${BAM_pre}_pon_stats.txt \
-vcf ${BAM_pre}_pon.vcf
>>>
runtime {
docker: mutect1_docker # jvivian/mutect
memory: "32 GB"
disks: "local-disk " + disk_size + " HDD"
}
output {
String fname = "${BAM_pre}"
File output_pon_vcf = "${BAM_pre}_pon.vcf"
File output_pon_vcf_index = "${BAM_pre}_pon.vcf.idx"
File output_pon_stats_txt = "${BAM_pre}_pon_stats.txt"
}
}
task SelectVariants {
# input
File input_vcf
File? input_vcf_idx
File ref_fasta
File ref_fai
File ref_dict
String VCF_pre
# runtime
String gatk_docker
command <<<
java -jar -Xmx4g GenomeAnalysisTK.jar \
--analysis_type SelectVariants \
-R ${ref_fasta} \
-V ${VCF_pre}_pon_stats.txt \
-o ${VCF_pre}_pon.vcf
>>>
runtime {
docker: gatk_docker
memory: "8 GB"
}
output {
File filtered_vcf = "${VCF_pre}_pon.vcf"
}
}
task CombineVariants {
# input
Array[File] input_filtered_vcfs
File ref_fasta
File ref_fai
File ref_dict
# runtime
String gatk_docker
command <<<
java -jar -Xmx24g GenomeAnalysisTK.jar \
-T CombineVariants \
-nt 4 --minimumN 5 --genotypemergeoption UNSORTED \
-R ${ref_fasta} \
--variant ${input_filtered_vcfs} \
-o "normals.merged.min5.vcf"
>>>
runtime {
docker: gatk_docker
memory: "32 GB"
}
output {
File pon = "normals.merged.min5.vcf"
}
Comments
5 comments
Normally means there is a discrepancy variables types. The SelectVariants is expecting a String value for `VCF_pre` but it received Array[String]. This is due to your SelectVariants task being called outside the scatter brackets. Thus SelectVariants is being given all the strings from the scattered M1 task. Move your SelectVariants call in the scatter bracket.
Thanks Beri! Move SelectVariants call in the scatter bracket fixed the above error.
But it seems like SelectVariants can't recognize the output from MuTect1 task. Here is the error.
I tried to set the type of input_vcf as both 'File' (the above script) and 'String' (not copied in this thread), but still got the same error. Any suggestion?
The error is
You need to edit your SelectVariants command so that its executing the GenomeAnalysisTK.jar file form the correct path in your docker.
command <<< java -jar -Xmx4g /path/to/GenomeAnalysisTK.jarThanks Beri! I missed it out but could fixed it providing a proper path. :)
But I still have a same problem with recognizing MuTect outputs as SelectVariants inputs. Here is the error.
Here is the WDL script I used.
workflow M1_PON {
# inputs
Array[File] normal_bams
Array[File] normal_bais
File ref_fasta
File ref_fai
File ref_dict
String mutect1_docker
String gatk_docker
Array[Pair[File,File]] normal_bam_pairs = zip(normal_bams, normal_bais)
scatter (normal_bam_pair in normal_bam_pairs) {
File normal_bam = normal_bam_pair.left
File normal_bai = normal_bam_pair.right
call M1 {
input:
normal_bam = normal_bam,
normal_bai = normal_bai,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
mutect1_docker = mutect1_docker
}
call SelectVariants {
input:
input_vcf = M1.output_pon_vcf,
input_vcf_idx = M1.output_pon_vcf_index,
input_stats_txt = M1.output_pon_stats_txt,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
gatk_docker = gatk_docker,
VCF_pre = M1.fname
}
}
call CombineVariants {
input:
input_filtered_vcfs = SelectVariants.filtered_vcf,
ref_fasta = ref_fasta,
ref_fai = ref_fai,
ref_dict = ref_dict,
gatk_docker = gatk_docker
}
output {
Array[File] output_pon_vcf = M1.output_pon_vcf
Array[File] output_pon_vcf_index = M1.output_pon_vcf_index
Array[File] output_pon_stats_txt = M1.output_pon_stats_txt
Array[File] filtered_vcf = SelectVariants.filtered_vcf
File pon = CombineVariants.pon
}
meta {
author: "Sehyun Oh"
email: "shbrief@gmail.com"
description: "Build Pool of Normal (PoN) using MuTect v.1.1.7 for PureCN"
}
}
task M1 {
# input
File normal_bam
File normal_bai
File dbsnp_vcf
File dbsnp_vcf_idx
File cosmicVCF
File ref_fasta
File ref_fai
File ref_dict
String BAM_pre = basename(normal_bam, ".bam")
# runtime
String mutect1_docker
Int disk_size = ceil(size(normal_bam, "GB")) + 30
command <<<
java -jar -Xmx4g /home/mutect-1.1.7.jar \
--analysis_type MuTect \
-R ${ref_fasta} \
--artifact_detection_mode \
--dbsnp ${dbsnp_vcf} \
--cosmic ${cosmicVCF} \
-dt None \
-I:tumor ${normal_bam} \
-o ${BAM_pre}_pon_stats.txt \
-vcf ${BAM_pre}_pon.vcf
>>>
runtime {
docker: mutect1_docker # jvivian/mutect
memory: "32 GB"
disks: "local-disk " + disk_size + " HDD"
}
output {
String fname = "${BAM_pre}"
File output_pon_vcf = "${BAM_pre}_pon.vcf"
File output_pon_vcf_index = "${BAM_pre}_pon.vcf.idx"
File output_pon_stats_txt = "${BAM_pre}_pon_stats.txt"
}
}
task SelectVariants {
# input
File input_vcf
File input_vcf_idx
File input_stats_txt
File ref_fasta
File ref_fai
File ref_dict
String VCF_pre
# runtime
String gatk_docker
command <<<
java -jar -Xmx4g /usr/GenomeAnalysisTK.jar \
--analysis_type SelectVariants \
-R ${ref_fasta} \
-V ${VCF_pre}_pon_stats.txt \
-o ${VCF_pre}_pon.vcf
>>>
runtime {
docker: gatk_docker
memory: "8 GB"
}
output {
File filtered_vcf = "${VCF_pre}_pon.vcf"
}
}
task CombineVariants {
# input
Array[String] input_filtered_vcfs
File ref_fasta
File ref_fai
File ref_dict
# runtime
String gatk_docker
command <<<
java -jar -Xmx24g /usr/GenomeAnalysisTK.jar \
-T CombineVariants \
-nt 4 --minimumN 5 --genotypemergeoption UNSORTED \
-R ${ref_fasta} \
--variant ${input_filtered_vcfs} \
-o "normals.merged.min5.vcf"
>>>
runtime {
docker: gatk_docker
memory: "32 GB"
}
output {
File pon = "normals.merged.min5.vcf"
}
}
MuTect outputs seem to be localized under the sub-folders of /cromwell_root folder. Do you know how I can extract this file path for SelectVariants?
Your SelectVariant input "input_stats_txt" is set as the pon_stats file
input_stats_txt = M1.output_pon_stats_txt,
If you want to use the pon stat txt file than replace the "-V ${VCF_pre}_pon_stats.txt" with the original input variable in the task "File input_stats_txt"
Side note: It seems odd to have the variable input_vcf in SelectVariants if its not being used by the task
Please sign in to leave a comment.