Repository navigation
Merge BAM_SOMATIC_VARIANT_CALLING_GATK subworkflows #13335
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
Open
beatrizsavinhas
wants to merge
69
commits into
master
Choose a base branch
from
merge-bam-somatic-variant-calling-gatk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 21 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
826fcda
Remove BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK.
beatrizsavinhas 9fc036e
Merge logic until GATK4_GETPILEUPSUMMARIES.
beatrizsavinhas a1ec7a3
refactor using val_tumor_normal_analysis
beatrizsavinhas 16e173f
Fix channel manipulation and ensure case_id meta.
beatrizsavinhas 4eb6294
Add val_case_id.
beatrizsavinhas 844e870
Add val_case_id.
beatrizsavinhas c0c19df
Re-add pileup output to test snapshot.
beatrizsavinhas ac3c66d
Restore config to ensure generation of f1r2 file.
beatrizsavinhas 77b171e
Code formatting.
beatrizsavinhas d105449
Adjustments for tumor only mode.
beatrizsavinhas 0c30792
Remove val_case_id.
beatrizsavinhas b2a414c
Fix code comments.
beatrizsavinhas f46df8b
Activate all tests and update snapshot.
beatrizsavinhas d1f9ba8
Remove logic for pileup_table_normal from emit block.
beatrizsavinhas f3ecfe3
Remove code duplication in output channels.
beatrizsavinhas 63f5038
Update code comment.
beatrizsavinhas 6b611f8
Update meta.
beatrizsavinhas 97d7543
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas c370a53
Rename folder.
beatrizsavinhas 2efdf20
Fix linting issue in meta.
beatrizsavinhas ea4e199
Run prek.
beatrizsavinhas d61ce99
Add pon to TO test.
beatrizsavinhas feb020a
Remove case_id from test meta.
beatrizsavinhas b982828
Create params.ext_args_gatk4_mutect2
beatrizsavinhas 035822a
Add params.ext_args_gatk4_mutect2 for TO test. Fix bug with ext_args_…
beatrizsavinhas ddd5c28
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas 5dfaa76
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas f6f34ee
Update title comment.
beatrizsavinhas 8000f49
Use joint input and remove val_tumor_normal_analysis.
beatrizsavinhas ac55eb7
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas b12965f
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas 0838c54
Fix snapshot of pileup_table for TN test.
beatrizsavinhas b6e7ae7
Update meta.
beatrizsavinhas 3fac4e1
Correct inputs for tumor only tests.
beatrizsavinhas a7148d0
Update TN test snapshot based on CI results.
beatrizsavinhas 8b4d48a
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas ae1894d
Update TN test snapshot based on CI results.
beatrizsavinhas 820a640
Remove negation in if logic.
beatrizsavinhas 2de169d
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas c8a9b23
Apply suggestion from @imsarath
beatrizsavinhas 2241298
Apply suggestion from @imsarath
beatrizsavinhas c1df60c
Restore config.
beatrizsavinhas e9d93b9
Add `sanitizeOutput` to stub tests.
beatrizsavinhas 5085785
Deprecate BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK.
beatrizsavinhas c8784a9
Deprecate BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK.
beatrizsavinhas 5308216
Deprecate BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK.
beatrizsavinhas 7010b29
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas 3c66880
Remove assert workflow.success from deprecated subworkflow tests.
beatrizsavinhas 6cdf452
Fix deprecation_message for BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK.
beatrizsavinhas a4918ee
Add README for bam_tumor_only_somatic_variant_calling_gatk
beatrizsavinhas 1238a97
Add README for bam_tumor_normal_somatic_variant_calling_gatk
beatrizsavinhas 81a78e5
Restore BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK and fix deprecation.
beatrizsavinhas 5eadc6d
Restore BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK and fix depreca…
beatrizsavinhas a0e36ef
Restore meta.
beatrizsavinhas d331220
Restore files from bam_tumor_normal_somatic_variant_calling_gatk.
beatrizsavinhas d252106
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas ec90598
Update test config logic to support params.gatk4_mutect2_ext_args for…
beatrizsavinhas d2a47bb
Update snapshot after previous test config changes.
beatrizsavinhas f9af8d0
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas 266d3c4
Update Tumor normal snapshot based on CI results.
beatrizsavinhas 367c75c
Update Tumor normal snapshot based on CI results.
beatrizsavinhas 85203e9
Revert "Update Tumor normal snapshot based on CI results."
beatrizsavinhas c0f017c
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas fe67962
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas fe00c95
Update grouping logic to ensure correct order of tables in ch_calcula…
beatrizsavinhas 06aef0d
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas 302bbec
Improve meta manipulation code comment.
beatrizsavinhas 7aeb29f
Improve meta manipulation code comment.
beatrizsavinhas 3b6bff3
Merge branch 'master' into merge-bam-somatic-variant-calling-gatk
beatrizsavinhas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
163 changes: 163 additions & 0 deletions
163
subworkflows/nf-core/bam_somatic_variant_calling_gatk/main.nf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| // Run GATK4_MUTECT2 in tumor normal mode, getepileupsummaries, calculatecontamination, learnreadorientationmodel and filtermutectcalls | ||
|
|
||
| include { GATK4_CALCULATECONTAMINATION } from '../../../modules/nf-core/gatk4/calculatecontamination' | ||
| include { GATK4_FILTERMUTECTCALLS } from '../../../modules/nf-core/gatk4/filtermutectcalls' | ||
| include { GATK4_GETPILEUPSUMMARIES as GATK4_GETPILEUPSUMMARIES_NORMAL } from '../../../modules/nf-core/gatk4/getpileupsummaries' | ||
| include { GATK4_GETPILEUPSUMMARIES as GATK4_GETPILEUPSUMMARIES_TUMOR } from '../../../modules/nf-core/gatk4/getpileupsummaries' | ||
| include { GATK4_LEARNREADORIENTATIONMODEL } from '../../../modules/nf-core/gatk4/learnreadorientationmodel' | ||
| include { GATK4_MUTECT2 } from '../../../modules/nf-core/gatk4/mutect2' | ||
|
|
||
| workflow BAM_SOMATIC_VARIANT_CALLING_GATK { | ||
| take: | ||
| ch_input_tumor // channel: [ val(meta), path(input), path(input_index)] | ||
| ch_input_normal // channel: [ val(meta), path(input), path(input_index)] | ||
| ch_fasta // channel: [ val(meta), path(fasta) ] | ||
| ch_fai // channel: [ val(meta), path(fai), path(gzi) ] | ||
| ch_dict // channel: [ val(meta), path(dict) ] | ||
| ch_alleles // channel: /path/to/alleles | ||
| ch_alleles_tbi // channel: /path/to/alleles/index | ||
| 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 | ||
| val_tumor_normal_analysis // boolean: if true, perform tumor-normal comparison, otherwise run tumor-only comparison with pon | ||
|
beatrizsavinhas marked this conversation as resolved.
Resolved
|
||
|
|
||
| main: | ||
|
|
||
| if (val_tumor_normal_analysis) { | ||
|
|
||
| ch_mutect2_in = ch_input_tumor | ||
| .combine(ch_input_normal) | ||
|
beatrizsavinhas marked this conversation as resolved.
Resolved
|
||
| .map { meta_tumor, bam_tumor, bai_tumor, meta_normal, bam_normal, bai_normal -> | ||
| [[id: "${meta_tumor.id}_${meta_normal.id}" ], [bam_tumor, bam_normal], [bai_tumor, bai_normal]] | ||
| } | ||
| .combine(ch_interval_file) | ||
|
beatrizsavinhas marked this conversation as resolved.
Resolved
|
||
|
|
||
| // Ensure that the panel of normals is not used for tumor-normal analysis, even if provided | ||
| ch_panel_of_normals = [] | ||
|
beatrizsavinhas marked this conversation as resolved.
Resolved
|
||
| ch_panel_of_normals_tbi = [] | ||
| } | ||
| else { | ||
| ch_mutect2_in = ch_input_tumor | ||
| .combine(ch_interval_file) | ||
| } | ||
|
|
||
| GATK4_MUTECT2( | ||
| ch_mutect2_in, | ||
| ch_fasta, | ||
| ch_fai, | ||
| ch_dict, | ||
| ch_alleles, | ||
| ch_alleles_tbi, | ||
| ch_germline_resource, | ||
| ch_germline_resource_tbi, | ||
| ch_panel_of_normals, | ||
| ch_panel_of_normals_tbi, | ||
| ) | ||
|
|
||
| ch_mutect2_vcf = GATK4_MUTECT2.out.vcf | ||
| ch_mutect2_stats = GATK4_MUTECT2.out.stats | ||
| ch_mutect2_tbi = GATK4_MUTECT2.out.tbi | ||
| ch_mutect2_f1r2 = GATK4_MUTECT2.out.f1r2 | ||
|
|
||
| // Generate artifactpriors using learnreadorientationmodel on the f1r2 output of GATK4_MUTECT2 | ||
| GATK4_LEARNREADORIENTATIONMODEL(ch_mutect2_f1r2) | ||
|
|
||
|
|
||
| ch_artifact_priors = GATK4_LEARNREADORIENTATIONMODEL.out.artifactprior | ||
|
|
||
| // Generate pileup summary tables using getepileupsummaries | ||
| ch_getpileupsummaries_tumor_in = ch_input_tumor | ||
| .combine(ch_interval_file) | ||
|
|
||
| GATK4_GETPILEUPSUMMARIES_TUMOR( | ||
|
beatrizsavinhas marked this conversation as resolved.
Resolved
|
||
| ch_getpileupsummaries_tumor_in, | ||
| ch_fasta, | ||
| ch_fai.map { meta, fai, _gzi -> [meta, fai] }, | ||
| ch_dict, | ||
| ch_germline_resource, | ||
| ch_germline_resource_tbi, | ||
| ) | ||
|
|
||
| ch_pileup_table_tumor = GATK4_GETPILEUPSUMMARIES_TUMOR.out.table | ||
|
|
||
| if (val_tumor_normal_analysis) { | ||
|
|
||
| ch_getpileupsummaries_normal_in = ch_input_normal | ||
| .combine(ch_interval_file) | ||
|
|
||
| GATK4_GETPILEUPSUMMARIES_NORMAL( | ||
| ch_getpileupsummaries_normal_in, | ||
| ch_fasta, | ||
| ch_fai.map { meta, fai, _gzi -> [meta, fai] }, | ||
| ch_dict, | ||
| ch_germline_resource, | ||
| ch_germline_resource_tbi, | ||
| ) | ||
|
|
||
| ch_pileup_table_normal = GATK4_GETPILEUPSUMMARIES_NORMAL.out.table | ||
|
|
||
| // Ensure the correct order of the files in the input channel for GATK4_CALCULATECONTAMINATION | ||
| ch_calccon_in = ch_pileup_table_tumor | ||
| .combine(ch_pileup_table_normal) | ||
| .map { meta_tumor, table_tumor, meta_normal, table_normal -> | ||
| [[id: "${meta_tumor.id}_${meta_normal.id}"], table_tumor, table_normal] | ||
| } | ||
|
Comment on lines
+95
to
+113
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this logic could be improved and simplified! Any suggestions? |
||
| } | ||
| else { | ||
| ch_pileup_table_normal = channel.empty() | ||
|
|
||
| ch_calccon_in = ch_pileup_table_tumor | ||
| .map { meta_tumor, table_tumor -> | ||
| [meta_tumor, table_tumor, []] | ||
| } | ||
| } | ||
|
|
||
| // Contamination and segmentation tables created using calculatecontamination on the pileup summary table | ||
| GATK4_CALCULATECONTAMINATION(ch_calccon_in) | ||
|
|
||
| ch_contamination_table = GATK4_CALCULATECONTAMINATION.out.contamination | ||
| ch_segmentation_table = GATK4_CALCULATECONTAMINATION.out.segmentation | ||
|
|
||
| // GATK4_MUTECT2 calls filtered by filtermutectcalls using the artifactpriors, contamination and segmentation tables | ||
| ch_filtermutect_in = ch_mutect2_vcf | ||
| .join(ch_mutect2_tbi, failOnDuplicate: true, failOnMismatch: true) | ||
| .join(ch_mutect2_stats, failOnDuplicate: true, failOnMismatch: true) | ||
| .join(ch_artifact_priors, failOnDuplicate: true, failOnMismatch: true) | ||
| .join(ch_segmentation_table, failOnDuplicate: true, failOnMismatch: true) | ||
| .join(ch_contamination_table, failOnDuplicate: true, failOnMismatch: true) | ||
| .map{ meta, vcf, tbi, stats, artifactprior, segmentation, contamination -> | ||
| [ | ||
| meta, | ||
| vcf, | ||
| tbi, | ||
| stats, | ||
| artifactprior, | ||
| segmentation, | ||
| contamination, | ||
| [], // Since the contamination table is provided, the value estimate is not relevant | ||
| ] | ||
| } | ||
|
|
||
| GATK4_FILTERMUTECTCALLS( | ||
| ch_filtermutect_in, | ||
| ch_fasta, | ||
| ch_fai.map { meta, fai, _gzi -> [meta, fai] }, | ||
| ch_dict, | ||
| ) | ||
|
|
||
| emit: | ||
| artifact_priors = ch_artifact_priors // channel: [ val(meta), path(artifactprior) ] | ||
| contamination_table = ch_contamination_table // channel: [ val(meta), path(table) ] | ||
| filtered_stats = GATK4_FILTERMUTECTCALLS.out.stats // channel: [ val(meta), path(stats) ] | ||
| filtered_tbi = GATK4_FILTERMUTECTCALLS.out.tbi // channel: [ val(meta), path(tbi) ] | ||
| filtered_vcf = GATK4_FILTERMUTECTCALLS.out.vcf // channel: [ val(meta), path(vcf) ] | ||
| mutect2_f1r2 = ch_mutect2_f1r2 // channel: [ val(meta), path(f1r2) ] | ||
| mutect2_stats = ch_mutect2_stats // channel: [ val(meta), path(stats) ] | ||
| mutect2_tbi = ch_mutect2_tbi // channel: [ val(meta), path(tbi) ] | ||
| mutect2_vcf = ch_mutect2_vcf // channel: [ val(meta), path(vcf) ] | ||
| pileup_table_normal = ch_pileup_table_normal // channel: [ val(meta), path(table) ] | ||
| pileup_table_tumor = ch_pileup_table_tumor // channel: [ val(meta), path(table) ] | ||
| segmentation_table = ch_segmentation_table // channel: [ val(meta), path(table) ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.