-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Can't plot adjacency matrix of subgraph #177
Comments
Hi @cimranm will check this out for you on the weekend. Could you true using |
Figured it out, typo here: graphein/graphein/protein/subgraphs.py Line 70 in 0a2d5e3
should be |
Hey @a-r-j , yep I figured the same thing but was waiting to hear back from you -- I actually modified Anyway, thanks for the fix :) |
@a-r-j another issue is when the subgraph is plotted, the node labels are assigned to the x and y axes randomly (but the actual distance matrix cols / rows are plotted in sequence order). At the moment i've fixed this using the following:
Hope that makes sense! |
Good spot. Seems like the start of a solution, but I think your solution breaks down with multichain proteins, no? |
@a-r-j yep you're right, shall I give it a go and submit a pull request? On another note, do you think it would be appropriate to allow other options for ordering the axes..? At the moment i'm trying to visualise a protein motif with the adjacency matrix and was thinking of ordering by distance from the central node (i.e. central node AA is the first; then AAs are in ascending order of euclidean distance). Would it make sense to have a feature within the |
Yep, go ahead with a PR. Happy to review & support :) That's an interesting use case you've described. I think it would be a good addition. The plot functions accept a distance matrix (separately from a graph) which I anticipated could be used for this sort of thing. However, if this is something that would be really useful for you it's probably useful for others and so we should support it. |
Hiya,
I’m away at the moment but I’ll check this out for you in next few days.
In the meantime could you true using filter_dataframe=True and maybe update_coords=True too?
Sent from mobile
… On 5 Jun 2022, at 15:55, Cam ***@***.***> wrote:
Hi there,
Just getting started with Graphein and so far it's awesome, the docs are very helpful too -- my issue is with trying to plot a subgraph from a protein graph g.
Not sure if I'm doing something wrong, but I cannot plot the subgraph s_g using the adjacency matrix. I get the following error from plotly:
ValueError: The length of the y vector must match the length of the first dimension of the img matrix.
It seems to be the fact that my subgraph has 7 nodes, but the adjacency matrix still has all 760 nodes from the original protein.
Not sure why this is the case since I am using the recompute_distmat option?
My code:
k = 3
s_g = extract_k_hop_subgraph(g, central_node=phos_site, k=k, recompute_distmat=True)
print(s_g) # 7 nodes
print(s_g.graph['dist_mat']) # all original 760 nodes?
fig = plot_distance_matrix(s_g) # this line gives the error
fig.write_html("visual.html")
Thanks in advance, and apologies if i'm missing something.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
|
Hi there,
Just getting started with Graphein and so far it's awesome, the docs are very helpful too -- my issue is with trying to plot a subgraph from a protein graph
g
.Not sure if I'm doing something wrong, but I cannot plot the subgraph
s_g
using the adjacency matrix. I get the following error from plotly:It seems to be the fact that my subgraph has 7 nodes, but the adjacency matrix still has all 760 nodes from the original protein.
Not sure why this is the case since I am using the
recompute_distmat
option?My code:
Thanks in advance, and apologies if i'm missing something.
The text was updated successfully, but these errors were encountered: