Fix single-sample crash in plotSubclonePie (Columns 2 and 3 must be named) (#53)#55
Merged
jiaying2508 merged 1 commit intoJul 8, 2026
Conversation
…named") In a single-sample (S=1) run, runPictograph reorders subclone_props with matrix subsetting: subclone_props <- subclone_props[order(as.numeric(rownames(subclone_props))), ] For a K x 1 matrix this drops the dimension (default drop=TRUE) and collapses it to a length-K vector. plotSubclonePie() then takes the is.null(dim(...)) branch and as_tibble_row() yields a 1-row K-column tibble, but sample_names has length 1, so the columns come out unnamed and as_tibble() aborts with "Columns 2 and 3 must be named". Because the error propagates out of runPictograph(), inference has already succeeded and the core CSVs are written, but downstream steps (e.g. runDeconvolution) are skipped. Multi-sample runs are unaffected. Two-part fix: - Preserve the matrix dimension at the source with drop = FALSE at both reorder sites in runPictograph (single-tree and per-tree paths). - Add a defensive guard at the top of plotSubclonePie that restores a dropped dimension, so the function is robust to a vector argument from any caller. Validated on single-sample PDO runs that previously aborted at the pie chart. Fixes KarchinLab#53
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.
Closes #53.
Problem
A single-sample (S=1)
runPictograph()completes JAGS sampling and writes all core outputs (tree.csv,mcf.csv,mutationClusterAssign.csv,subclone_proportion.csv), then aborts drawing the pie chart:Because the error propagates out of
runPictograph(), inference has already succeeded but downstream steps (e.g.runDeconvolution) are skipped. Multi-sample runs are unaffected.Root cause
In
runPictograph,subclone_propsis reordered with matrix subsetting:For a K×1 matrix this drops the dimension (default
drop=TRUE) and collapses it to a length-K vector.plotSubclonePie()then takes theis.null(dim(...))branch andas_tibble_row()produces a 1-row K-column tibble, butsample_nameshas length 1, so the columns come out unnamed andas_tibble()errors.Fix
drop = FALSEat both reorder sites inrunPictograph(the single-tree and per-tree paths).plotSubclonePie()that restores a dropped dimension, so the function is robust to a vector argument from any caller.Validated on single-sample PDO runs that previously aborted at the pie chart.