influentialThe influential package contains several functions that could be categorized into four groups according to their purpose:
influential network nodesTwo functions have been obtained from the igraph package for the reconstruction of networks.
In the data frame the first and second columns should be composed of source and target nodes.
A sample appropriate data frame is brought below:
| lncRNA | Coexpressed.Gene |
|---|---|
| ADAMTS9-AS2 | A2M |
| ADAMTS9-AS2 | ABCA6 |
| ADAMTS9-AS2 | ABCA8 |
| ADAMTS9-AS2 | ABCA9 |
| ADAMTS9-AS2 | ABI3BP |
| ADAMTS9-AS2 | AC093110.3 |
This is a co-expression dataset obtained from PMID: 31211495.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(d=MyData) # Reconstructing the graphIf you look at the class of My_graph you should see that it has an igraph class:
A sample appropriate data frame is brought below:
| ADAMTS9-AS2 | C8orf34-AS1 | CADM3-AS1 | FAM83A-AS1 | FENDRR | LANCL1-AS1 | LINC00092 | LINC00467 | LINC00857 | LINC00891 | |
|---|---|---|---|---|---|---|---|---|---|---|
| ADAMTS9-AS2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
| C8orf34-AS1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| CADM3-AS1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| FAM83A-AS1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| FENDRR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| LANCL1-AS1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
MyData <- coexpression.adjacency # Preparing the data
My_graph <- graph_from_adjacency_matrix(MyData) # Reconstructing the graphNetwork vertices (nodes) are required in order to calculate their centrality measures. Thus, before calculation of network centrality measures we need to obtain the name of required network vertices. To this end, we use the V function, which is obtained from the igraph package. However, you may provide a character vector of the name of your desired nodes manually.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
My_graph_vertices <- V(My_graph) # Extracting the verticesDegree centrality is the most commonly used local centrality measure which could be calculated via the degree function obtained from the igraph package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
My_graph_degree <- degree(My_graph, v = GraphVertices, normalized = FALSE) # Calculating degree centralityDegree centrality could be also calculated for directed graphs via specifying the mode parameter.
Betweenness centrality, like degree centrality, is one of the most commonly used centrality measures but is representative of the global centrality of a node. This centrality metric could also be calculated using a function obtained from the igraph package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
My_graph_betweenness <- betweenness(My_graph, v = GraphVertices, # Calculating betweenness centrality
directed = FALSE, normalized = FALSE)Betweenness centrality could be also calculated for directed and/or weighted graphs via specifying the directed and weights parameters, respectively.
Neighborhood connectivity is one of the other important centrality measures that reflect the semi-local centrality of a node. This centrality measure was first represented in a Science paper in 2002 and is for the first time calculable in R environment via the influential package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
neighrhood.co <- neighborhood.connectivity(graph = My_graph, # Calculating neighborhood connectivity
vertices = GraphVertices,
mode = "all")Neighborhood connectivity could be also calculated for directed graphs via specifying the mode parameter.
H-index is H-index is another semi-local centrality measure that was inspired from its application in assessing the impact of researchers and is for the first time calculable in R environment via the influential package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
h.index <- h_index(graph = My_graph, # Calculating H-index
vertices = GraphVertices,
mode = "all")H-index could be also calculated for directed graphs via specifying the mode parameter.
Local H-index (LH-index) is a semi-local centrality measure and an improved version of H-index centrality that leverages the H-index to the second order neighbors of a node and is for the first time calculable in R environment via the influential package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
lh.index <- lh_index(graph = My_graph, # Calculating Local H-index
vertices = GraphVertices,
mode = "all")Local H-index could be also calculated for directed graphs via specifying the mode parameter.
Collective Influence (CI) is a global centrality measure that calculates the product of the reduced degree (degree - 1) of a node and the total reduced degree of all nodes at a distance d from the node. This centrality measure is for the first time provided in an R package.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
ci <- collective.influence(graph = My_graph, # Calculating Collective Influence
vertices = GraphVertices,
mode = "all", d=3)Collective Influence could be also calculated for directed graphs via specifying the mode parameter.
ClusterRank is a local centrality measure that makes a connection between local and semi-local characteristics of a node and at the same time removes the negative effects of local clustering.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
cr <- clusterrank(graph = My_graph, # Calculating ClusterRank
vids = GraphVertices,
directed = FALSE, loops = TRUE)ClusterRank could be also calculated for directed graphs via specifying the directed parameter.
The function cond.prob.analysis assesses the conditional probability of deviation of two centrality measures (or any other two continuous variables) from their corresponding means in opposite directions.
MyData <- centrality.measures # Preparing the data
My.conditional.prob <- cond.prob.analysis(data = MyData, # Assessing the conditional probability
nodes.colname = rownames(MyData),
Desired.colname = "BC",
Condition.colname = "NC")
print(My.conditional.prob)
#> $ConditionalProbability
#> [1] 51.61871
#>
#> $ConditionalProbability_split.half.sample
#> [1] 51.33333The function double.cent.assess could be used to automatically assess both the distribution mode of centrality measures (two continuous variables) and the nature of their association. The analyses done through this formula are as follows:
mgcv package MyData <- centrality.measures # Preparing the data
My.metrics.assessment <- double.cent.assess(data = MyData, # Association assessment
nodes.colname = rownames(MyData),
dependent.colname = "BC",
independent.colname = "NC")
print(My.metrics.assessment)
#> $Summary_statistics
#> BC NC
#> Min. 0.000000000 1.2000
#> 1st Qu. 0.000000000 66.0000
#> Median 0.000000000 156.0000
#> Mean 0.005813357 132.3443
#> 3rd Qu. 0.000340000 179.3214
#> Max. 0.529464720 192.0000
#>
#> $Normality_results
#> p.value
#> BC 1.415450e-50
#> NC 9.411737e-30
#>
#> $Dependent_Normality
#> [1] "Non-normally distributed"
#>
#> $Independent_Normality
#> [1] "Non-normally distributed"
#>
#> $GAM_nonlinear.nonmonotonic.results
#> edf p-value
#> 8.992406 0.000000
#>
#> $Association_type
#> [1] "nonlinear-nonmonotonic"
#>
#> $HoeffdingD_Statistic
#> D_statistic P_value
#> Results 0.01770279 1e-08
#>
#> $Dependence_Significance
#> Hoeffding
#> Results Significantly dependent
#>
#> $NNS_dep_results
#> Correlation Dependence
#> Results -0.7948106 0.8647164
#>
#> $ConditionalProbability
#> [1] 55.35386
#>
#> $ConditionalProbability_split.half.sample
#> [1] 55.90331Note: It should also be noted that as a single regression line does not fit all models with a certain degree of freedom, based on the size and correlation mode of the variables provided, this function might return an error due to incapability of running step 2. In this case, you may follow each step manually or as an alternative run the other function named double.cent.assess.noRegression which does not perform any regression test and consequently it is not required to determine the dependent and independent variables.
The function double.cent.assess.noRegression could be used to automatically assess both the distribution mode of centrality measures (two continuous variables) and the nature of their association. The analyses done through this formula are as follows:
centrality2 variable is considered as the condition variable and the other (centrality1) as the desired one.MyData <- centrality.measures # Preparing the data
My.metrics.assessment <- double.cent.assess.noRegression(data = MyData, # Association assessment
nodes.colname = rownames(MyData),
centrality1.colname = "BC",
centrality2.colname = "NC")
print(My.metrics.assessment)
#> $Summary_statistics
#> BC NC
#> Min. 0.000000000 1.2000
#> 1st Qu. 0.000000000 66.0000
#> Median 0.000000000 156.0000
#> Mean 0.005813357 132.3443
#> 3rd Qu. 0.000340000 179.3214
#> Max. 0.529464720 192.0000
#>
#> $Normality_results
#> p.value
#> BC 1.415450e-50
#> NC 9.411737e-30
#>
#> $Centrality1_Normality
#> [1] "Non-normally distributed"
#>
#> $Centrality2_Normality
#> [1] "Non-normally distributed"
#>
#> $HoeffdingD_Statistic
#> D_statistic P_value
#> Results 0.01770279 1e-08
#>
#> $Dependence_Significance
#> Hoeffding
#> Results Significantly dependent
#>
#> $NNS_dep_results
#> Correlation Dependence
#> Results -0.7948106 0.8647164
#>
#> $ConditionalProbability
#> [1] 55.35386
#>
#> $ConditionalProbability_split.half.sample
#> [1] 55.68163influential network nodesIVI : IVI is the first integrative method for the identification of network most influential nodes in a way that captures all network topological dimensions. The IVI formula integrates the most important local (i.e. degree centrality and ClusterRank), semi-local (i.e. neighborhood connectivity and local H-index) and global (i.e. betweenness centrality and collective influence) centrality measures in such a way that both synergize their effects and remove their biases.
MyData <- centrality.measures # Preparing the data
My.vertices.IVI <- ivi.from.indices(DC = centrality.measures$DC, # Calculation of IVI
CR = centrality.measures$CR,
NC = centrality.measures$NC,
LH_index = centrality.measures$LH_index,
BC = centrality.measures$BC,
CI = centrality.measures$CI)MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
My.vertices.IVI <- ivi(graph = My_graph, vertices = GraphVertices, # Calculation of IVI
weights = NULL, directed = FALSE, mode = "all",
loops = TRUE, d = 3, scaled = TRUE)IVI could be also calculated for directed and/or weighted graphs via specifying the directed, mode, and weights parameters.
Spreading score : spreading.score is an integrative score made up of four different centrality measures including ClusterRank, neighborhood connectivity, betweenness centrality, and collective influence. Also, Spreading score reflects the spreading potential of each node within a network and is one of the major components of the IVI.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
Spreading.score <- spreading.score(graph = My_graph, # Calculation of Spreading score
vertices = GraphVertices,
weights = NULL, directed = FALSE, mode = "all",
loops = TRUE, d = 3, scaled = TRUE)Spreading score could be also calculated for directed and/or weighted graphs via specifying the directed, mode, and weights parameters.
Hubness score : hubness.score is an integrative score made up of two different centrality measures including degree centrality and local H-index. Also, Hubness score reflects the power of each node in its surrounding environment and is one of the major components of the IVI.
MyData <- coexpression.data # Preparing the data
My_graph <- graph_from_data_frame(MyData) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
Hubness.score <- hubness.score(graph = My_graph, # Calculation of Hubness score
vertices = GraphVertices,
directed = FALSE, mode = "all",
loops = TRUE, scaled = TRUE)Spreading score could be also calculated for directed graphs via specifying the directed and mode parameters.
SIRIR modelSIRIR : SIRIR is is achieved by the integration susceptible-infected-recovered (SIR) model with the leave-one-out cross validation technique and ranks network nodes based on their true universal influence. One of the applications of this function is the assessment of performance of a novel algorithm in identification of network influential nodes.
set.seed(1234)
My_graph <- igraph::sample_gnp(n=50, p=0.05) # Reconstructing the graph
GraphVertices <- V(My_graph) # Extracting the vertices
Influence.Ranks <- sirir(graph = My_graph, # Calculation of influence rank
vertices = GraphVertices,
beta = 0.5, gamma = 1, no.sim = 10, seed = 1234)
knitr::kable(Influence.Ranks[c(order(Influence.Ranks$rank)[1:10]),])| difference.value | rank | |
|---|---|---|
| 6 | 9.0 | 1 |
| 1 | 8.9 | 2 |
| 2 | 8.9 | 2 |
| 8 | 8.9 | 2 |
| 10 | 8.7 | 5 |
| 24 | 8.7 | 5 |
| 18 | 8.6 | 7 |
| 19 | 8.6 | 7 |
| 20 | 8.6 | 7 |
| 21 | 8.6 | 7 |