Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running topologygsa: is.DAG(gr) throwing "Input must be a matrix or a dgCMatrix" #50

Open
ChangqingW opened this issue Mar 27, 2024 · 0 comments
Labels

Comments

@ChangqingW
Copy link

When running topologygsa with kegg hsa, I got the following error:

kegg.gs <- getGenesets(org = "hsa", db = "kegg")
hsa.grn <- compileGRN(org = "hsa", db = "kegg")
(I) r$> x <- nbea(method="topologygsa", se=se, gs=kegg.gs, grn=hsa.grn)
hsa00010_Glycolysis_/_Gluconeogenesis
hsa00020_Citrate_cycle_(TCA_cycle)
hsa00030_Pentose_phosphate_pathway
hsa00051_Fructose_and_mannose_metabolism
hsa00052_Galactose_metabolism
hsa00053_Ascorbate_and_aldarate_metabolism
hsa00061_Fatty_acid_biosynthesis
hsa00071_Fatty_acid_degradation
hsa00190_Oxidative_phosphorylation
hsa00230_Purine_metabolism
hsa00270_Cysteine_and_methionine_metabolism
hsa00280_Valine,_leucine_and_isoleucine_degradation
hsa00310_Lysine_degradation
hsa00330_Arginine_and_proline_metabolism
hsa00340_Histidine_metabolism
hsa00380_Tryptophan_metabolism
hsa00410_beta-Alanine_metabolism
hsa00480_Glutathione_metabolism
hsa00500_Starch_and_sucrose_metabolism
hsa00520_Amino_sugar_and_nucleotide_sugar_metabolism
hsa00561_Glycerolipid_metabolism
hsa00562_Inositol_phosphate_metabolism
Error in .check.is.matrix(object) : Input must be a matrix or a dgCMatrix
(I) r$> traceback()
10: stop("Input must be a matrix or a dgCMatrix\n")
9: .check.is.matrix(object)
8: is_dag.default(gr)
7: is.DAG(gr)
6: FUN(X[[i]], ...)
5: lapply(X = X, FUN = FUN, ...)
4: sapply(names(gs), function(s) {
       message(s)
       gs.grn <- .queryGRN(gs[[s]], grn, index = FALSE)
       if (nrow(gs.grn) < configEBrowser("GS.MIN.SIZE"))
           return(NA)
       am <- .grn2adjm(gs.grn)
       gr <- graphAM(am, "directed")
       gr <- as(gr, "graphNEL")
       if (!is.DAG(gr)) {
           gr2 <- graph_from_graphnel(gr)
           gr2 <- mst(gr2)
           gr <- as(gr2, "graphNEL")
       }
       r <- try(pathQ(assay(se), grp, gr, perm, alpha), silent = TRUE)
       if (is(r, "try-error"))
           return(NA)
       else return(r$alphaMean)
   })
3: .clipper(se, gs, grn, alpha, perm)
2: .topogsa(se, gs, grn, alpha, perm, ...)
1: nbea(method = "topologygsa", se = se, gs = kegg.gs, grn = hsa.grn)

It seems to be caused by the is_DAG call in .clipper, the object passed to it is a graphNEL object instead of a matrix, causing .check.is.matrix to throw the error.

(I) Browse[2]> object
A graphNEL graph with directed edges
Number of Nodes = 5
Number of Edges = 6
(I) Browse[2]> class(object)
[1] "graphNEL"
attr(,"package")
[1] "graph"
(I) r$> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /stornext/System/data/tools/openBLAS/openBLAS-0.3.23-gcc-11.3.0/lib/libopenblas_haswellp-r0.3.23.so;  LAPACK version 3.11.0

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8     LC_MONETARY=en_AU.UTF-8
 [6] LC_MESSAGES=en_AU.UTF-8    LC_PAPER=en_AU.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C

time zone: Australia/Melbourne
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] igraph_1.6.0                gRbase_2.0.1                clipper_1.42.0              Matrix_1.6-5
 [5] targets_1.4.1               EnrichmentBrowser_2.32.0    graph_1.80.0                SummarizedExperiment_1.32.0
 [9] Biobase_2.62.0              GenomicRanges_1.54.1        GenomeInfoDb_1.38.6         IRanges_2.36.0
[13] S4Vectors_0.40.2            BiocGenerics_0.48.1         MatrixGenerics_1.14.0       matrixStats_1.2.0

loaded via a namespace (and not attached):
 [1] DBI_1.2.2                bitops_1.0-7             GSEABase_1.64.0          biomaRt_2.58.2           rlang_1.1.3
 [6] magrittr_2.0.3           compiler_4.3.1           RSQLite_2.3.5            GenomicFeatures_1.54.3   png_0.1-8
[11] callr_3.7.5              vctrs_0.6.5              stringr_1.5.1            pkgconfig_2.0.3          crayon_1.5.2
[16] fastmap_1.1.1            backports_1.4.1          dbplyr_2.4.0             XVector_0.42.0           utf8_1.2.4
[21] Rsamtools_2.18.0         ps_1.7.6                 qpgraph_2.36.0           KEGGgraph_1.62.0         bit_4.0.5
[26] xfun_0.42                zlibbioc_1.48.0          cachem_1.0.8             progress_1.2.3           blob_1.2.4
[31] DelayedArray_0.28.0      BiocParallel_1.36.0      parallel_4.3.1           prettyunits_1.2.0        R6_2.5.1
[36] qtl_1.66                 stringi_1.8.3            qs_0.25.7                rtracklayer_1.62.0       Rcpp_1.0.12
[41] knitr_1.45               tidyselect_1.2.0         abind_1.4-5              yaml_2.3.8               stringfish_0.16.0
[46] codetools_0.2-19         curl_5.2.0               processx_3.8.3           lattice_0.22-5           tibble_3.2.1
[51] withr_3.0.0              KEGGREST_1.42.0          RcppParallel_5.1.7       BiocFileCache_2.10.1     xml2_1.3.6
[56] Biostrings_2.70.2        pillar_1.9.0             filelock_1.0.3           generics_0.1.3           RCurl_1.98-1.14
[61] hms_1.1.3                RApiSerialize_0.1.2      xtable_1.8-4             base64url_1.4            glue_1.7.0
[66] tools_4.3.1              BiocIO_1.12.0            data.table_1.15.0        GenomicAlignments_1.38.2 annotate_1.80.0
[71] mvtnorm_1.2-4            XML_3.99-0.16.1          grid_4.3.1               AnnotationDbi_1.64.1     GenomeInfoDbData_1.2.11
[76] restfulr_0.0.15          cli_3.6.2                rappdirs_0.3.3           fansi_1.0.6              S4Arrays_1.2.0
[81] dplyr_1.1.4              corpcor_1.6.10           Rgraphviz_2.46.0         digest_0.6.34            SparseArray_1.2.4
[86] rjson_0.2.21             memoise_2.0.1            lifecycle_1.0.4          httr_1.4.7               bit64_4.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants