Good afternoon everyone,
I am new to both R and brainGraph, so I apologize if the answer to the error message is super obvious.
I am trying to extract subject-level graphs using the Brainnetome atlas. All of my scripts are being run on an HPC using SLURM.
Because this is a large dataset, I am only running one threshold per script (i.e. thresholds <- rev(seq(0.16, 0.16, 0.01))) in the call to make_brainGraphList (for both time and RAM constraints) and then merging the RDS outputs together after.
I am only getting this error for subject-level graphs (i.e. not getting it when generating the g.group graphs) and all of the subjects, files, etc. are identical that feed into the g and g.group calls (i.e. command on pg. 46 of the brainGraph_UserGuide for 3.0.0).
The error message that I am getting for every threshold for subject-level graphs is:
> g <- g.group <- vector('list', length(thresholds))
> for (j in seq_along(thresholds)) {
g[[j]] <- make_brainGraphList(A.norm.sub[[j]], atlas, modality=modality,
weighting='pearson', threshold=thresholds[j],
weighted=TRUE, gnames=covars$Study.ID)
}
[1] "Start time: 2023-03-24 14:48:59"
|======================================================================| 100%Error in { :
task 2 failed - "'x' must be an array of at least two dimensions"
> traceback()
5: stop(simpleError(msg, call = expr))
4: e$fun(obj, substitute(ex), parent.frame(), e$data)
3: foreach(i = seq_len(kNumGraphs)) %dopar% {
res <- loopfun(x[, , i], atlas, type, level, set.attrs, modality,
weighting, threshold[i], name = gnames[i], Group = grpNames[i],
subnet = subnet, mode = mode, diag = diag, weighted = weighted,
use.parallel = FALSE, ...)
}
2: make_brainGraphList.array(A.norm.sub[[j]], atlas, modality = modality,
weighting = "pearson", threshold = thresholds[j], weighted = TRUE,
gnames = covars$Study.ID)
1: make_brainGraphList(A.norm.sub[[j]], atlas, modality = modality,
weighting = "pearson", threshold = thresholds[j], weighted = TRUE,
gnames = covars$Study.ID)
> warnings()
>
Again, this error is not generated in the group graphs (which I ran in separate scripts), only when generating the subject-level graphs, so I am fairly confident that my matrices, covars, etc. were set up properly.
I also tried this with R version 3.6.3 (2020-02-29) just in case there were issues between R version 3 and R version 4, but it was the same error.
I also tried adding in the "grpNames=covars$Group" argument, but that also generated the same error (i.e. 'x' must be an array of at least two dimensions).
I should also mention that I ran it with the "set.attrs=FALSE" argument and it did run without generating any error, but then once I got to the the next series of commands (after the merge), it created several issues (i.e. these commands...
dt.V <- rbindlist(lapply(g, vertex_attr_dt))
dt.G <- rbindlist(lapply(g, graph_attr_dt)))
Additional information is below. Hopefully this gives enough information to help figure out what is going on.
Please let me know and thank you!
Anthony
Call to SLURM interactive job: srun -p short -N 1 -n 2 --mem-per-cpu=5G -t 180 --pty bash
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.9 (Maipo)
Matrix products: default
BLAS/LAPACK: /PATH_TO_ANACONDA/anaconda3/envs/MyNewEnvironment/lib/
libopenblasp-r0.3.21.solocale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] doMC_1.3.8 iterators_1.0.14 foreach_1.5.2 expm_0.999-7
[5] Matrix_1.5-3 ade4_1.7-22 Hmisc_5.0-1 boot_1.3-28.1
[9] ggpubr_0.6.0 data.table_1.14.8 ggplot2_3.4.1 tidyr_1.3.0
[13] dplyr_1.1.0 brainGraph_3.0.2 igraph_1.4.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 lattice_0.20-45 digest_0.6.31 utf8_1.2.3
[5] R6_2.5.1 backports_1.4.1 evaluate_0.20 pillar_1.8.1
[9] rlang_1.1.0 rstudioapi_0.14 car_3.1-1 rpart_4.1.19
[13] checkmate_2.1.0 rmarkdown_2.20 stringr_1.5.0 foreign_0.8-84
[17] htmlwidgets_1.6.1 munsell_0.5.0 broom_1.0.4 compiler_4.2.2
[21] xfun_0.37 pkgconfig_2.0.3 base64enc_0.1-3 htmltools_0.5.4
[25] nnet_7.3-18 tidyselect_1.2.0 tibble_3.2.0 gridExtra_2.3
[29] htmlTable_2.4.1 codetools_0.2-19 fansi_1.0.4 permute_0.9-7
[33] withr_2.5.0 MASS_7.3-58.3 grid_4.2.2 gtable_0.3.1
[37] lifecycle_1.0.3 magrittr_2.0.3 scales_1.2.1 cli_3.6.0
[41] stringi_1.7.12 carData_3.0-5 ggsignif_0.6.4 doParallel_1.0.17
[45] generics_0.1.3 vctrs_0.5.2 Formula_1.2-5 tools_4.2.2
[49] glue_1.6.2 purrr_1.0.1 abind_1.4-5 fastmap_1.1.1
[53] colorspace_2.1-0 cluster_2.1.4 rstatix_0.7.2 knitr_1.42
> detectCores()
[1] 16