This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Vertices name in steinertree [R]

Hello all,

Can anyone tell me how to retain the name of vertices in steinertree package (R)? Below is the code I used. The final object SP (igraph object) is the one that is showing node names as 1,2,3..

    library(igraph)
    library(SteinerNet)

    a <- read.table("interactions.txt", sep="\t", quote="")
    head(a)
                   V1
    1 ENSP00000222390
    2 ENSP00000391826
    3 ENSP00000222390
    4 ENSP00000391669
    5 ENSP00000222390
    6 ENSP00000384675

    el <- matrix(as.vector(a$V1), nc=2, byrow=T) 

    g1 =graph_from_edgelist(el, directed=F)

    ter_list= c("ENSP00000306512","ENSP00000340019","ENSP00000361125","ENSP00000367207","ENSP00000384273","ENSP00000388107","ENSP00000400175","ENSP00000401303")
    SP=steinertree(type ="SP",terminals = ter_list, graph = g1)

SP
[[1]]
IGRAPH 6a21ce1 UN-- 139 1600 -- 
+ attr: name (v/c), realname (v/c), color (v/c)
+ edges from 6a21ce1 (vertex names):
 [1] 1 --2  1 --3  1 --4  1 --5  1 --6  1 --7  1 --8  1 --9  1 --10 1 --11
[11] 1 --12 1 --13 1 --14 1 --15 1 --16 1 --17 1 --18 1 --19 1 --20 1 --21
[21] 1 --22 1 --23 1 --24 1 --25 1 --26 1 --27 1 --28 1 --29 1 --30 1 --31
[31] 1 --32 1 --33 34--35 34--36 34--37 34--38 9 --34 34--39 20--34 34--40
[41] 25--34 27--34 34--41 34--42 34--43 34--44 35--45 45--46 45--47 45--48
[51] 38--45 45--49 39--45 40--45 45--50 30--51 3 --30 4 --30 30--52 30--53
[61] 30--54 5 --30 30--48 30--55 8 --30 30--56 9 --30 10--30 30--57 11--30
[71] 15--30 30--58 20--30 21--30 30--59 25--30 30--60 27--30 28--30 3 --61
+ ... omitted several edges

[[2]]
IGRAPH 886b59f UN-- 12 11 -- 
+ attr: name (v/c), realname (v/c), color (v/c)
+ edges from 886b59f (vertex names):
 [1] 5 --8  5 --19 5 --21 5 --50 35--50 5 --51 21--53 5 --61 8 --69 53--73
[11] 5 --84

Please help me out. Thank you for the effort :)

gene ppi graph

0 answers

No answers yet.

Log in to answer this question.