tryCatch中的函数仍然停止进程

时间:2016-10-06 08:40:01

标签: r try-catch bioconductor

我正在尝试一个新的库,我发现了一个奇怪的行为。我有一个类型为envRefClass的派生类的对象的方法,它甚至在带有错误处理程序的tryCatch函数内停止我的进程。

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) 

其中string_id $ STRING_id是358个元素的id列表。无论plot_ppi_enrichment(我已经要求)中的错误是什么,我都没想到会停止这个过程。我正确使用tryCatch?

我已经阅读了有关如何使用tryCatch的this question,但它对我来说还不错。

0 个答案:

没有答案