Code Monkey home page Code Monkey logo

braingraph's Introduction

brainGraph

lifecycle Project Status: Active - The project has reached a stable, usable state and is being actively developed. Linux Build Status CRAN_Status_Badge Dependencies GPL License CRAN Downloads HitCount

brainGraph (RRID: SCR_017260) is an R package for performing graph theory analyses of brain MRI data. It is most useful in atlas-based analyses (e.g., using an atlas such as AAL, or one from Freesurfer); however, many of the computations (e.g., the GLM-based functions and the network-based statistic) will work with any graph that is compatible with igraph. The package will perform analyses for structural covariance networks (SCN), DTI tractography (I use probtrackx2 from FSL), and resting-state fMRI covariance (I have used the Matlab-based DPABI toolbox).

Requirements

Operating Systems

The package should work "out-of-the-box" on Linux systems (at least on Red Hat-based systems; i.e., CentOS, RHEL, Scientific Linux, etc.) since almost all development (and use, by me) has been on computers running CentOS 6 and (currently) CentOS 7. I have also had success running it (and did some development) on Windows 7, and have heard from users that it works on some versions of Mac OS and on Ubuntu. Please see the User Guide (mentioned below) for more details.

Multi-core processing

Many brainGraph functions utilize multiple CPU cores. This is primarily done via the foreach package. Depending on your OS, you will need to install doMC (macOS and Linux) or doSNOW (Windows).

Compatibility

Neuroimaging software

I mostly use Freesurfer and FSL, but the following software packages should be suitable. Note that this is an incomplete list; any software that can output a connectivity matrix will work.

Brain atlases

There are several brain atlases for which the data are present in brainGraph. Atlases containing .scgm in the name contain both cortical and SubCortical Gray Matter (SCGM) regions.

  1. dk and dk.scgm: Desikan-Killiany
  2. dkt and dkt.scgm: Desikan-Killiany-Tourville
  3. destrieux and destrieux.scgm: Destrieux
  4. aal90 and aal116: Automated Anatomical Labeling atlas
  5. aal2.94 and aal2.120: AAL-2
  6. brainsuite: Brainsuite
  7. craddock200: Craddock-200
  8. dosenbach160: Dosenbach-160
  9. hoa112: Harvard-Oxford atlas
  10. lpba40: LONI Probabilistic Brain Atlas
  11. hcp_mmp1.0: HCP-1mm
  12. power264: Power-264
  13. gordon333: Gordon-333
  14. brainnetome: Brainnetome

Other atlases

Some functions accept a custom.atlas argument, so that you can analyze data that is from an atlas not present in brainGraph. Other atlases to be added in the future include the following (I would need specific coordinate, region name, and lobe and hemisphere information):

Installation

There are (primarily) two ways to install this package:

  1. Directly from CRAN: (use one of the following commands)
install.packages('brainGraph')
install.packages('brainGraph', dependencies=TRUE)
  1. From the GitHub repo (for development versions). This requires that the devtools package be installed:
devtools::install_github('cwatson/brainGraph')

This should install all of the dependencies needed along with the package itself. For more details, see the User Guide (PDF link).

Multi-core processing

To set up your R session for parallel processing, you can use the following code. Note that it is different for Windows. This code should be run before any data processing. If you will always use a single OS, you can remove the unnecessary lines.

OS <- .Platform$OS.type
if (OS == 'windows') {
  library(snow)
  library(doSNOW)
  num.cores <- as.numeric(Sys.getenv('NUMBER_OF_PROCESSORS'))
  cl <- makeCluster(num.cores, type='SOCK')
  clusterExport(cl, 'sim.rand.graph.par')   # Or whatever functions you will use
  registerDoSNOW(cl)
} else {
  library(doMC)
  registerDoMC(detectCores() - 1L)  # Keep 1 core free
}

For example, I source the following simple script before I do any parallel processing with brainGraph:

pacman::p_load(brainGraph, doMC)
registerDoMC(detectCores())

GUI

On some systems (e.g., macOS and Windows) it might be difficult to install the necessary packages/dependencies for the GUI functions. Since v2.2.0 (released 2018-05-28), the R packages RGtk2 and cairoDevice have been changed to Suggests (i.e., they are no longer required), so it can be installed on a "headless" server.

If you are on macOS or Windows and would like GUI functionality, please see this GitHub Gist. The comments contain more recent information. You may also need to install a few additional packages, shown here:

install.packages('gWidgets', dependencies=TRUE)
install.packages('gWidgetsRGtk2', dependencies=TRUE)
install.packages('RGtk2Extras', dependencies=TRUE)

Suggested packages

There are a few suggested packages that may be required for certain functions:

  • RGtk2 and cairoDevice: as mentioned above, these are required to use the GUI
  • boot: required for brainGraph_boot
  • Hmisc: required for corr.matrix
  • ade4: required for loo and aop
  • expm: required for communicability and centr_betw_comm

Usage - the User Guide

I have a User Guide that contains extensive code examples for analyses common to brain MRI studies. I also include some code for getting your data into R from Freesurfer, FSL, and DPABI, and some suggestions for workflow organization.

The User Guide is the most complete documentation of this package. If you are a beginner using R, I encourage you to read it thoroughly. You may start with the Preface or at whichever chapter is suitable for your analyses.

Major changes in v3.0.0

There are several major changes in v3.0.0. See the User Guide for more extensive details.

  • There are several fewer package dependencies, allowing for a quicker install process
  • There are a few new built-in atlases (see below for the full list)
  • Graph creation is simpler (in terms of code) with the new brainGraphList object
  • The GLM-based functions are significantly faster and easily handle large models. The most significant speed improvements are seen in NBS and mtpc
  • There are more methods to calculate GLM-based statistics (including residuals, coefficient of determination, ANOVA, etc.)
  • There are global options that give the user some more control
  • There are other methods that make manipulating data objects easier/more flexible

To access the User Guide, a PDF is available at this link.

Graph measures

In addition to the extensive list of measures available in igraph, I have functions for calculating/performing:

Group analyses

There are several analyses based on the General Linear Model (GLM), and others that have different purposes.

GLM-based

  • Between-group differences in vertex- or graph-level measures (e.g., degree, betweenness centrality, global efficiency, etc.) using the GLM's. See Chapter 8 of the User Guide, which was partly modeled after the GLM page on the FSL wiki
  • The multi-threshold permutation correction (MTPC) method for statistical inference (see Drakesmith et al., 2015 and Chapter 9 of the User Guide)
  • The network-based statistic (NBS) (see Zalesky et al., 2010 and Chapter 10 of the User Guide)
  • Graph- and vertex-level mediation analysis (see Chapter 11 of the User Guide, and the mediation package in R)

Non-GLM based

  • Bootstrapping of graph-level metrics (e.g., modularity)
  • Permutation analysis of between-group differences in vertex- or graph-level measures
  • "Individual contributions" (leave-one-out [LOO] and add-one-patient [AOP]; see Saggar et al., 2015)

Null graph-related measures

Other measures

Visualization

There is a plotting GUI for fast and easy data exploration that will not work without data from a standard atlas (ideally to be extended some time in the future). You may use a custom atlas if you follow the same format as the other atlases in the package (see Chapter 4 of the User Guide for instructions).

brainGraph GUI

Getting Help

For bug reports, feature requests, help with usage/code/etc., please join the Google Group brainGraph-help. You may also consult the User Guide, and you can open an issue here on GitHub.

Future versions

An incomplete list of features/functionality I plan on adding to future versions:

  • Longitudinal modeling (with linear mixed effects (LME) models)
  • Thresholding and graph creation using the minimum spanning tree as a base
  • Thresholding and graph creation for resting-state fMRI using a technique such as the graphical lasso
  • Write functions to print group analysis results in xtable format for LaTeX documents

braingraph's People

Contributors

cwatson avatar michaelhallquist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

braingraph's Issues

vertex_attr_dt error in rbindlist: non existing column(s) 'density'

Hi, thanks for the great package and detailed documents. I'm working with rs-fmri functional connectivity matrices. I've successfully make brainGraphList with 10 thresholds, and saved g/g.group.rds. But something wrong when creating vertex measures:

dt.V <- rbindlist(lapply(g, vertex_attr_dt))
Error in colnamesInt(x, neworder, check_dups = FALSE) : 
  argument specifying columns specify non existing column(s): cols[1]='density'

The graph measures rbindlist(lapply(g, graph_attr_dt)) worked fine:

I checked the documents, seems density is the argument for structural covariance network? I guess the key of rbindlist should be threshold. But I dont know how to fix that.

I'd appreciate your reply.
Thank you.

group.cols missing in make_brainGraph()

Hi Watson,

I am using my own atlas(shen278) to create a brainGraph object, however, something is going wrong.

> test_brainGraph <- make_brainGraph(test, "shen278_atlas", group = shen278_yeo17$yeo17) Error in make_brainGraph(test, "shen278_atlas", group = shen278_yeo17$yeo17) : object 'group.cols' not found

I checked the source code, and it appears that the group.cols is not defined early in the make_brainGraph() function, and meanwhile it is also not included in the internal data of the package. Is it just a color vector?

Thanks,
Zikai

Parallel processing for calculating efficiency of very large graphs

As discussed in this Stack Overflow question, brainGraph::efficiency() uses igraph::distance to calculate distance matrices.

When the number of vertices is large, this can easily eat up all of the memory of a local machine.

A solution that @cwatson proposed on SO is to run the calculation in parallel for sufficiently large graphs. I'm unsure of where to draw this line.

Moreover, since even parallel calculations can easily eat up memory and take hours to solve, I want to add that the best way to approach this might be to throw an error that prompts the user to either:

  • use a new function (i.e. - parallel_efficiency()) or
  • specify an argument that, if TRUE evaluates the problem via {doParallel}, and uses 1/2 the cores by default, or by the number of cores specified in a cores argument

Anova tests between three or more groups of graph descriptors

Hi everyone,
i have a question about structural covariance matrices analysis. Following the manual i built adjacency matrices and graphs for my structural data. At this point I would like performing statistical analysis between groups at graph and vertex level, but i have three groups (i.e 1st patient group, 2nd patient group, 3 control group). How could i perform Statistics analysis in this situation (ANOVA)? The permutation analysis I read in the manual does a comparison only between two groups. An other question is if it is possible choosing the groups to compare in the permutation analysis.
Thanks

error in running make_brainGraphList

I followed the brainGraph user guide for version 3.0.0., but when I get to the make_brainGraphList command I get the following error:
Error in { : task 1 failed - "invalid 'length.out' value"
This is a sample of the adjacency matrices
adjmats.zip
Could you help fix this error?

plot.braingraph function

HI Chris,
I am wondering whether plot function can help plot same group ROIs in same colour based on coordinates. Here is the example data. The first three are coordinate and the last column is the group.
Thanks~

`

  x y z group
0 -34.0239520958084 -40.1017964071856 -22.0059880239521 3
1 -36.3230769230769 -55.6 -18.4307692307692 2
2 -26.0408163265306 -45.0612244897959 -13.8163265306122 3
3 -28.6739926739927 -35.9267399267399 -14.8791208791209 3
4 -28.3012048192771 -62.1927710843374 -13.2289156626506 3
5 -35.7305699481865 -70.6113989637306 -16.1554404145078 2
6 -44.876404494382 -69.8089887640449 -13.7752808988764 3
7 -24.3027888446215 -58.2709163346614 -8.95617529880478 1
8 -22.3983050847458 -74.8305084745763 -9.33050847457627 3
9 -40.9387755102041 -78.9387755102041 -13.8639455782313 2
10 -18.75 -36.2166666666667 -12.55 3
11 -24.23598820059 -85.9233038348082 -15.4749262536873 2
12 -21.3461538461538 -49.4487179487179 -6.41025641025641 3
13 -39.136 -86.752 -15.936 1

`

A tutorial of how to build networks with brainGraph

Hope this finds you well.
I want to introduce my tutorial on building multiple networks and save the data table to excel csv file.
Since igraph has delete the function 'as_adjacency_matrix()' and some of you may come up with this problem in your new R (for example, I used R 4.4.0), I have updated my tutorial to overcome this issue and also showed how to build networks with brainGraph (https://github.com/Clancy-wu/brainGraph_tutorial)

The steps I used:
(1) use fmriprep+xcp_d to process functinal images, get MNI bold nii.gz
(2) use qsiprep to process difussion iamges, get tck file
(3) use pearsonr to construct functional network and use sift2_invnodevol_count to construct fiber network.
(4) split the functional and fiber networks to raw network, positive network, and negative network.
(5) use brainGraph to compute network properties and save results to csv file. Note that this netowrk files are .txt format.

The brainGraph is great, but not good enough. I think that most issues of it are actually from R software, not brainGraph itself.

Foreach is unable to access custom atlas object in make_brainGraphList()

Hello, @cwatson. I'm trying to build several graphs of BOLD data using different atlases. The first two run with no issues (as they're both implemented in your latest version), but when I get to the third make_brainGraphList stops and throws:
Error in { : task 1 failed - "object 'schaefer100x7' not found".

I found another similar issue [#4], but I still can't resolve my problem. I followed the User Guide in building the data.table atlas object (it has the required columns and then I ran it hrough as_atlas). It is accessible in my environment and has the same name as the atlas string object that is used as an argument for make_brainGraphList. When I run get(atlas) before running make_brainGraphList, the data.table comes without any issue. I tried saving it as an .rda and then loading it again. Nothing seems to work.

When I ran the function after using debug(), I could see that it crashes just as it reaches the foreach (%dopar%) loop; but it is so deep in the make_brainGraph method, that I don't know how to fix it myself.

Any help would be greatly appreciated.

make_brainGraphList error

Hi,

I am new to the brainGraph. I've gotten stuck at "make_brainGraphList", and hope you could give me some suggestions. The error reads
"r in { :
task 1 failed - "Length of new attribute value must be 1 or 84, the number of target vertices, not 0"

The input matrices are symmetric with 0 in the diagonal, each one is 84 by 84, totally 210. I am using a custom atlas (modified from dk atlas).
Attached are the scripts, one of the the connectivity matrices, and the atlas rda file.

Thank you.

Ping
brainGraph_files.zip

Error in rich_club_norm: calling non-existing V(g)$degree

Hi,

When using rich_club_norm() I get an error and a warning:

Error in seq_len(max.deg) : 
  argument must be coercible to non-negative integer
In addition: Warning message:
In max(V(g)$degree) : no non-missing arguments to max; returning -Inf

This is apparently due to the fact that the code calls V(g)$degree, while it's not calculated beforehand.

Am I right? Does it have a quick fix, or I do it myself?

Consider submitting to Neuroconductor

Hi!

What an excellent package! I stumbled upon it when a user of my own package had issues which stem from my package also exporting a dk dataset what was conflicting with yours.

Please consider submitting this work to the Neuroconductor project. Its a great way to get R users in Neuroimaging easy access to your package :)

vertex_attr_dt Error in get(g$atlas) : invalid first argument

Hi. Thank you for this great package. I've successfully run "set_brainGraph_attr" and
"dt.G <- rbindlist(lapply(g, graph_attr_dt))".
But I have trouble getting the output from
"dt.V <- rbindlist(lapply(g, function(x)
rbindlist(lapply(x, vertex_attr_dt))))"

Error in get(g$atlas) : invalid first argument
g is a large list (7 elements), that is 7 groups I have.
I'd appreciate your help in this regard.
Thank you.

Error get.resid() function: x is not data.table

Hi Chris,

Im following your user's guide to construct a structural covariance network. Very helpful, thanks.
Unfortunately I get stuck at the 'model residuals' part, specifically:

all.dat.resids <- get.resid(lhrh, covars=covars, exclude.cov='Group')

gives an error:
Error in setkeyv(x, cols, verbose = verbose, physical = physical) : x is not a data.table

I've looked into the function, running it step by step. And it seems that the issue arises when using the melt() function:
DT.m <- melt(DT.cov, id.vars = names(covars), variable.name = "region")

which gives a warning message:
Warning message: In melt(DT.cov, id.vars = names(covars), variable.name = "region") : The melt generic in data.table has been passed a data.frame and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is deprecated, and this redirection is now deprecated as well. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace like reshape2::melt(DT.cov). In the next version, this warning will become an error.

And I think this leads to the problem that DT.m is not a data.table. Hence, when submitting it to setkey(DT.m, region, Study.ID), an error message is given:
Error in setkeyv(x, cols, verbose = verbose, physical = physical) : x is not a data.table

I've looked this warning up online, and it seems indeed some things have changed in using the melt() function. I guess this needs to be adjusted in your get.resid() function as well.

Best,
Tessa

Problem with "create_mats"

Hi, thank you for developing this package! I want to create an array with all my ".mat" files but it appears this issue:

DCF_mats<- list(path= 'C:/Users/maval/OneDrive/Data_dsi/Primer_analisis_preliminar_dsi/DCF_todaslasmat')
DCF_array<- create_mats(DCF_mats, modality = "dti", algo = "deterministic")
Error in create_mats(DCF_mats, modality = "dti", algo = "deterministic") :
length(A.files) == nz is not TRUE

numeric subject IDs with leading zeros

This is an edge case, but where all subject IDs are numeric then those with leading zeros will be changed when imported with import_scn.

For example "0506" becomes "506" because fread guesses whether columns are numeric or not based on their content. Character output is guaranteed because of as.character, but if there are leading zeros then as.character(as.numeric(x)) != as.character(x).

I have a relatively simple fix, so simple I've not bothered with a PR - happy to do so if it helps.
If you add the argument colClasses=list(character = 1) to the calls to fread (within update_fs_names) then column 1 will always be read in as a character by data.table.

This should have no side effects as types for all other columns will be unaffected and column 1 is specified to be the freesurfer Study.ID

robustness function, random error

Thank you for providing this nice R package. I want to calculate my network (igraph) robustness and vulnerability. When I run the robustness function with degree and betweeness centrality measures, it does run fine. However, for the random argument, I always get the following error message:

Error in { : task 3 failed - "Invalid vertex names"

Any ideas on how to solve the problem? Why is it just a problem with "random" and not the other two arguments? Thank you!

import_scn gives error when using scgm

When I try to use either atlas including scgm (destrieux, dk, dkt) in import_scn, I get the following error:


Error in update_fs_names(asegfile, "aseg", exclude.subs) : 
  argument "exclude.subs" is missing, with no default

Even when I specifically include a subject in exclude.sub.

Weighted Graph Efficiency

Hi Chris,

If I understand the package right, brainGraph universally stores strength-type weights (i.e. larger value = stronger connections), then converts these with xfm.weights when cost/distance type weights (larger value = weaker connection) are needed.

The efficiency function needs the latter cost/distance type weights, but the documentation doesn't specify this.

First proposal - to clarify the documentation:

weights: Numeric vector of edge weights; if NULL (the default), and if the graph has edge attribute weight, then that will be used. To avoid using weights, this should be NA. Note: weights must be transformed such that the strongest connections have the lowest weights (see xfm.weights)

Beyond the documentation, if a user makes a weighted brainGraph and just wants to know the efficiency it's relatively natural to just run efficiency(myGraph). This gives the wrong answer because strength weights are used rather than distance weights. The package intended way to get efficiency measures is set_brainGraph_attr which works fine because this function handles the conversion.

I wanted to see what you think about changing the efficiency function so expected results for a weighted brainGraph are obtained by default?

For example, have efficiency transform input weights by default, adding an argument with options from xfm.weights, something like: weight.xfm = c("1/w", "-log(w)", "1-w", "none"), with the "none" option allowing a graph with pre-calculated distance weights to be passed. Then, when efficiency is called within set_brainGraph_attr you could pass "none" to avoid repeated transformations for the block of graph measures that use distance weights.

What do you think? Happy to help with a PR if this would be of any use.
Alternatively if it's just me that wants to do it this way I can just wrap the function :)

All the best,

Andrew

User defined atlas not loadable by `set_brainGraph_attr`

@cwatson I've followed the User Guide Section 2.4 on generating my own atlas and saving it to a .rda file.

However, when calling it from set_brainGraph_attr, the atlas data table is loaded by eval(parse(text=atlas)) where only predefined atlases could be loaded but not user defined atlases. Setting up working directory to point to the user's atlas setwd() didn't work as well. Seems like it needs to be in the NAMESPACE or environment() path.

Any suggestions on how to get around this? Thanks!

`cairoDevice` installation error on CentOS 7

@cwatson You mentioned brainGraph was mostly developed on CentOS 6/7. I'm having a hard time trying to get pass the cairoDevice installation in RStudio Server. I have installed GTK 2.24 along with cairo-devel and dependencies on my CentOS 7 but it's still giving me errors below. My Ubuntu 16 didn't have this issue. Any thoughts?

R session is headless; GTK+ not initialized.
(R:25763): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error: package or namespace load failed for ‘cairoDevice’:
.onLoad failed in loadNamespace() for 'cairoDevice', details:
call: fun(libname, pkgname)
error: GDK display not found - please make sure X11 is running
Error: loading failed
Execution halted

Several recommendations for the developing of this brilliant work

Dear Watson,
I learned much from your package and this hepls me a lot, so I should say much thanks to you.
I used to choose GRETNA (a tool for graph theory analysis in matlab, born at year 2013) for my work, but it really out of date for lacking various analysis models.
When I knew about your BrainGraph, I realized that this is what I really want which would meet with all requirements of my work at present. However, I have some suggestions for this version of manual and package, and I hope these points could help you to develp a better future version.

  1. brainGraph User Guide Version 3.0.0 (Page 45, Para 7.2.3 ). I used the .csv connection matrix generated by MRtrix3, so this runs error for my data. After viewedcode sources, I realized that 'matfiles$A' should be the .txt format without quote. I think this point could be provided in the manual.
  2. brainGraph User Guide Version 3.0.0 (Page 46, Para 7.3 ). 'groups=covars.dti$Group' is a mistake. This should be updated to 'grpNames = covars.dti$Group', otherwise it will report error continuously.
  3. For lots of fans of your package, we are the layman in graph theory, so we want to know a little basical informations. eg. Why should I set a series of thresholds, what is recommended for setting this value. A very little explanations would help us a lot. I think kind explanations in the right place could promote the spread of your package.
  4. The most important is, I strongly hope you could publish this work to a journal for the convinient citation of us. I noticed that there still hadn't valid article in your brilliant work. Though I didn't know the reason, I think this could be a pity. At least in my view, I strongly want to citate your work.
    All in all, I hope you could persist in this work and spread the work to more and more people, thus making a hgih citation article.

Best wish,
Yours Sincerely,
Kang Wu

Remapping coordinates into DK

Hi,

I am unsure if this is an appropriate ask of brainGraph.

Nevertheless, I have a list of coordinates I would like to parcellate across the DK atlas. Is this possible using brainGraph?

Best wishes,
Brandon

connectivity matrices from ExploreDTI

I've gotten some connectivity matrices from ExploreDTI using the AAL atlas. These were originally .mat files, I 've converted them into .csv files. I tried to do a create_mats, but I end up with the following error:

Error in scan(x, what = numeric(0), n = Nv * ncols, quiet = TRUE) :
scan() expected 'a real', got '"","CM.1","CM.2","CM.3","CM.4","CM.5","CM.6","CM.7","CM.8","CM.9","CM.10","CM.11","CM.12","CM.13","CM.14","CM.15","CM.16","CM.17","CM.18","CM.19","CM.20","CM.21","CM.22","CM.23","CM.24","CM.25","CM.26","CM.27","CM.28","CM.29","CM.30","CM.31","CM.32","CM.33","CM.34","CM.35","CM.36","CM.37","CM.38","CM.39","CM.40","CM.41","CM.42","CM.43","CM.44","CM.45","CM.46","CM.47","CM.48","CM.49","CM.50","CM.51","CM.52","CM.53","CM.54","CM.55","CM.56","CM.57","CM.58","CM.59","CM.60","CM.61","CM.62","CM.63","CM.64","CM.65","CM.66","CM.67","CM.68","CM.69","CM.70","CM.71","CM.72","CM.73","CM.74","CM.75","CM.76","CM.77","CM.78","CM.79","CM.80","CM.81","CM.82","CM.83","CM.84","CM.85","CM.86","CM.87","CM.88","CM.89","CM.90"'

Error in code?

Hello!

I am new to using NBS in R but have used it before with success in MatLab. I am transitioning to R for cost reasons and would like to try to stay on that platform. When I am run NBS using this code:

NBS(control_reward_filtered, irr.parent_NBS_filtered, second.col)

I receive the following error:
Error in :=(eval(sID), seq_len(dim(covars)[1L])) :
Check that is.data.table(DT) == TRUE. Otherw
irr.parent_NBS_filtered.csv
second.col.csv
control_reward_filtered.csv
ise, := and :=(...) are defined for use in j, once only and in particular ways. See help(":=").

When I review the error using help and online it suggests there might be a corruption in the newest version of data.table and I need to revert to an old version. Is there a way to run the NBS package by calling an old version of data.table?

Attaching files called in this code as examples.

How to contribute?

@cwatson
Appreciate your effort on this package and releasing it to others! Do you have any guidelines on how others can help contribute?

Conflict between different packages, robustness function, random error

Hi

Thank you for providing this nice R package. I really want to use it, but I ran into some problems:

  1. When I load the two packages (brainGraph v 3.0.2 and ggplot2 v 3.3.5) at the same time, the line cannot be fitted:

{6C9FFBD2-E664-50A5-53B6-8146AA4CEB6D}

  1. robustness and vulnerability
robustness(g, type = "vertex", measure = c('random'))
 Error in { : task 3 failed - "Invalid vertex names" 

vulnerability(g, use.parallel=TRUE, weighted=FALSE)
Error in vuln[verts] <- foreach(i = verts, .combine = "c") %d% { : 
  replacement has length zero

I encountered the above error on both MacOS and Windows. I read the previous discussion and it seems that the brainGraph package is best to run on Linux?

This is my net file:

net.zip

PS: My installation method is: devtools::install_github('cwatson/brainGraph')

Custom Atlas and lobe/hemisphere allocation

I found all the existing atlas with .aseg (subcortical components) contains only structures can be allocated in left/right lobe.
Is there any required modification for use custom atlas with structure cannot be assign left or right? (i.e. brainstem, pons)

Should I just put 3rd value (like M for middle instead of L or R) in column? It seems empty column causes error.

brainGraph_permute issue with custom Atlas

Hi, thanks for developing this great R package! I have an issue running the script "brainGraph_permute", in particular when running the script the output is:
error in { task 3 "atlas name "Gordon333dil" not found
I followed all the previous steps in the guide to build a custom atlas, successfully because all previous analysis and graph building were fine and correct. Also the bootstrapping was ok, but wen i run this command:
brainGraph_permute(densities, all.dat.resids, perms = myPerms, level = "graph", atlas=atlas)
the output is the error i mentioned above.
In my Global Env Var there are either ATLAS variable (character one "gordon333dil") and the gordon333dil (that is the data.table of my custom atlas).
Do you have any suggestion?

Thanks

Using brainGraph with ecological data.

Hi Chris,

I am interested in using brainGraph package to access vertex roles in some igraph network I am working. My problem is I don't know what this {memb}{A numeric vector of membership indices of each vertex} means. Can I extract it from my igraph networks? Bear with me because I am a noobie at this. Thanks in advance.

Rodrigo

Called from: e$fun(obj, substitute(ex), parent.frame(), e$data)

Dear Chris!!
when I ran the code below, I got this error.
I think the part of "graph_from_adjacency_matrix" was ok. I got the list of iGraph class object.
but "set_brainGraph_attr" was the problem where I got an error.
is there any thoughts or comments? what am I getting this error??
Please help me out!!!

atlas <- "aal116"
modality <- "fmri"
allg <- apply(allmats, 1, function(sub) {
g <- graph_from_adjacency_matrix(sub, mode="undirected", weighted=TRUE, diag=FALSE)
g <- set_brainGraph_attr(g, atlas = atlas, modality = modality)
return(g)
})

Error in { : task 1 failed - "argument is of length zero"
In addition: Warning message:
executing %dopar% sequentially: no parallel backend registered
Called from: e$fun(obj, substitute(ex), parent.frame(), e$data)
Browse[1]>

User Guide down

Is the any alternative link for the user link? Dropbox seems to no longer have the file.

suggest setting 'atlas' in make_brainGraphList from necessary to optional

From my experience, I have to say that lot errors may occur at the parameter 'atlas' in make_brainGraphList.
I defined my self atlas, and I run it successfully in the Linux system. However, when I run the same code in Windows, I get error in make_brainGraphList saying "cannot find objective 'shaefer' " (I have named my atlas as shaefer). I am sure that I have load my atlas and I can see the atlas when I type it in the terminal. Also, my atlas meets your standards.
I have to say that the parameter 'atlas' really brings some difficulties to users. I suggest that in the future, maybe you can make 'atlas' as an optional parameter, so that it can be suitable for more types of data, rather than fMRI dataset. : )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.