Skip to content

Merge BAM_SOMATIC_VARIANT_CALLING_GATK subworkflows - #13335

Open
beatrizsavinhas wants to merge 34 commits into
masterfrom
merge-bam-somatic-variant-calling-gatk
Open

beatrizsavinhas wants to merge 34 commits into
masterfrom
merge-bam-somatic-variant-calling-gatk

Conversation

@beatrizsavinhas

@beatrizsavinhas beatrizsavinhas commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

PR checklist

Create BAM_SOMATIC_VARIANT_CALLING_GATK subworkflow merging the logic for BAM_TUMOR_NORMAL_SOMATIC_VARIANT_CALLING_GATK and BAM_TUMOR_ONLY_SOMATIC_VARIANT_CALLING_GATK. A single subworkflow capable of performing both analysis types reduces code duplication in pipelines that can run both tumor only and tumor-normal analyses.

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR.
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity
      • nf-core modules test <MODULE> --profile conda
    • For subworkflows:
      • nf-core subworkflows test <SUBWORKFLOW> --profile docker
      • nf-core subworkflows test <SUBWORKFLOW> --profile singularity
      • nf-core subworkflows test <SUBWORKFLOW> --profile conda

@beatrizsavinhas beatrizsavinhas self-assigned this Oct 19, 2026
@github-actions

Copy link
Copy Markdown

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@github-actions github-actions Bot removed the size/l label Oct 21, 2026
@beatrizsavinhas
beatrizsavinhas marked this pull request as ready for review October 21, 2026 11:23
.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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code, the interval file was not used here, but looking at the GATK4_MUTECT2 it is possible to provide it too. This is why the md5sums of the output files also differ from the original test snapshot.
Please, let me know if adding the interval file is not relevant here for some reason I overlooked!

Comment thread subworkflows/nf-core/bam_somatic_variant_calling_gatk/main.nf Outdated
Comment thread subworkflows/nf-core/bam_somatic_variant_calling_gatk/main.nf Outdated
Comment thread subworkflows/nf-core/bam_somatic_variant_calling_gatk/main.nf Outdated
.combine(ch_interval_file)

// Ensure that the panel of normals is not used for tumor-normal analysis, even if provided
ch_panel_of_normals = []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better handled at the module level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you suggest updating the module code instead? Currently there is no logic to cover this in the GATK4_MUTECT2 module.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that would be a much better approach if possible. Updating the module logic makes the workflow cleaner and easier to maintain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fair! I will address that issue in a separate PR then!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked into the module and this is not straightforward as there is no logic to determine if a matched normal sample is provided based on the inputs -

tuple val(meta), path(input), path(input_index), path(intervals)
.
The functionality above has now been removed from this PR so it is up to the user to provide the correct inputs (clear instructions were added to the meta.yml file). Since this was already the case before this PR, and substantial changes to the module would be required to add the check there, perhaps we can settle for leaving the proper usage of the subworkflow/module up to the user.

Comment thread subworkflows/nf-core/bam_somatic_variant_calling_gatk/main.nf Outdated
@beatrizsavinhas

Copy link
Copy Markdown
Contributor Author

I have now implemented a different approach restoring the joint input channel and addressing #13335 (comment) which also removes the dependency on val_tumor_normal_analysis and code duplication mentioned in #13335 (comment).

Could you take another look at the code @imsarath?

ch_getpileupsummaries_in = ch_input
.flatMap { meta, tumor_input, tumor_input_index, normal_input, normal_input_index ->
def result = [
[[id: "${meta.id}_tumor", original_meta: meta], // Add unique key so output files receive differing names

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic and revert in line 92 could be bypassed by setting ext.prefix for GATK4_GETPILEUPSUMMARIES as was done previously, but the would mean that the subworkflow would not work at all without that configuration. I thought adding the logic to the subworkflow itself would be more explicit and provide a better user experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants