diff --git a/DESCRIPTION b/DESCRIPTION index 0e5846b..213e47d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: DOSE Type: Package Title: Disease Ontology Semantic and Enrichment analysis -Version: 3.25.0.001 +Version: 3.25.0.002 Authors@R: c( person(given = "Guangchuang", family = "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre")), person(given = "Li-Gen", family = "Wang", email = "reeganwang020@gmail.com", role = "ctb"), person(given = "Vladislav", family = "Petyuk", email = "petyuk@gmail.com", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 6ee20b9..040b9c9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ -# DOSE 3.25.0.001 +# DOSE 3.25.0.002 ++ use `inherits` to judge the class of objects (2022-11-20, Sun) + test whether slot in `GSON` object is NULL (e.g., `GSON@keytype`) when assigning it to enrichment result (2022-11-07, Mon) # DOSE 3.24.0 diff --git a/R/build_Anno.R b/R/build_Anno.R index c7e0b85..090004f 100644 --- a/R/build_Anno.R +++ b/R/build_Anno.R @@ -6,7 +6,8 @@ build_Anno <- function(path2gene, path2name) { } Anno_clusterProfiler_Env <- get(".Anno_clusterProfiler_Env", envir= .GlobalEnv) - if(class(path2gene[[2]]) == 'list') { + # if(class(path2gene[[2]]) == 'list') { + if (inherits(path2gene[[2]], "list")){ ## to compatible with tibble path2gene <- cbind(rep(path2gene[[1]], times = vapply(path2gene[[2]], length, numeric(1))), diff --git a/R/enricher_internal.R b/R/enricher_internal.R index a312074..9c2e6b1 100644 --- a/R/enricher_internal.R +++ b/R/enricher_internal.R @@ -129,7 +129,8 @@ enricher_internal <- function(gene, p.adj <- p.adjust(Over$pvalue, method=pAdjustMethod) qobj <- tryCatch(qvalue(p=Over$pvalue, lambda=0.05, pi0.method="bootstrap"), error=function(e) NULL) - if (class(qobj) == "qvalue") { + # if (class(qobj) == "qvalue") { + if (inherits(qobj, "qvalue")) { qvalues <- qobj$qvalues } else { qvalues <- NA diff --git a/R/utilities.R b/R/utilities.R index 9a82d96..e2b165f 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -43,7 +43,8 @@ calculate_qvalue <- function(pvals) { qobj <- tryCatch(qvalue(pvals, lambda=0.05, pi0.method="bootstrap"), error=function(e) NULL) - if (class(qobj) == "qvalue") { + # if (class(qobj) == "qvalue") { + if (inherits(qobj, "qvalue")) { qvalues <- qobj$qvalues } else { qvalues <- NA @@ -78,8 +79,9 @@ calculate_qvalue <- function(pvals) { return(numeric(0)) qobj <- tryCatch(qvalue(pvals, lambda=0.05, pi0.method="bootstrap"), error=function(e) NULL) - - if (class(qobj) == "qvalue") { + + # if (class(qobj) == "qvalue") { + if (inherits(qobj, "qvalue")) { qvalues <- qobj$qvalues } else { qvalues <- NA