Skip to content

Handle empty mutation cohorts without failing#7

Draft
Copilot wants to merge 2 commits into
dev/mutabilitiesfrom
copilot/fix-error-on-no-genes
Draft

Handle empty mutation cohorts without failing#7
Copilot wants to merge 2 commits into
dev/mutabilitiesfrom
copilot/fix-error-on-no-genes

Conversation

Copy link
Copy Markdown

Copilot AI commented Jun 2, 2026

When no elements meet the mutation cutoff, the CLI aborts with a UserInputError. Desired behavior is to complete successfully and emit empty results.

  • Graceful early exit on empty cohorts: write empty elements/clusters outputs and return without raising.
  • Robust empty-result serialization: postprocessing now emits correctly ordered headers for empty element results.
if not element_mutations_cutoff:
    logger.warning('No element found with enough mutations to perform analysis. Writing empty results.')
    sorted_list_elements = postp.write_element_results(
        genome=genome,
        results=({}, {}),
        directory=output_directory,
        file=elements_output_file,
        is_gzip=gzip
    )
    postp.write_cluster_results(
        genome=genome,
        results=({}, {}),
        directory=output_directory,
        file=clusters_output_file,
        sorter=sorted_list_elements,
        is_gzip=gzip
    )
    return

Copilot AI linked an issue Jun 2, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix error when no genes with mutations Handle empty mutation cohorts without failing Jun 2, 2026
Copilot AI requested a review from FerriolCalvet June 2, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when no genes with mutations

2 participants