Skip to content

Commit 25234dd

Browse files
bschilderclaude
andcommitted
Wrap motifbreakR::plotMB in tryCatch (fixes #15)
plotMB can crash with a grid viewport error (upstream Simon-Coetzee/motifBreakR#31). Now catches the error, warns the user with the upstream issue link, and returns NULL for that SNP instead of crashing the entire plot loop. [skip ci] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b00ff99 commit 25234dd

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

R/MOTIFBREAKR_plot.R

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,20 @@ MOTIFBREAKR_plot <- function(mb_res,
8989
width = width,
9090
height = height)
9191
}
92-
motifbreakR::plotMB(results = mb_res,
93-
rsid = rs,
94-
effect = effect)
92+
tryCatch({
93+
motifbreakR::plotMB(results = mb_res,
94+
rsid = rs,
95+
effect = effect)
96+
}, error = function(e){
97+
messager("WARNING: motifbreakR::plotMB failed for ",rs,
98+
": ",conditionMessage(e),
99+
"\nThis is a known upstream issue ",
100+
"(Simon-Coetzee/motifBreakR#31).",
101+
v=verbose)
102+
save_path <- NULL
103+
})
95104
if(!is.null(results_dir)){
96-
grDevices::dev.off();
105+
grDevices::dev.off();
97106
}
98107
return(save_path)
99108
})

0 commit comments

Comments
 (0)