-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Fix and improve the utilities for PyG #234
Conversation
`kneighbors_graph(X=dist_mat, ...)` is wrong since `X` may not be a distance matrix. This leads to wrong results which may be similar to correct ones.
for more information, see https://pre-commit.ci
I've made some changes to the CI/CD in #244 which I expect will resolve the test failures here |
It looks like we're running into an issue when it comes to collating the distance matrices into a batch. I suppose we have three options:
Do you have any strong opinions? |
That's a good question. I'll try it and let you know. |
Hi, @a-r-j! From my perspective, (1) is much better than (2) but (3) is the best. I would not serialize distance matrices for several reasons:
What do you think about it? |
Very good points @anton-bushuiev. I am not sure about not supporting it all. While distance matrices are easy to compute, we can still run into scenarios where there are matrix features we may want to include (e.g. Hbond map). Thus, I propose:
|
I agree with the first two points but I am not sure about sparse format. Working with protein graphs, distance matrices are always dense because physical laws allow only zeros on diagonals. That's why I think simple reshaping would be the best:
Do I miss the scenarios when they may be sparse? What is Hbond map (can you please send some link to its usage in Graphein)? |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the contribution!
Kudos, SonarCloud Quality Gate passed! |
Hi @anton-bushuiev, Your commit for "Improve graphein/graphein/ml/conversion.py Line 307 in b308a58
|
Reference Issues/PRs
No Reference Issues/PRs
What does this implement/fix? Explain your changes
This PR fixes the bugs related to the processing of PyG data.
graphein.ml.conversion.convert_nx_to_pyg
data.coords
tensor with an extra dimension becausecoords
is also a “graph-level feature”.torch.Tensor
s. Makes further usage much more easier and a resulting data object much more PyG-like.graphein.ml.visualisation.plot_pyg_data
plotly_protein_structure_graph
. Currently, it lacks the positional value fornode_size_feature
and the order of the following arguments is completely broken.coords
processing to the change number 2 inconvert_nx_to_pyg
.What testing did you do to verify the changes in this PR?
Pull Request Checklist
./CHANGELOG.md
file (if applicable)./graphein/tests/*
directories (if applicable)./notebooks/
(if applicable)python -m py.test tests/
and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g.,python -m py.test tests/protein/test_graphs.py
)black .
andisort .