name: gatk_tumor_normal_somatic_variant_calling
description: |
  Perform variant calling on a paired tumor normal set of samples using mutect2 tumor normal mode.
  f1r2 output of mutect2 is run through learnreadorientationmodel to get the artifact priors.
  Run the input bam files through getpileupsummarries and then calculatecontamination to get the contamination and segmentation tables.
  Filter the mutect2 output vcf using filtermutectcalls, artifact priors and the contamination & segmentation tables for additional filtering.
keywords:
  - gatk4
  - mutect2
  - learnreadorientationmodel
  - getpileupsummaries
  - calculatecontamination
  - filtermutectcalls
  - variant_calling
  - tumor_only
  - filtered_vcf
modules:
  - gatk4/mutect2
  - gatk4/learnreadorientationmodel
  - gatk4/getpileupsummaries
  - gatk4/calculatecontamination
  - gatk4/filtermutectcalls
input:
  - meta:
      type: map
      description: |
        Groovy Map containing sample information
        e.g. [ id:'test' ]
  - input:
      type: list
      description: list containing the tumor and normal BAM files, in that order, also able to take CRAM as an input
      pattern: "[ *.{bam/cram} ]"
  - input_index:
      type: list
      description: list containing the tumor and normal BAM file indexes, in that order, also able to take CRAM index as an input
      pattern: "[ *.{bam.bai/cram.crai} ]"
  - which_norm:
      type: list
      description: optional list of sample headers contained in the normal sample input file.
      pattern: "testN"
  - fasta:
      type: file
      description: The reference fasta file
      pattern: "*.fasta"
  - fai:
      type: file
      description: Index of reference fasta file
      pattern: "*.fasta.fai"
  - dict:
      type: file
      description: GATK sequence dictionary
      pattern: "*.dict"
  - germline_resource:
      type: file
      description: Population vcf of germline sequencing, containing allele fractions.
      pattern: "*.vcf.gz"
  - germline_resource_tbi:
      type: file
      description: Index file for the germline resource.
      pattern: "*.vcf.gz.tbi"
  - panel_of_normals:
      type: file
      description: vcf file to be used as a panel of normals.
      pattern: "*.vcf.gz"
  - panel_of_normals_tbi:
      type: file
      description: Index for the panel of normals.
      pattern: "*.vcf.gz.tbi"
  - interval_file:
      type: file
      description: File containing intervals.
      pattern: "*.interval_list"
output:
  - versions:
      type: file
      description: File containing software versions
      pattern: "versions.yml"
  - mutect2_vcf:
      type: file
      description: Compressed vcf file to be used for variant_calling.
      pattern: "[ *.vcf.gz ]"
  - mutect2_tbi:
      type: file
      description: Indexes of the mutect2_vcf file
      pattern: "[ *vcf.gz.tbi ]"
  - mutect2_stats:
      type: file
      description: Stats files for the mutect2 vcf
      pattern: "[ *vcf.gz.stats ]"
  - mutect2_f1r2:
      type: file
      description: file containing information to be passed to LearnReadOrientationModel.
      pattern: "*.f1r2.tar.gz"
  - artifact_priors:
      type: file
      description: file containing artifact-priors to be used by filtermutectcalls.
      pattern: "*.tar.gz"
  - pileup_table_tumor:
      type: file
      description: File containing the tumor pileup summary table, kept separate as calculatecontamination needs them individually specified.
      pattern: "*_tumor.pileups.table"
  - pileup_table_normal:
      type: file
      description: File containing the normal pileup summary table, kept separate as calculatecontamination needs them individually specified.
      pattern: "*_normal.pileups.table"
  - contamination_table:
      type: file
      description: File containing the contamination table.
      pattern: "*.contamination.table"
  - segmentation_table:
      type: file
      description: Output table containing segmentation of tumor minor allele fractions.
      pattern: "*.segmentation.table"
  - filtered_vcf:
      type: file
      description: file containing filtered mutect2 calls.
      pattern: "*.vcf.gz"
  - filtered_tbi:
      type: file
      description: tbi file that pairs with filtered vcf.
      pattern: "*.vcf.gz.tbi"
  - filtered_stats:
      type: file
      description: file containing statistics of the filtermutectcalls run.
      pattern: "*.filteringStats.tsv"
authors:
  - "@GCJMackenzie"
