calculateModuleScore: Calculate Module-score

Description Usage Arguments Value References Examples

View source: R/calculateModuleScore.R

Description

Calculate Module-score

Usage

1
2
calculateModuleScore(graph, nodes, data, phenotype, covars = NULL,
  representative.method = "average", scoringFunction = linearScoring)

Arguments

graph

an igraph object, which can be generated with generateNetwork. The ID of the nodes must correspond to the name of the variables.

nodes

a vector containing the ID of the nodes contained in the module

data

a data.table with three columns: name, sampleID and z-score.

phenotype

a vector with the values for a phenotype of interest. It must have the same number of observations as in data.

covars

a data.table containing the covariates. The rows for the observations must be in the same order as in the phenotype vector.

representative.method

the method, that is used for the calculation of the eigenmetabolites. Currently implemented: "eigenmetabolite" and "average"

scoringFunction

a scoring function accepting parameters moduleRepresentatives, phenotype and covars. See linearScoring

Value

a list containing the module score and the regression coefficient

References

\insertRef

Do2017MoDentify

\insertRef

Chuang2007MoDentify

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(qmdiab.data)
data(qmdiab.annos)
data(qmdiab.phenos)

net.graph <- generateNetwork(data = qmdiab.data, annotations = qmdiab.annos)

data <- data.table(
  sampleID = paste0("sample", 1:dim(qmdiab.data)[1]),
  qmdiab.data
)
data <- melt(data = data, id.vars = "sampleID", variable.name = "name")
data[, z.score := scale(value), by = .(name)]

module.nodes <- c(3, neighbors(net.graph, 3))

module.score <- calculateModuleScore(
  graph = net.graph, nodes = module.nodes,
  data = data, phenotype = qmdiab.phenos$T2D
)

krumsiek/MoDentify documentation built on March 25, 2021, 8:32 a.m.