In [6]:
df <- read.table("shared/pathway_commons.sif",
                sep="\t",
                quote="",
                comment.char="",
                stringsAsFactors=FALSE,
                header=FALSE,
                col.names=c("species1","interaction_type","species2"))

In [19]:
library(igraph)

interaction_types_ppi <- c("interacts-with",
                           "in-complex-with",
                           "neighbor-of")

interaction_types_metab <- c("controls-production-of",
                             "consumption-controlled-by",
                             "controls-production-of",
                             "controls-transport-of-chemical")

interaction_types_ppd <- c("catalysis-precedes",
                           "controls-phosphorylation-of",
                           "controls-state-change-of",
                           "controls-transport-of",
                           "controls-expression-of")


IGRAPH UN-- 17020 523498 -- 
+ attr: name (v/c), interaction_type (e/c)

In [31]:
graph_ppi <- graph_from_data_frame(df[df$interaction_type %in% interaction_types_ppi,c(1,3,2)],
                         directed=FALSE)
print(graph_ppi)


IGRAPH UN-- 17020 523498 -- 
+ attr: name (v/c), interaction_type (e/c)
+ edges (vertex names):
 [1] A1BG--ABCC6   A1BG--ANXA7   A1BG--CDKN1A  A1BG--CRISP3  A1BG--GDPD1  
 [6] A1BG--GRB2    A1BG--GRB7    A1BG--HNF4A   A1BG--ONECUT1 A1BG--PIK3CA 
[11] A1BG--PIK3R1  A1BG--PRDX4   A1BG--PTPN11  A1BG--SETD7   A1BG--SMN1   
[16] A1BG--SMN2    A1BG--SNCA    A1BG--SOS1    A1BG--TK1     A1CF--ACBD3  
[21] A1CF--ACLY    A1CF--APOBEC1 A1CF--APOBEC1 A1CF--ATF2    A1CF--CELF2  
[26] A1CF--CTNNB1  A1CF--E2F1    A1CF--E2F3    A1CF--E2F4    A1CF--FHL3   
[31] A1CF--HNF1A   A1CF--HNF4A   A1CF--JUN     A1CF--KAT5    A1CF--KHSRP  
[36] A1CF--MBD2    A1CF--MBD3    A1CF--NRF1    A1CF--RBL2    A1CF--REL    
+ ... omitted several edges

In [32]:
graph_metab <- graph_from_data_frame(df[df$interaction_type %in% interaction_types_metab, c(1,3,2)],
                             directed=TRUE)
print(graph_metab)


IGRAPH DN-- 7620 38145 -- 
+ attr: name (v/c), interaction_type (e/c)
+ edges (vertex names):
 [1] A4GALT->CHEBI:17659 A4GALT->CHEBI:17950 A4GALT->CHEBI:18307
 [4] A4GALT->CHEBI:18313 A4GALT->CHEBI:58223 A4GALT->CHEBI:67119
 [7] A4GNT ->CHEBI:17659 A4GNT ->CHEBI:58223 AAAS  ->CHEBI:1604 
[10] AAAS  ->CHEBI:2274  AACS  ->CHEBI:13705 AACS  ->CHEBI:15345
[13] AACS  ->CHEBI:17369 AACS  ->CHEBI:18361 AACS  ->CHEBI:29888
[16] AACS  ->CHEBI:57286 AACS  ->CHEBI:57287 AACS  ->CHEBI:57288
[19] AACS  ->CHEBI:57392 AACS  ->CHEBI:58280 AADAC ->CHEBI:17790
[22] AADAC ->CHEBI:40574 AADAC ->CHEBI:4743  AADAC ->CHEBI:85505
+ ... omitted several edges

In [30]:
graph_ppd <- graph_from_data_frame(df[df$interaction_type %in% interaction_types_ppd, c(1,3,2)],
                             directed=TRUE)
print(graph_ppd)


IGRAPH DN-- 16063 359713 -- 
+ attr: name (v/c), interaction_type (e/c)
IGRAPH DN-- 16063 359713 -- 
+ attr: name (v/c), interaction_type (e/c)
+ edges (vertex names):
 [1] A1BG  ->A2M      A1BG  ->AKT1     A1BG  ->AKT1     A2M   ->APOA1   
 [5] A2M   ->CDC42    A2M   ->RAC1     A2M   ->RAC2     A2M   ->RAC3    
 [9] A2M   ->RHOA     A2M   ->RHOBTB1  A2M   ->RHOBTB2  A2M   ->RHOB    
[13] A2M   ->RHOC     A2M   ->RHOD     A2M   ->RHOF     A2M   ->RHOG    
[17] A2M   ->RHOH     A2M   ->RHOJ     A2M   ->RHOQ     A2M   ->RHOT1   
[21] A2M   ->RHOT2    A2M   ->RHOU     A2M   ->RHOV     A4GALT->ABO     
[25] A4GALT->AK3      A4GALT->B3GALNT1 A4GALT->B3GALT1  A4GALT->B3GALT2 
[29] A4GALT->B3GALT4  A4GALT->B3GALT5  A4GALT->B3GALT6  A4GALT->B3GAT2  
+ ... omitted several edges

In [ ]: