Repository navigation
MNV handling — predefined_dbs_mbs flag + zero-variant safety - #14
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for handling multi-base substitutions (MBS) alongside existing DBS/SNV/INDEL workflows and adjusts DBS handling to use predefined variant annotations. It also updates SNV plotting defaults and integrates MBS plotting and JSON export into the workflow.
- Add MBS counting, plotting, and JSON table export; integrate into sig_workflow_run
- Use predefined_dbs_mbs = TRUE when extracting DBS (and MBS) from VCF
- Update SNV rainfall default to FALSE and add logging for counting steps
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| man/sig_workflow_run.Rd | Documents workflow function; adds predefined_dbs_mbs argument description but not reflected in usage/signature. |
| man/sig_plot_snv.Rd | Updates function usage to include rainfall = FALSE and corrects default in docs. |
| man/sig_plot_mbs.Rd | Adds docs for new sig_plot_mbs; output description appears inconsistent with code (list vs single plot). |
| man/sig_mbs_table.Rd | Adds docs for new sig_mbs_table used for JSON export. |
| man/sig_count_mbs.Rd | Adds docs for new sig_count_mbs; argument list/docs inconsistent with function signature/behavior. |
| R/mutationalpatterns.R | Implements MBS count/plot/table; updates DBS counting to use predefined_dbs_mbs; integrates MBS into workflow and output; adds logging. |
| NAMESPACE | Exports new MBS-related functions. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ng, and small lint cleanup
Merged
sig_count_dbs: early-return all-zero matrix when no DBS variants found, avoiding colnames<- crash inside get_dbs_context/count_dbs_contexts. sig_contribution: skip fit_to_signatures on zero-sum input (degenerate for NNLS), reuse existing No Signatures found! path and column transform. Reproduces the SIGRAP_MUTPAT failure seen in sash 0.7.0 cohort runs where filtered PASS VCF has no DBS variants (e.g. APGI GARV_0658). Fixes sash#34.
Three changes in mutationalpatterns.R: sig_count_dbs: early return all-zero matrix before get_dbs_context / count_dbs_contexts are called, which crash with colnames<- error on empty input. Matrix uses correct 78-context layout from get_known_signatures. sig_plot_dbs: return blank 'No DBS variants found' plots when all counts are zero, so gpgr can always find plot/dbs/*.png via readPNG. sig_contribution: skip fit_to_signatures on zero-sum input (degenerate for NNLS), reuse existing No Signatures found path and column transform. Root cause: --predefined-dbs-mbs (added in sash 0.7.0) counts only explicitly annotated DBS variants. Samples with no DBS annotations (e.g. PDAC cohort GARV_0658) now correctly complete without crashing. Fixes sash#34.
- sig_plot_mbs: return placeholder ggplot when sum(mbs_counts) == 0 - sig_contribution: guard RelFreq division by zero (NaN -> 0) - sigrap::cosmic_signatures_2015 replaces fragile get() call - Replace em-dash characters with -- in comments - Move glue and tibble from Suggests to Imports (used unconditionally)
Covers sig_contribution (NaN guard), sig_plot_dbs, sig_plot_mbs (zero placeholder), sig_mbs_table (empty + counts + matrix input).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See sash issue #34
Changes
predefined_dbs_mbsflag--predefined-dbs-mbsCLI flag andpredefined_dbs_mbsparameter (defaultFALSE)TRUE, uses PAVE-annotated DBS directly instead of auto-merging adjacent SNVsZero-variant safety (DBS/MBS)
sig_count_dbs: early-return zero matrix when no DBS variants presentsig_contribution: skip NNLS fitting on zero inputsig_plot_dbs: return blank placeholder PNGs ("No DBS variants found") so downstreamreadPNGalways succeedsglue/tibbletoImportsTests
sig_mbs_tableFixes
cosmic_signatures_2015inside package (notsigrap::prefix)