input type coercion

Post author
Sehyun Oh

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

  • Comment author
    Beri
    No coercion defined from wom value 

    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.  

    0
  • Comment author
    Sehyun Oh

    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.

    2019/06/11 20:04:17 Starting container setup.
    2019/06/11 20:04:24 Done container setup.
    2019/06/11 20:04:30 Starting localization.
    2019/06/11 20:04:36 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.dict -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.dict
    2019/06/11 20:04:44 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf.idx -> /cromwell_root/fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf.idx
    2019/06/11 20:04:52 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf -> /cromwell_root/fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/11 20:05:01 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai
    2019/06/11 20:05:14 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.fasta -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta
    2019/06/11 20:06:07 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/script -> /cromwell_root/script
    2019/06/11 20:06:16 Done localization.
    2019/06/11 20:06:22 Running user action: docker run -v /mnt/local-disk:/cromwell_root --entrypoint= broadinstitute/gatk3@sha256:5ecb139965b86daa9aa85bc531937415d9e98fa8a6b331cb2b05168ac29bc76b /bin/bash /cromwell_root/script
    Error: Unable to access jarfile GenomeAnalysisTK.jar
    2019/06/11 20:06:51 Starting delocalization.
    2019/06/11 20:06:57 Delocalizing output /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/11 20:06:59 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/11 20:06:59 Waiting 5 seconds and retrying
    2019/06/11 20:07:05 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/11 20:07:05 Waiting 5 seconds and retrying
    2019/06/11 20:07:11 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/11 20:07:17 Delocalizing output /cromwell_root/stdout -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/stdout
    2019/06/11 20:07:25 Delocalizing output /cromwell_root/stderr -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/stderr
    2019/06/11 20:07:33 Delocalizing output /cromwell_root/rc -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/e780f596-dcc8-4ed6-8334-6f566cc82059/M1_PON/c70bd7de-4dd3-4408-8521-eef472ec9580/call-SelectVariants/shard-0/rc

    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?

    0
  • Comment author
    Beri

    The error is

    Error: Unable to access jarfile GenomeAnalysisTK.jar

    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.jar
    0
  • Comment author
    Sehyun Oh
    • Edited

    Thanks 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.

    2019/06/12 00:21:39 Starting container setup.
    2019/06/12 00:21:46 Done container setup.
    2019/06/12 00:21:52 Starting localization.
    2019/06/12 00:21:58 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.dict -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.dict
    2019/06/12 00:22:11 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf -> /cromwell_root/fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/12 00:22:20 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon_stats.txt -> /cromwell_root/fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon_stats.txt
    2019/06/12 00:22:30 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai
    2019/06/12 00:22:38 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf.idx -> /cromwell_root/fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-M1/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf.idx
    2019/06/12 00:22:46 Localizing input gs://broad-references/hg19/v0/Homo_sapiens_assembly19.fasta -> /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta
    2019/06/12 00:23:40 Localizing input gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/script -> /cromwell_root/script
    2019/06/12 00:23:50 Done localization.
    2019/06/12 00:23:56 Running user action: docker run -v /mnt/local-disk:/cromwell_root --entrypoint= broadinstitute/gatk3@sha256:5ecb139965b86daa9aa85bc531937415d9e98fa8a6b331cb2b05168ac29bc76b /bin/bash /cromwell_root/script
    Picked up _JAVA_OPTIONS: -Djava.io.tmpdir=/cromwell_root/tmp.e8af7c06
    INFO  00:23:59,270 HelpFormatter - ------------------------------------------------------------------------------------ 
    INFO  00:23:59,273 HelpFormatter - The Genome Analysis Toolkit (GATK) v3.8-1-0-gf15c1c3ef, Compiled 2018/02/19 05:43:50 
    INFO  00:23:59,275 HelpFormatter - Copyright (c) 2010-2016 The Broad Institute 
    INFO  00:23:59,275 HelpFormatter - For support and documentation go to https://software.broadinstitute.org/gatk 
    INFO  00:23:59,276 HelpFormatter - [Wed Jun 12 00:23:59 UTC 2019] Executing on Linux 4.14.104+ amd64 
    INFO  00:23:59,276 HelpFormatter - OpenJDK 64-Bit Server VM 1.8.0_111-8u111-b14-2~bpo8+1-b14 
    INFO  00:23:59,282 HelpFormatter - Program Args: --analysis_type SelectVariants -R /cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta -V C239.TCGA-04-1332-10A-01W.2_pon_stats.txt -o C239.TCGA-04-1332-10A-01W.2_pon.vcf 
    INFO  00:23:59,287 HelpFormatter - Executing as root@4ff1447dded0 on Linux 4.14.104+ amd64; OpenJDK 64-Bit Server VM 1.8.0_111-8u111-b14-2~bpo8+1-b14. 
    INFO  00:23:59,288 HelpFormatter - Date/Time: 2019/06/12 00:23:59 
    INFO  00:23:59,289 HelpFormatter - ------------------------------------------------------------------------------------ 
    INFO  00:23:59,289 HelpFormatter - ------------------------------------------------------------------------------------ 
    ##### ERROR ------------------------------------------------------------------------------------------
    ##### ERROR A USER ERROR has occurred (version 3.8-1-0-gf15c1c3ef): 
    ##### ERROR
    ##### ERROR This means that one or more arguments or inputs in your command are incorrect.
    ##### ERROR The error message below tells you what is the problem.
    ##### ERROR
    ##### ERROR If the problem is an invalid argument, please check the online documentation guide
    ##### ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
    ##### ERROR
    ##### ERROR Visit our website and forum for extensive documentation and answers to 
    ##### ERROR commonly asked questions https://software.broadinstitute.org/gatk
    ##### ERROR
    ##### ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
    ##### ERROR
    ##### ERROR MESSAGE: Could not read file /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon_stats.txt because file 'C239.TCGA-04-1332-10A-01W.2_pon_stats.txt' does not exist
    ##### ERROR ------------------------------------------------------------------------------------------
    2019/06/12 00:24:28 Starting delocalization.
    2019/06/12 00:24:34 Delocalizing output /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/12 00:24:36 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/12 00:24:36 Waiting 5 seconds and retrying
    2019/06/12 00:24:42 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/12 00:24:42 Waiting 5 seconds and retrying
    2019/06/12 00:24:48 rm -f $HOME/.config/gcloud/gce && gsutil   cp /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/ failed
    CommandException: No URLs matched: /cromwell_root/C239.TCGA-04-1332-10A-01W.2_pon.vcf
    2019/06/12 00:24:54 Delocalizing output /cromwell_root/stdout -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/stdout
    2019/06/12 00:25:02 Delocalizing output /cromwell_root/stderr -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/stderr
    2019/06/12 00:25:11 Delocalizing output /cromwell_root/rc -> gs://fc-secure-10ae8bff-1728-48ec-b886-bd30bad080fb/83cae126-11b3-43e0-873c-e105806fa35b/M1_PON/593f97a5-dd01-4b10-bb36-5ecfb6fee017/call-SelectVariants/shard-0/rc

    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?

    0
  • Comment author
    Beri
    • Edited

    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"

    command <<<
    java -jar -Xmx4g /usr/GenomeAnalysisTK.jar \
    --analysis_type SelectVariants \
    -R ${ref_fasta} \
    -V ${input_stats_txt} \
    -o ${VCF_pre}_pon.vcf
    >>>



    Side note: It seems odd to have the variable input_vcf in SelectVariants if its not being used by the task

    0

Please sign in to leave a comment.