I am trying a new library and I found a strange behaviour. I have a method of an object of a derived class of type envRefClass which stop my process even inside a tryCatch function with an error handler.
library(STRINGdb)
# Creating the object
string_db <- STRINGdb$new(version = "10", species = 9606,
score_threshold = 0, input_directory = "" )
# Converting ids
string_id <- string_db$map(data.frame(gene = moduleGenes), "gene",
takeFirst = FALSE)
# Ploting with plot_ppi
tryCatch({
tryCatch({string_db$plot_ppi_enrichment(string_id$STRING_id,
title = paste("Interaction enrichment of", moduleName))},
error = function(e) {
message("Couldn't map the enrichment of STRING")
# sessionInfo()
# message(e)
})
}, error = function(e) {
message("Another error")
# message(e)
}
)
'select()' returned 1:1 mapping between keys and columns
Warning: we couldn't map to STRING 3% of your identifiersERROR: We do not support lists with more than 400 genes.
Please reduce the size of your input and rerun the analysis. Error in get_png(string_ids, payload_id = payload_id, required_score = required_score)
where string_id$STRING_id is a list of id of 358 elements. Whatever the error inside the plot_ppi_enrichment (which I already asked for) I did not expect to stop the process. I am using tryCatch correctly?
I have already read this question about how to use tryCatch, but it looks ok for me.