8.2 Individual nodes

Here we illustrate how to calculate attackness for each node in the 50-gene subnetwork (see subg above). Independent of previous steps, this subnetwork (subg) can be also imported from subnetwork_node_info.txt and subnetwork_edge_info.txt; see below.

library(tidyverse)
library(igraph)
RData.location <- "http://galahad.well.ox.ac.uk/Myocarditis"
## ig: 50-gene subnetwork
df_nodes <- str_c(RData.location, '/subnetwork_node_info.txt') %>% read_delim(delim="\t") %>% select(name, description)
df_edges <- str_c(RData.location, '/subnetwork_edge_info.txt') %>% read_delim(delim="\t")
subg <- igraph::graph_from_data_frame(d=df_edges, directed=F, vertices=df_nodes)

## attackness for each node
df_nodes %>% pull(name) %>% utils::combn(1,simplify=F) -> combine
attackness <- CombAttack(subg, combine)

## append 'attackness' to df_nodes
df_nodes %>% inner_join(attackness %>% transmute(name=nodes.removed, attackness=frac.disconnected), by='name') %>% arrange(desc(attackness)) -> df_nodes

The results are stored in a tibble called df_nodes, a data frame with three columns name, description and attackness (sorted in a descending order).

df_nodes
## # A tibble: 50 x 3
##    name     description                                               attackness
##    <chr>    <chr>                                                          <dbl>
##  1 Traf2    TNF receptor-associated factor 2                                0.5 
##  2 Nfkb1    nuclear factor of kappa light polypeptide gene enhancer …       0.42
##  3 Ccl5     chemokine (C-C motif) ligand 5                                  0.18
##  4 Rac1     Rac family small GTPase 1                                       0.14
##  5 Vav1     vav 1 oncogene                                                  0.06
##  6 Vcam1    vascular cell adhesion molecule 1                               0.06
##  7 Ncf1     neutrophil cytosolic factor 1                                   0.04
##  8 Tnfrsf1b tumor necrosis factor receptor superfamily, member 1b           0.04
##  9 Lck      lymphocyte protein tyrosine kinase                              0.04
## 10 Gsdmd    gasdermin D                                                     0.04
## # … with 40 more rows