Skip to content

enrichPathway doesn't run inside tryCatch #46

@rhart604

Description

@rhart604

I used a function to run enrichPathway so I can return null results and plot a blank panel when running multiple datasets.

If I use my function, messages on the screen seem to indicate that everything is running, but it runs very quickly and there are no results.

If I manually run enrichPathway() before running the function, it works correctly.

Here's my function:

get_path <- function(ez_list,pvalcut=0.15){
  #catch all errors by returning data frame with nrow = 0
  tryCatch(
    {
      result <- ReactomePA::enrichPathway(ez_list, pvalueCutoff = pvalcut,readable = T)
      if(is.null(result)){
        return(data.frame())
      } else {
        return(result)
      }
    },
    error = function(e) {
      result <- data.frame()
      return(result)
    },
    warning = function(w) {
      result <- data.frame()
      return(result)
    }
  )
}

Any idea what I'm doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions