egeulgen / pathfindR

pathfindR: Enrichment Analysis Utilizing Active Subnetworks
https://egeulgen.github.io/pathfindR/
Other
178 stars 25 forks source link

issue in input_testing #144

Closed dnarna909 closed 1 year ago

dnarna909 commented 1 year ago
  1. input_testing <- function (input, p_val_threshold = 0.05)
  2. {
  3. if (!is.data.frame(input)) { stop("the input is not a data frame") }
  4. if (ncol(input) != 2 & ncol(input) != 3) { stop("the input should have 2 or 3 columns") }
  5. if (nrow(input) < 2) { stop("There must be at least 2 rows (genes) in the input data frame") }
  6. if (!is.numeric(p_val_threshold)) {stop("p_val_threshold must be a numeric value between 0 and 1") }
  7. if (p_val_threshold > 1 | p_val_threshold < 0) { stop("p_val_threshold must be between 0 and 1") }
  8. p_column <- ifelse(ncol(input) == 3, 3, 2)
  9. if (any(is.na(input[, p_column]))) { stop("p values cannot contain NA values") }
  10. if (!all(is.numeric(input[, p_column]))) { stop("p values must all be numeric") }
  11. if (!all(is.numeric(input[[p_column]]))) { stop("p values must all be numeric") }
  12. if (any(input[, p_column] > 1 | input[, p_column] < 0)) { stop("p values must all be between 0 and 1") }
  13. message("The input looks OK")
  14. }

Line 11 should be updated as Line 12 for input_testing function in this package. Otherwise error message.

egeulgen commented 1 year ago

I'm assuming you are using a tibble as input, hence the issue. Please use input <- as.data.frame(input) before running pathfindR as this is not the only line that may cause an issue. Meanwhile, I may try to fix all tibble-related issues and keep you updated here