Shen 368 atlas, fmri, and NBS

120 views
Skip to first unread message

Lucinda

unread,
Jun 15, 2020, 10:13:48 PM6/15/20
to brainGraph-help
Hi!

I'm hoping to use NBS to look at functional connectivity data parcellated with the Shen368 atlas, and have a few questions:

1. Is there any chance the Shen368 atlas has been added to the list of compatible atlases, or would it be best to proceed under the 'use your own atlas' directions?
2. The intro section to NBS noted that it works directly on the connectivity matrices. Given this, is it still necessary to generate igraph files?
3. How much of the introductory code (e.g. setting up input/output dirs, etc) is necessary to run this analysis? I have been able to load the data in with the 'create_mats' function and create the covariance/design matrix, but am unfortunately getting the following error when attempting to run NBS(): 
"Error in A[, , -covars[, which(Study.ID %in% incomp)]] : 
  incorrect number of dimensions". 
Is it possible this is because I am missing some of the earlier requisite code? I've confirmed that the dimensions of the covariates and the design matrix align, as do the number of subjects.
4. Possibly related to the above error, but how are subject IDs linked within NBS to the connectivity matrices? I examined the object that resulted from create_mats() but didn't see a list of IDs. 

Thank you so much for any help or insight, and for sharing and maintaining this amazing set of tools!

Best,
Lucinda

Chris Watson

unread,
Jun 16, 2020, 12:55:20 AM6/16/20
to brainGr...@googlegroups.com
1. It will probably be best to follow the latter, at least until/unless someone can share the necessary information to create a data.table for that parcellation.
2. No, if you only want to run NBS, it isn't necessary to generate igraph graphs.
3. I am not entirely sure what is causing that error. Can you run "traceback()"? Do you have a "Study.ID" column in your covars data.table? If so, what kind of data is that column, character or numeric?
4. It is expected that the order in "covars" matches the order of the connectivity matrix files on your filesystem. This is typically going to be in alphanumeric order, but it might depend on the language used (i.e., the OS's locale).

Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/edb9a333-4fed-4658-8010-69819ba34d15o%40googlegroups.com.

Lucinda

unread,
Jun 16, 2020, 12:09:44 PM6/16/20
to brainGraph-help
Hi Chris,

Thank you so much for this response! I just tried running traceback but unfortunately it only returned the NBS() call. I do have a Study.ID column in the covars table, with character data. I can try playing with the subject naming to see if that clarifies anything. Thanks again!

Best,
Lucinda

On Monday, June 15, 2020 at 10:55:20 PM UTC-6, Chris Watson wrote:
1. It will probably be best to follow the latter, at least until/unless someone can share the necessary information to create a data.table for that parcellation.
2. No, if you only want to run NBS, it isn't necessary to generate igraph graphs.
3. I am not entirely sure what is causing that error. Can you run "traceback()"? Do you have a "Study.ID" column in your covars data.table? If so, what kind of data is that column, character or numeric?
4. It is expected that the order in "covars" matches the order of the connectivity matrix files on your filesystem. This is typically going to be in alphanumeric order, but it might depend on the language used (i.e., the OS's locale).

Chris

On Mon, Jun 15, 2020 at 10:13 PM Lucinda <lucin...@gmail.com> wrote:
Hi!

I'm hoping to use NBS to look at functional connectivity data parcellated with the Shen368 atlas, and have a few questions:

1. Is there any chance the Shen368 atlas has been added to the list of compatible atlases, or would it be best to proceed under the 'use your own atlas' directions?
2. The intro section to NBS noted that it works directly on the connectivity matrices. Given this, is it still necessary to generate igraph files?
3. How much of the introductory code (e.g. setting up input/output dirs, etc) is necessary to run this analysis? I have been able to load the data in with the 'create_mats' function and create the covariance/design matrix, but am unfortunately getting the following error when attempting to run NBS(): 
"Error in A[, , -covars[, which(Study.ID %in% incomp)]] : 
  incorrect number of dimensions". 
Is it possible this is because I am missing some of the earlier requisite code? I've confirmed that the dimensions of the covariates and the design matrix align, as do the number of subjects.
4. Possibly related to the above error, but how are subject IDs linked within NBS to the connectivity matrices? I examined the object that resulted from create_mats() but didn't see a list of IDs. 

Thank you so much for any help or insight, and for sharing and maintaining this amazing set of tools!

Best,
Lucinda

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGr...@googlegroups.com.

Chris Watson

unread,
Jun 16, 2020, 12:34:03 PM6/16/20
to brainGr...@googlegroups.com
Actually, this looks like a bug that I thought I had fixed. However, judging by the error I would guess that there is a mismatch between the array dimensions and the contents of "covars". Can you report the following:

dim(covars)
covars[complete.cases(covars), .N]
covars[!complete.cases(covars), Study.ID]
dim(A)

And please include the *full function call* you make to NBS that causes the error.
Chris

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/4db380bb-a433-49d7-95f8-20785a6659b5o%40googlegroups.com.

Lucinda

unread,
Jun 16, 2020, 12:45:46 PM6/16/20
to brainGraph-help
Of course!

dim(covars): [1] 44  5
covars[complete.cases(covars), .N]: [1] 31
covars[!complete.cases(covars), Study.ID]: [1] "sub-INV01RGTWD2" "sub-INV01Z8HAPV" "sub-INV040B4TRC" + 10 others
dim(A): 368 368  44
function call: NBS(A, covars, con.mat=con.mat, X=X, p.init = 0.001, N=1e3, alternative='greater')

Chris Watson

unread,
Jun 16, 2020, 1:59:43 PM6/16/20
to brainGr...@googlegroups.com
In the next version of brainGraph this bug will be fixed, but in the meantime you can try the following: (note the exclamation mark in the first line)

incomp <- covars[!complete.cases(covars), which=TRUE]
NBS(A[, , -incomp], covars[complete.cases(covars)], ...)

where "..." is the rest of your function call. Note also that you don't *need* to pass in a design matrix "X".
Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.

Lucinda

unread,
Jun 16, 2020, 3:01:04 PM6/16/20
to brainGraph-help
That did it, thank you SO much!! I did get the following warning, but it seems like the code is still supported in the R version I'm using (3.6.3). Thank you again!

"The melt generic in data.table has been passed a array 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(A). In the next version, this warning will become an error."

Chris Watson

unread,
Jun 16, 2020, 6:53:06 PM6/16/20
to brainGr...@googlegroups.com
Yes, that warning is OK and will also go away with the next version.
Chris

On Tue, Jun 16, 2020 at 3:01 PM Lucinda <lucind...@gmail.com> wrote:
That did it, thank you SO much!! I did get the following warning, but it seems like the code is still supported in the R version I'm using (3.6.3). Thank you again!

"The melt generic in data.table has been passed a array 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(A). In the next version, this warning will become an error."

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.

Lucinda

unread,
Jun 17, 2020, 1:53:01 PM6/17/20
to brainGraph-help
Great, thank you so much! I've been encountering one other error that I haven't been able to resolve. Wondering if there is a limit on how many subject can be run? Thanks so much for any insight!

"Error in 2:max(cov.vec) : result would be too long a vector". 


On Tuesday, June 16, 2020 at 4:53:06 PM UTC-6, Chris Watson wrote:
Yes, that warning is OK and will also go away with the next version.
Chris

On Tue, Jun 16, 2020 at 3:01 PM Lucinda <lucin...@gmail.com> wrote:
That did it, thank you SO much!! I did get the following warning, but it seems like the code is still supported in the R version I'm using (3.6.3). Thank you again!

"The melt generic in data.table has been passed a array 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(A). In the next version, this warning will become an error."

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGr...@googlegroups.com.

Chris Watson

unread,
Jun 17, 2020, 1:56:49 PM6/17/20
to brainGr...@googlegroups.com
Please provide more information. I assume this is from running NBS? The error probably comes from "brainGraph_GLM_design" but please post the output of "traceback()". Also the full function call that leads to the error.
Also please post the output of "str(covars)".

If you previously had created a design matrix, and are no longer including "X=X" in the function call, you have to make sure the function arguments are the same.
Chris

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/fec54f52-f8f6-4062-a74d-03bbc699647co%40googlegroups.com.

Lucinda

unread,
Jun 17, 2020, 2:04:46 PM6/17/20
to brainGraph-help
Hi Chris,

Thanks so much for the prompt reply! Sorry, the call resulting in this error is: NBS(A_f0[, , -incomp], covars[complete.cases(covars)], con.mat=con.mat, p.init = 0.001, N=1e3, alternative='greater'). Here is the traceback result: 

"Error in 2:max(cov.vec) : result would be too long a vector

Calls: NBS -> setup_glm -> brainGraph_GLM_design

In addition: Warning message:

In max(cov.vec) : no non-missing arguments to max; returning -Inf

Execution halted"


On Wednesday, June 17, 2020 at 11:56:49 AM UTC-6, Chris Watson wrote:
Please provide more information. I assume this is from running NBS? The error probably comes from "brainGraph_GLM_design" but please post the output of "traceback()". Also the full function call that leads to the error.
Also please post the output of "str(covars)".

If you previously had created a design matrix, and are no longer including "X=X" in the function call, you have to make sure the function arguments are the same.
Chris

On Wed, Jun 17, 2020 at 1:53 PM Lucinda <lucin...@gmail.com> wrote:
Great, thank you so much! I've been encountering one other error that I haven't been able to resolve. Wondering if there is a limit on how many subject can be run? Thanks so much for any insight!

"Error in 2:max(cov.vec) : result would be too long a vector". 

On Tuesday, June 16, 2020 at 4:53:06 PM UTC-6, Chris Watson wrote:
Yes, that warning is OK and will also go away with the next version.
Chris

On Tue, Jun 16, 2020 at 3:01 PM Lucinda <lucin...@gmail.com> wrote:
That did it, thank you SO much!! I did get the following warning, but it seems like the code is still supported in the R version I'm using (3.6.3). Thank you again!

"The melt generic in data.table has been passed a array 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(A). In the next version, this warning will become an error."

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/ca2ce7ef-f3a4-496d-9198-571bdca9ee5fo%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGr...@googlegroups.com.

Chris Watson

unread,
Jun 17, 2020, 2:52:44 PM6/17/20
to brainGr...@googlegroups.com
Can you also post "str(covars)"

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/f2fa2b28-e1f5-4153-86e9-b88944087e2co%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages