a-r-j / graphein

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

Modify graphs.py to handle insertions when ` {'insertions': True}` #223

Closed manonreau closed 1 year ago

manonreau commented 1 year ago

Reference Issues/PRs

The centroid coordinates of protein graphs contain NaN values when the PDB file contains at least one insertion and when {'insertions': True} is provided to ProteinGraphConfig

What does this implement/fix? Explain your changes

Adding the insertion identifier in the node_id and in the centroid atom grouping function solves the problem

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

Graph creation for 1i7z. ex: before modifications: ['A:ASP:1', 'A:LEU:2', 'A:PRO:95', 'A:TRP:96', ...] G.coords #=> contains NaNs after modifications:before modifications: ['A:ASP:1', 'A:LEU:2', 'A:PRO:95', 'A:TRP:96', ...] G.coords #=> no NaN

Pull Request Checklist

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
1.1% 1.1% Duplication

codecov-commenter commented 1 year ago

Codecov Report

Base: 40.27% // Head: 47.93% // Increases project coverage by +7.66% :tada:

Coverage data is based on head (2693ecd) compared to base (8123f42). Patch coverage: 52.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #223 +/- ## ========================================== + Coverage 40.27% 47.93% +7.66% ========================================== Files 48 85 +37 Lines 2811 5411 +2600 ========================================== + Hits 1132 2594 +1462 - Misses 1679 2817 +1138 ``` | [Impacted Files](https://codecov.io/gh/a-r-j/graphein/pull/223?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb) | Coverage Δ | | |---|---|---| | [graphein/ml/diffusion.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?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/ppi/graph\_metadata.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?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/223/diff?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/223/diff?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/sequence/utils.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcHJvdGVpbi9mZWF0dXJlcy9zZXF1ZW5jZS91dGlscy5weQ==) | `28.00% <0.00%> (+3.00%)` | :arrow_up: | | [graphein/protein/features/utils.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?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/rna/subgraphs.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcm5hL3N1YmdyYXBocy5weQ==) | `83.87% <ø> (ø)` | | | [graphein/rna/utils.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcm5hL3V0aWxzLnB5) | `38.46% <ø> (ø)` | | | [graphein/rna/visualisation.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vcm5hL3Zpc3VhbGlzYXRpb24ucHk=) | `28.57% <ø> (+28.57%)` | :arrow_up: | | [graphein/utils/config.py](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Arian+Jamasb#diff-Z3JhcGhlaW4vdXRpbHMvY29uZmlnLnB5) | `100.00% <ø> (+100.00%)` | :arrow_up: | | ... and [81 more](https://codecov.io/gh/a-r-j/graphein/pull/223/diff?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 at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.