Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling errors when fitting Cyclops model during positive control synthesis #7

Open
k-m-li opened this issue Oct 18, 2024 · 0 comments

Comments

@k-m-li
Copy link

k-m-li commented Oct 18, 2024

Sometimes fitCyclopsModel returns an error message, hence the tryCatch(fitCyclopsModel) returns a character vector on which the $ operator is invalid (cannot access fit$returnFlag)

We should check if fit is a character object first.

fit <- tryCatch(
{
Cyclops::fitCyclopsModel(cyclopsData, prior = prior, control = control)
},
error = function(e) {
e$message
}
)
if (fit$return_flag != "SUCCESS") {
fit <- fit$return_flag
}
if (is.character(fit)) {
ParallelLogger::logInfo(paste("Unable to fit model for outcome", task$outcomeId, ":", fit))
dir.create(task$modelFolder)
write.csv(fit, file.path(task$modelFolder, "Error.txt"))
} else {

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

No branches or pull requests

1 participant