individual SCN networks

64 views
Skip to first unread message

jonata...@gmail.com

unread,
Jan 14, 2021, 4:49:35 PM1/14/21
to brainGraph-help
Hi Chris and all,

hope you're all doing great. 

I managed to create individual SCN following this approach (https://doi.org/10.1093/brain/awaa001) and was trying to pass each subject 'correlation' matrices as fMRI data in the create_maps function.

However, since I don't have much experience with fMRI, I don't really know how the correlationROI-subj001.txt files should look like. So I'm stuck in the first step (see below).

matfiles$A <- list.files(datadir, 'ROICorrelation_[a-z]+.*.txt', full.names=T) 

Could someone provide an example of how these files should look like/be organized? 

I have all the matrices (68x68) stored in separate .csv files for each of my subjects (cases and controls)

Thanks!!

All the best,
Jonatan

Chris Watson

unread,
Jan 14, 2021, 5:36:19 PM1/14/21
to brainGr...@googlegroups.com
Please note that I do not see a paper in the link you posted.

SCN is short for "structural covariance networks".

If you have CSV files, you should convert them to plain text files (with no commas). They should also not have any row or column names. That is, they should only consist of numbers.

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/1213ea9e-d09b-43d9-ace5-959a49bfdb33n%40googlegroups.com.

jonata...@gmail.com

unread,
Jan 14, 2021, 6:02:13 PM1/14/21
to brainGraph-help
I apologize. 

here's the link:


Thanks, I'll try to convert the files to just plain text.

jonata...@gmail.com

unread,
Jan 21, 2021, 6:16:33 PM1/21/21
to brainGraph-help
Hi Chris,

thanks for your guidance. It worked. I'm running some very preliminary tests and am still getting familiar with the new thresholding options available (not only 'threshold' or 'density' as with the SCN pipeline).

Thanks!!
Jonatan

jonata...@gmail.com

unread,
Jan 26, 2021, 7:17:09 PM1/26/21
to brainGraph-help
Hi Chris,

to follow with this, I have two more questions. The goal for me is to extract the mean of both graph and vertex metrics to use in within-subject analyses, ML classifiers, etc.

1.- I found that the metrics' mean from dt.G (from g) are not the same from dt.G.group (from g.group). This mismatch happened using density and consensus-based thresholds indistinctly. 

I understand dt.G stores the graph from all my subjects (n = 891) across thresholds, while dt.G.group have the groups' average by threshold (n = 2), but shouldn't the means still match?

dt.G[, .(mean = mean(Cp)), by = .(Group, threshold)]

Screen Shot 2021-01-26 at 7.01.18 PM.png

dt.G.group[, Group := Study.ID]       # I have to do this first because Group appears as '1' while the Study.ID column behaves as 'Group' 

dt.G.group[, .(mean = mean(Cp)), by = .(Group, threshold)]

Screen Shot 2021-01-26 at 7.01.09 PM.png

2.- Another question I have is, say I'm interested in using binarized networks (weighted = NULL), should I use 'A.bin' and 'A.inds' instead of 'A.norm.sub' and 'A.norm.mean' when generating g and g.group objects? If so, doing that result in different means between weighted and unweighted networks.

The code to generate g and g.group was this from your user guide (p. 46-47) is below.

Thank you very much in advance!
Jonatan

###################################################################################################

# mayflies and my.mats file already generated #

inds <- lapply(grps, function(x) covars[Group == x, which = T])
thresholds <- rev(seq(0.05, 0.3, 0.05))     
sub.thresh <- 0.5          
modality <-  'fmri'
atlas <- 'dk'
thrs.by <- 'consensus' 

my.mats <- create_mats(matfiles$A,                   
                       modality = modality, 
                       threshold.by = thrs.by,         
                       mat.thresh = thresholds,
                       sub.thresh = sub.thresh,
                       inds = inds)

g <- g.group <- vector('list', length(thresholds)) 

for (j in seq_along(thresholds)) {
  g[[j]] <- make_brainGraphList(my.mats$A.norm.sub[[j]], atlas, modality = modality,     # A.bin[[j]], or A.norm.sub[[j]] if weighted = T?
                                weighting = 'pearson', threshold = thresholds[j],
                                weighted = T, gnames = covars$Study.ID,     # weighted T or NULL
                                grpNames = covars$Group)
  
  g.group[[j]] <- make_brainGraphList(my.mats$A.norm.mean[[j]], atlas, modality = modality,  # A.inds[[j]], or A.norm.mean[[j]] if weighted = T?
                                      weighting = 'pearson', threshold = thresholds[j],
                                      weighted = T, gnames = grps)        # weighted T or NULL
}

dt.G <- rbindlist(lapply(g, graph_attr_dt))

dt.G.group <- rbindlist(lapply(g.group, graph_attr_dt))

dt.G.group$sub.thresh <- dt.G$sub.thresh <- sub.thresh

setorderv(dt.G, 'threshold', -1)

idvars <- c('modality', 'atlas', 'weighting', 'sub.thresh', 'threshold', 'Group')

dt.G.long <- melt(dt.G, id.vars = c(idvars, 'Study.ID', 'density'))

dt.G.group[, Group := Study.ID]   # Required to not return error when melt in dt.G.group.long

dt.G.group.long <- melt(dt.G.group, id.vars = c(idvars, 'Study.ID', 'density'))

# Calculate means #

###################################################################################################

Chris Watson

unread,
Jan 27, 2021, 6:42:57 AM1/27/21
to brainGr...@googlegroups.com
Hi,
1. I would not expect the means to be the same. The group-level graph is created from the mean of the input matrices, so the graph structure itself will be different from creating individual graphs and calculating average metrics across subjects. I don't think I would use "g.group" for most applications; it is better to keep using the subject-level data (in my opinion).

2. Yes, I think if you want to look at unweighted metrics you can use "A.bin", but there are also unweighted metrics calculated from the weighted graphs. For example, both degree and strength; "mod" and "mod.wt"; etc. I do not think that "mod" calculated from a weighted graph should be different from "mod" calculated from an unweighted graph, but you can test this if you like. Again, I would not bother with the "g.group" results.

Chris

Reply all
Reply to author
Forward
0 new messages