From 020bb8982d36a0a14aba0ee32459573db4060c43 Mon Sep 17 00:00:00 2001 From: shihabdider Date: Tue, 21 May 2024 11:46:42 -0400 Subject: [PATCH] feat: adds graceful exit when epgap does not converge When the time limit (tilim) is reached but the epgap has not reached its threshold, JaBbA would still spit out an output (which was usually garbage/uninterpretable). Now it gracefully exits with an error message, suggesting the user increase the tilim. --- R/JaBbA.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/JaBbA.R b/R/JaBbA.R index 3c5b9da..750ce67 100755 --- a/R/JaBbA.R +++ b/R/JaBbA.R @@ -646,6 +646,11 @@ JaBbA = function(## Two required inputs QCStats(inputDT=data.table(pair=name,inputdir=outdir),outdir=outdir) } setwd(cdir) + # exit with error if epgap did not converge + sol_epgap = jab$nodes$gr$epgap %>% unique + if (sol_epgap > opt$epgap) { + stop(paste("JaBbA did not converge. Try increasing the tilim. Final epgap:", sol_epgap)) + } return(jab) }