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

NaN coordinates when granularity: centroids and on small residue graphs #219

Closed
manonreau opened this issue Oct 18, 2022 · 0 comments · Fixed by #220
Closed

NaN coordinates when granularity: centroids and on small residue graphs #219

manonreau opened this issue Oct 18, 2022 · 0 comments · Fixed by #220

Comments

@manonreau
Copy link
Contributor

Describe the bug
Some graphs have NaN coordinates.
This has been particularly observed for graphs missing aromatic residues WHEN aromatic interactions are listed in the edge_construction_functions, and when "granularity": "centroids"

Different reasons have been identified:

  • some edges distance and angles are computed on empty dataframes
  • The centroid is computed as the mean coordinates of atoms.groupby("residue_number"). The chain ID and the residue type should be added to the groupby to avoir considering atoms from different residues.

To Reproduce

from graphein.protein.graphs import construct_graph
from graphein.protein.config import ProteinGraphConfig
from graphein.protein.edges.distance import (add_peptide_bonds,
                                             add_hydrogen_bond_interactions,
                                             add_disulfide_interactions,
                                             add_ionic_interactions,
                                             add_aromatic_interactions,
                                             add_aromatic_sulphur_interactions,
                                             add_cation_pi_interactions,
                                             add_distance_threshold
                                            )


new_edge_funcs = {"edge_construction_functions": [add_peptide_bonds,
                                                  add_aromatic_interactions,
                                                  add_hydrogen_bond_interactions,
                                                  add_disulfide_interactions,
                                                  add_ionic_interactions,
                                                  add_aromatic_sulphur_interactions,
                                                  add_cation_pi_interactions,
                                                  partial(add_distance_threshold, long_interaction_threshold=2, threshold=20.)]}

params_to_change = {"granularity": "centroids"}
config = ProteinGraphConfig(**new_edge_funcs, **params_to_change)

pocket_name = 'xxxx.pdb'
g = construct_graph(config=config, pdb_path=pocket_name)

Expected behavior
Several checks should be added to ensure the correct computation of centroids coordinates when no atoms nor residues are missing.

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