Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing failing subworkflow tests #3343

Merged
merged 10 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
// Run GATK mutect2 in tumor normal mode, getepileupsummaries, calculatecontamination, learnreadorientationmodel and filtermutectcalls
//

params.mutect2_options = [:]
params.learnorientation_options = [:]
params.getpileup_tumor_options = [suffix: '_tumor']
params.getpileup_normal_options = [suffix: '_normal']
params.calccontam_options = [:]
params.filtercalls_options = [suffix: '_filtered']

include { GATK4_MUTECT2 as MUTECT2 } from '../../../modules/nf-core/gatk4/mutect2/main'
include { GATK4_LEARNREADORIENTATIONMODEL as LEARNREADORIENTATIONMODEL } from '../../../modules/nf-core/gatk4/learnreadorientationmodel/main'
include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES_TUMOR } from '../../../modules/nf-core/gatk4/getpileupsummaries/main'
Expand All @@ -18,16 +11,15 @@ include { GATK4_FILTERMUTECTCALLS as FILTERMUTECTCALLS } from '.

workflow BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK {
take:
ch_input // channel: [ val(meta), path(input), path(input_index), val(which_norm) ]
ch_fasta // channel: [ path(fasta) ]
ch_fai // channel: [ path(fai) ]
ch_dict // channel: [ path(dict) ]
ch_germline_resource // channel: [ path(germline_resource) ]
ch_germline_resource_tbi // channel: [ path(germline_resource_tbi) ]
ch_panel_of_normals // channel: [ path(panel_of_normals) ]
ch_panel_of_normals_tbi // channel: [ path(panel_of_normals_tbi) ]
ch_interval_file // channel: [ path(interval_file) ]

ch_input // channel: [ val(meta), path(input), path(input_index), val(which_norm) ]
ch_fasta // channel: /path/to/reference/fasta
ch_fai // channel: /path/to/reference/fasta/index
ch_dict // channel: /path/to/reference/fasta/dictionary
ch_germline_resource // channel: /path/to/germline/resource
ch_germline_resource_tbi // channel: /path/to/germline/index
ch_panel_of_normals // channel: /path/to/panel/of/normals
ch_panel_of_normals_tbi // channel: /path/to/panel/of/normals/index
ch_interval_file // channel: /path/to/interval/file

main:
ch_versions = Channel.empty()
Expand All @@ -45,62 +37,68 @@ workflow BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK {
ch_panel_of_normals,
ch_panel_of_normals_tbi
)

ch_versions = ch_versions.mix(MUTECT2.out.versions)

//
// Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2.
//
ch_learnread_in = MUTECT2.out.f1r2.collect()
LEARNREADORIENTATIONMODEL (ch_learnread_in)
ch_versions = ch_versions.mix(LEARNREADORIENTATIONMODEL.out.versions.firs())
LEARNREADORIENTATIONMODEL (MUTECT2.out.f1r2.collect())
ch_versions = ch_versions.mix(LEARNREADORIENTATIONMODEL.out.versions)

//
// Generate pileup summary tables using getepileupsummaries. tumor sample should always be passed in as the first input and input list entries of ch_mutect2_in,
// to ensure correct file order for calculatecontamination.
//
ch_pileup_tumor_input = ch_input.map {
meta, input_file, input_index, which_norm ->
[meta, input_file[0], input_index[0]]
ch_pileup_tumor_input = ch_input.combine(ch_interval_file).map {
meta, input_file, input_index, which_norm, intervals ->
[meta, input_file[0], input_index[0], intervals]
}

ch_pileup_normal_input = ch_input.map {
meta, input_file, input_index, which_norm ->
[meta, input_file[1], input_index[1]]
ch_pileup_normal_input = ch_input.combine(ch_interval_file).map {
meta, input_file, input_index, which_norm, intervals ->
[meta, input_file[1], input_index[1], intervals]
}

GETPILEUPSUMMARIES_TUMOR (
ch_pileup_tumor_input,
ch_fasta,
ch_fai,
ch_dict,
ch_germline_resource,
ch_germline_resource_tbi,
ch_interval_file
ch_germline_resource_tbi
)

GETPILEUPSUMMARIES_NORMAL (
ch_pileup_normal_input,
ch_fasta,
ch_fai,
ch_dict,
ch_germline_resource,
ch_germline_resource_tbi,
ch_interval_file
ch_germline_resource_tbi
)

ch_versions = ch_versions.mix(GETPILEUPSUMMARIES_TUMOR.out.versions.first())
ch_versions = ch_versions.mix(GETPILEUPSUMMARIES_NORMAL.out.versions.first())

//
// Contamination and segmentation tables created using calculatecontamination on the pileup summary table.
//
ch_pileup_tumor = GETPILEUPSUMMARIES_TUMOR.out.table.collect()
ch_pileup_normal = GETPILEUPSUMMARIES_NORMAL.out.table.collect()
ch_calccon_in = ch_pileup_tumor.join(ch_pileup_normal, failOnDuplicate: true, failOnMismatch: true)
CALCULATECONTAMINATION ( ch_calccon_in, true )
ch_pileup_tumor = GETPILEUPSUMMARIES_TUMOR.out.table.collect()
ch_pileup_normal = GETPILEUPSUMMARIES_NORMAL.out.table.collect()
ch_calccon_in = ch_pileup_tumor.join(ch_pileup_normal, failOnDuplicate: true, failOnMismatch: true)
CALCULATECONTAMINATION ( ch_calccon_in )
ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions)

//
// Mutect2 calls filtered by filtermutectcalls using the artifactpriors, contamination and segmentation tables.
//
ch_vcf = MUTECT2.out.vcf.collect()
ch_tbi = MUTECT2.out.tbi.collect()
ch_stats = MUTECT2.out.stats.collect()
ch_orientation = LEARNREADORIENTATIONMODEL.out.artifactprior.collect()
ch_segment = CALCULATECONTAMINATION.out.segmentation.collect()
ch_contamination = CALCULATECONTAMINATION.out.contamination.collect()
ch_vcf = MUTECT2.out.vcf.collect()
ch_tbi = MUTECT2.out.tbi.collect()
ch_stats = MUTECT2.out.stats.collect()
ch_orientation = LEARNREADORIENTATIONMODEL.out.artifactprior.collect()
ch_segment = CALCULATECONTAMINATION.out.segmentation.collect()
ch_contamination = CALCULATECONTAMINATION.out.contamination.collect()

//[] is used as a placeholder for optional input to specify the contamination estimate as a value, since the contamination table is used, this is not needed.
ch_contamination.add([])
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Run GATK mutect2 in tumor only mode, getepileupsummaries, calculatecontamination and filtermutectcalls
//

include { GATK4_MUTECT2 as MUTECT2 } from '../../../modules/nf-core/gatk4/mutect2/main'
include { GATK4_GETPILEUPSUMMARIES as GETPILEUPSUMMARIES } from '../../../modules/nf-core/gatk4/getpileupsummaries/main'
include { GATK4_CALCULATECONTAMINATION as CALCULATECONTAMINATION } from '../../../modules/nf-core/gatk4/calculatecontamination/main'
include { GATK4_FILTERMUTECTCALLS as FILTERMUTECTCALLS } from '../../../modules/nf-core/gatk4/filtermutectcalls/main'

workflow BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK {
take:
ch_input // channel: [ val(meta), [ input ], [ input_index ], [] ]
ch_fasta // channel: /path/to/reference/fasta
ch_fai // channel: /path/to/reference/fasta/index
ch_dict // channel: /path/to/reference/fasta/dictionary
ch_germline_resource // channel: /path/to/germline/resource
ch_germline_resource_tbi // channel: /path/to/germline/index
ch_panel_of_normals // channel: /path/to/panel/of/normals
ch_panel_of_normals_tbi // channel: /path/to/panel/of/normals/index
ch_interval_file // channel: /path/to/interval/file

main:
ch_versions = Channel.empty()

//
//Perform variant calling using mutect2 module in tumor single mode.
//
MUTECT2 (
ch_input,
ch_fasta,
ch_fai,
ch_dict,
ch_germline_resource,
ch_germline_resource_tbi,
ch_panel_of_normals,
ch_panel_of_normals_tbi
)

ch_versions = ch_versions.mix(MUTECT2.out.versions)

//
//Generate pileup summary table using getpileupsummaries.
//

ch_pileup_input = ch_input.combine(ch_interval_file).map {
meta, input_file, input_index, which_norm, intervals ->
[meta, input_file, input_index, intervals]
}

GETPILEUPSUMMARIES (
ch_pileup_input,
ch_fasta,
ch_fai,
ch_dict,
ch_germline_resource,
ch_germline_resource_tbi
)

ch_versions = ch_versions.mix(GETPILEUPSUMMARIES.out.versions)

//
//Contamination and segmentation tables created using calculatecontamination on the pileup summary table.
//
ch_pileup = GETPILEUPSUMMARIES.out.table.collect()

//[] is a placeholder for the optional input where the matched normal sample would be passed in for tumor-normal samples, which is not necessary for this workflow.
ch_pileup.add([])

CALCULATECONTAMINATION ( ch_pileup )

ch_versions = ch_versions.mix(CALCULATECONTAMINATION.out.versions)

//
//Mutect2 calls filtered by filtermutectcalls using the contamination and segmentation tables.
//

ch_vcf = MUTECT2.out.vcf.collect()
ch_tbi = MUTECT2.out.tbi.collect()
ch_stats = MUTECT2.out.stats.collect()

ch_segment = CALCULATECONTAMINATION.out.segmentation.collect()
ch_contamination = CALCULATECONTAMINATION.out.contamination.collect()

ch_filtermutect_in = ch_vcf
.combine(ch_tbi, by: 0)
.combine(ch_stats, by: 0)
.combine(ch_segment, by: 0)
.combine(ch_contamination, by: 0)
// Adding [] as a placeholder for the optional input file artifact priors, which is only used for tumor-normal samples and therefor isn't needed in this workflow.
// and [] as a placeholder for entering a contamination estimate value, which is not needed as this workflow uses the contamination table instead.
.map{ meta, vcf, tbi, stats, segment, contamination -> [meta, vcf, tbi, stats, [], segment, contamination, [] ] }

ch_filtermutect_in.view()

FILTERMUTECTCALLS ( ch_filtermutect_in, ch_fasta, ch_fai, ch_dict )
ch_versions = ch_versions.mix(FILTERMUTECTCALLS.out.versions)

emit:
mutect2_vcf = MUTECT2.out.vcf.collect() // channel: [ val(meta), [ vcf ] ]
mutect2_index = MUTECT2.out.tbi.collect() // channel: [ val(meta), [ tbi ] ]
mutect2_stats = MUTECT2.out.stats.collect() // channel: [ val(meta), [ stats ] ]

pileup_table = GETPILEUPSUMMARIES.out.table.collect() // channel: [ val(meta), [ table ] ]

contamination_table = CALCULATECONTAMINATION.out.contamination.collect() // channel: [ val(meta), [ contamination ] ]
segmentation_table = CALCULATECONTAMINATION.out.segmentation.collect() // channel: [ val(meta), [ segmentation ] ]

filtered_vcf = FILTERMUTECTCALLS.out.vcf.collect() // channel: [ val(meta), [ vcf ] ]
filtered_index = FILTERMUTECTCALLS.out.tbi.collect() // channel: [ val(meta), [ tbi ] ]
filtered_stats = FILTERMUTECTCALLS.out.stats.collect() // channel: [ val(meta), [ stats ] ]

versions = ch_versions // channel: [ versions.yml ]
}

This file was deleted.

This file was deleted.

12 changes: 4 additions & 8 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3360,6 +3360,10 @@ subworkflows/bam_tumor_normal_somatic_variant_calling_gatk:
- subworkflows/nf-core/bam_tumor_normal_somatic_variant_calling_gatk/**
- tests/subworkflows/nf-core/bam_tumor_normal_somatic_variant_calling_gatk/**

subworkflows/bam_tumor_only_somatic_variant_calling_gatk:
- subworkflows/nf-core/bam_tumor_only_somatic_variant_calling_gatk/**
- tests/subworkflows/nf-core/bam_tumor_only_somatic_variant_calling_gatk/**

subworkflows/bam_variant_calling_sort_freebayes_bcftools:
- subworkflows/nf-core/bam_variant_calling_sort_freebayes_bcftools/**
- tests/subworkflows/nf-core/bam_variant_calling_sort_freebayes_bcftools/**
Expand Down Expand Up @@ -3452,14 +3456,6 @@ subworkflows/gatk_create_som_pon:
- subworkflows/nf-core/gatk_create_som_pon/**
- tests/subworkflows/nf-core/gatk_create_som_pon/**

subworkflows/gatk_tumor_normal_somatic_variant_calling:
- subworkflows/nf-core/gatk_tumor_normal_somatic_variant_calling/**
- tests/subworkflows/nf-core/gatk_tumor_normal_somatic_variant_calling/**

subworkflows/gatk_tumor_only_somatic_variant_calling:
- subworkflows/nf-core/gatk_tumor_only_somatic_variant_calling/**
- tests/subworkflows/nf-core/gatk_tumor_only_somatic_variant_calling/**

subworkflows/homer/groseq:
- subworkflows/nf-core/homer/groseq/**
- tests/subworkflows/nf-core/homer/groseq/**
Expand Down
2 changes: 1 addition & 1 deletion tests/subworkflows/nf-core/bam_create_som_pon_gatk/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ nextflow.enable.dsl = 2

include { BAM_CREATE_SOM_PON_GATK } from '../../../../subworkflows/nf-core/bam_create_som_pon_gatk/main'

workflow bam_create_som_pon_gatk {
workflow test_bam_create_som_pon_gatk {
ch_mutect2_in = Channel.of(
[
[ id:'test1' ], // meta map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: bam_create_som_pon_gatk
command: nextflow run ./tests/subworkflows/nf-core/bam_create_som_pon_gatk -entry bam_create_som_pon_gatk -c tests/config/nextflow.config
command: nextflow run ./tests/subworkflows/nf-core/bam_create_som_pon_gatk -entry test_bam_create_som_pon_gatk -c tests/config/nextflow.config
tags:
- subworkflows
- subworkflows/bam_create_som_pon_gatk
Expand Down
Loading