Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetCentPlot error #21

Open
liyang24 opened this issue May 17, 2023 · 4 comments
Open

NetCentPlot error #21

liyang24 opened this issue May 17, 2023 · 4 comments
Assignees

Comments

@liyang24
Copy link

Hi! thanks for the jobs
I've got the object to build the network on

head(df.grn2)
tf gene weights
77 ATF4 GABARAPL1 0.8221601
85 ATF4 GRIK3 0.8021985
100 ATF4 KIT 0.8130254
102 ATF4 KRAS 0.8125377
166 ATF4 SEC22B 0.8518962
223 ATF6 ACAP3 0.8103851
V(netobj)$type <- ifelse(V(V(netobj)$type <- ifelse(V(netobj)$name %in% dfgrn$tf,"TF/Gene","Gene"))$name %in% df.grn2$tf,"TF/Gene","Gene")
netobj <- graph_from_data_frame(df.grn2,directed = TRUE)

Looking at the object, it looks normal

netobj
IGRAPH 54cba5f DN-B 355 788 --

  • attr: name (v/c), type (v/c), weights (e/n)
  • edges from 54cba5f (vertex names):
    [1] ATF4 ->GABARAPL1 ATF4 ->GRIK3 ATF4 ->KIT ATF4 ->KRAS
    [5] ATF4 ->SEC22B ATF6 ->ACAP3 BACH2->ALX1 BACH2->ANKH
    [9] BACH2->CDKN1C BACH2->CRISPLD1 BACH2->EBF2 BACH2->ETV6
    [13] BACH2->GLIPR1 BACH2->HECTD2 BACH2->IGFBP7 BACH2->ITGB8
  • ... omitted several edges
    However, when I run

p <- NetCentPlot(netobj, "RUNX1")
Error in layout_with_focus(graph, v = focus, weights = weights, iter = niter, :
g must be a connected graph.

I checked netobj

is_connected(netobj, mode = "weak")
[1] FALSE

I don't know how do I get the final NetCentPlot, Can you offer any help?
thanks a lot!

@lzj1769
Copy link
Member

lzj1769 commented May 17, 2023

Hi @liyang24

Are you able to generate the network plot?

The function NetCentPlot is going to plot the network but with different layout, so in theory, it should be working if you can generate the network plot.

@jsnagai Do you have any ideas?

@liyang24
Copy link
Author

Yes, I got the network plot,so i don't know what went wrong

@jsnagai
Copy link
Member

jsnagai commented Jun 1, 2023

@liyang24 sorry for the late reply, would it be possible for to you check the number of components that your graph has? On that you possibly can you is subset the connected component related to the TF/Target that you are selecting.

Best

@liyang24
Copy link
Author

liyang24 commented Jun 2, 2023

thanks!
I did what you said

tf_vertices <- c("RUNX1")
V(netobj)$type <- ifelse(1:vcount(netobj) %in% tf_vertices, "TF", "Gene")
cc <- components(netobj)
tf_cc <- induced_subgraph(netobj, which(cc$membership == cc$membership[tf_vertices[1]]))
p <- NetCentPlot(tf_cc,"RUNX1")

and I got this picture
image

What should I do if I want to display the TF name of the node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants