a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
1.02k stars 131 forks source link

Consistent conversion to undirected graphs #301

Closed anton-bushuiev closed 1 year ago

anton-bushuiev commented 1 year ago

Reference Issues/PRs

What does this implement/fix? Explain your changes

I faced an unexpected behaviour constructing k-NN graph and converting it to PyG. After the k-NN construction, the underlying nx graph is undirected (not DiGraph). It means that if u and v are mutually nearest neighbors, I still get only one edge (e.g. (u, v)). Then, after conversion to PyG this only results in one edge, which is not what is expected since in PyG all edges are directed. So, in this PR I added the symmetrization. Probably, this is also needed for DGL (not familiar with the framework) or other formats.

What testing did you do to verify the changes in this PR?

Conversion test passes. I get an undirected graph for my case.

Pull Request Checklist

anton-bushuiev commented 1 year ago

@a-r-j BTW Can I be added to the contributors?

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 40.12% and project coverage change: +3.72 :tada:

Comparison is base (8123f42) 40.27% compared to head (908c10e) 43.99%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #301 +/- ## ========================================== + Coverage 40.27% 43.99% +3.72% ========================================== Files 48 113 +65 Lines 2811 7739 +4928 ========================================== + Hits 1132 3405 +2273 - Misses 1679 4334 +2655 ``` | [Impacted Files](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb) | Coverage Δ | | |---|---|---| | [graphein/ml/datasets/foldcomp\_dataset.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vbWwvZGF0YXNldHMvZm9sZGNvbXBfZGF0YXNldC5weQ==) | `0.00% <0.00%> (ø)` | | | [graphein/ml/diffusion.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vbWwvZGlmZnVzaW9uLnB5) | `0.00% <0.00%> (ø)` | | | [graphein/ml/metrics/\_\_init\_\_.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vbWwvbWV0cmljcy9fX2luaXRfXy5weQ==) | `0.00% <0.00%> (ø)` | | | [graphein/ml/metrics/gdt.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vbWwvbWV0cmljcy9nZHQucHk=) | `0.00% <0.00%> (ø)` | | | [graphein/ml/metrics/tm\_score.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vbWwvbWV0cmljcy90bV9zY29yZS5weQ==) | `0.00% <0.00%> (ø)` | | | [graphein/ppi/graph\_metadata.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHBpL2dyYXBoX21ldGFkYXRhLnB5) | `0.00% <0.00%> (ø)` | | | [graphein/ppi/visualisation.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHBpL3Zpc3VhbGlzYXRpb24ucHk=) | `0.00% <0.00%> (ø)` | | | [graphein/protein/analysis.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHJvdGVpbi9hbmFseXNpcy5weQ==) | `0.00% <0.00%> (ø)` | | | [graphein/protein/features/utils.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHJvdGVpbi9mZWF0dXJlcy91dGlscy5weQ==) | `27.77% <0.00%> (ø)` | | | [graphein/protein/folding\_utils.py](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHJvdGVpbi9mb2xkaW5nX3V0aWxzLnB5) | `0.00% <0.00%> (ø)` | | | ... and [95 more](https://codecov.io/gh/a-r-j/graphein/pull/301?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

a-r-j commented 1 year ago

@a-r-j BTW Can I be added to the contributors?

Yes, of course! Do feel free to add yourself :)

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information