Creating_Graphs {brainGraph}R Documentation

Create a brainGraph object

Description

make_brainGraph is the main creation function for creating a brainGraph graph object. This is simply an igraph graph object with additional attributes (at all levels). Several of the graph-level attributes serve the purpose of providing metadata on how the connectivity matrices/networks were created.

make_brainGraph.bg_mediate creates a graph only for vertex-level analyses.

make_empty_brainGraph creates an empty undirected brainGraph object with vertex count equal to the atlas specified; i.e., it creates a graph with 0 edges. Typically used to present results from an analysis in which edges don't make sense (e.g., GLM comparing differences in a vertex-level attribute).

Usage

make_brainGraph(x, atlas, type = c("observed", "random"),
  level = c("subject", "group", "contrast"), set.attrs = TRUE,
  modality = NULL, weighting = NULL, threshold = NULL, ...)

## S3 method for class 'igraph'
make_brainGraph(x, atlas, type = c("observed",
  "random"), level = c("subject", "group", "contrast"),
  set.attrs = TRUE, modality = NULL, weighting = NULL,
  threshold = NULL, name = NULL, Group = NULL, subnet = NULL, ...)

## S3 method for class 'matrix'
make_brainGraph(x, atlas, type = c("observed",
  "random"), level = c("subject", "group", "contrast"),
  set.attrs = TRUE, modality = NULL, weighting = NULL,
  threshold = NULL, name = NULL, Group = NULL, subnet = NULL,
  mode = "undirected", weighted = NULL, diag = FALSE, ...)

## S3 method for class 'bg_mediate'
make_brainGraph(x, atlas = x$atlas,
  type = "observed", level = "contrast", set.attrs = FALSE,
  modality = NULL, weighting = NULL, threshold = NULL, ...)

is.brainGraph(x)

## S3 method for class 'brainGraph'
summary(object, print.attrs = c("all", "graph",
  "vertex", "edge", "none"), ...)

make_empty_brainGraph(atlas, type = c("observed", "random"),
  level = c("subject", "group", "contrast"), modality = NULL,
  weighting = NULL, threshold = NULL, name = NULL, Group = NULL,
  ...)

Arguments

x

An igraph graph object, numeric matrix, or bg_mediate object

atlas

Character string specifying the brain atlas

type

Character string indicating the type of graphs. Default: observed

level

Character string indicating whether the graphs are subject-, group-, or contrast-specific. Default: 'subject'

set.attrs

Logical indicating whether to assign all graph-, vertex-, and edge-level attributes (via set_brainGraph_attr). Default: TRUE

modality

Character string indicating imaging modality (e.g. 'dti'). Default: NULL

weighting

Character string indicating how the edges are weighted (e.g., 'fa', 'pearson', etc.). Default: NULL

threshold

Integer or number indicating the threshold used when “sparsifying” the connectivity matrix (if any). Default: NULL

...

Arguments passed to set_brainGraph_attr

name

Character string indicating subject ID or group/contrast name, depending on the level. Default: NULL

Group

Character string indicating group membership. Default: NULL

subnet

Integer or character vector indicating the vertices to keep, if you are interested in working with a subset of an atlas. By default, all vertices are used.

mode

Character string defining how the matrix should be interpreted. Default: 'undirected'

weighted

Logical specifying whether to create a weighted network

diag

Logical indicating whether to include the diagonal of the connectivity matrix. Default: FALSE

object

A brainGraph object

print.attrs

Character string indicating whether or not to list the object's attributes (default: all)

Value

A brainGraph graph object with additional graph-, vertex-, and edge-level attributes (see below).

The method for bg_mediate returns a brainGraph_mediate object, which has extra attributes:

Graph

mediator, treat, outcome, nobs

Vertex

b?.acme, p?.acme, b?.ade, p?.ade, b?.prop, p?.prop, b.tot, p.tot

make_empty_brainGraph – An empty brainGraph graph object

Graph-level attributes

Graph-level attributes added are:

version

The R, brainGraph, and igraph package versions used to create the graph

date

The creation date, from as.POSIXct

atlas

Character string denoting the brain atlas used

type

Character string specifying whether this is an observed or random graph

modality

The imaging modality; you can choose anything you like, but the summary.brainGraph knows about dti, fmri, thickness, area, and volume

weighting

What edge weights represent; you can choose anything you like, but summary.brainGraph knows about fa, sld (streamline density, tractography), pearson, spearman, kendall, and partial (partial correlation coefficient)

threshold

Numeric indicating the threshold used to create the final connectivity matrix (if any)

name

Character string specifying the study ID or group/contrast name, depending on the level argument

Group

Character string specifying the experimental group that the given subject belongs to, or if it is a group-level graph

subnet

Integer vector, if subnet was specified in the call

Vertex attributes

Vertex-level attributes added are:

name

The names of the brain regions in the network

lobe

The names of the major brain lobes for each vertex

hemi

The names of the hemisphere for each vertex (either 'L', 'R', or 'B')

lobe.hemi

The lobe-hemisphere combination (represented as an integer vector)

class

The tissue class (if applicable)

network

The network (if the atlas is dosenbach160)

x,y,z

The spatial coordinates of the (centers-of-mass) brain regions in MNI space

x.mni,y.mni,z.mni

Same as above

color.lobe,color.class,color.network

Colors for vertices of their respective membership

circle.layout

Integer vector indicating the order (going counter-clockwise from the top) for circular layouts

Edge attributes

Edge-level attributes added are:

color.lobe,color.class,color.network

Correspond to the vertex attribute of the same name. Inter-group edges will be colored gray

Specifying a subnetwork

You can create a graph for a subset of an atlas's regions with the subnet argument. This can either be a numeric or character vector. If the input object (either a matrix or an igraph graph) has fewer rows/columns or vertices, respectively, than the atlas then the subnet graph attribute will also be added to the return object. This may occur if, for example, you use make_auc_brainGraph on graphs that were initially created from subnetworks.

See Also

Other Graph creation functions: Creating_Graphs_GLM, brainGraphList, make_ego_brainGraph

Examples

## Not run: 
bg <- make_brainGraph(A, 'dkt', modality='dti', weighting='fa',
  mode='undirected', diag=FALSE, weighted=TRUE)

## End(Not run)

[Package brainGraph version 3.1.0 Index]