a-r-j / graphein

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

not all ELEMENTX-ELEMENTY bonds are present in BOND_ORDERS lookup dictionary #82

Closed EyalRozenberg1 closed 2 years ago

EyalRozenberg1 commented 2 years ago

BOND_ORDERS includes only part of all optional bonds. e.g S-S is not present but indeed optional. Thus, at line 223 in graphein.protein.edges.atomic.identify_bond_type_from_mapping the following allowable_order = BOND_ORDERS[query] fails.

I assume the solution should be in graphein.protein.edges.atomic.add_bond_order (line 188), as follows:

            try:
                identify_bond_type_from_mapping(G, u, v, a, query)
            except:
                query = f"{atom_b}-{atom_a}"
                try:
                    identify_bond_type_from_mapping(G, u, v, a, query)
                except:
                    G.edges[u, v]["kind"].add("SINGLE")
a-r-j commented 2 years ago

Hi @EyalRozenberg1 Thanks for the bug reports - I appreciate it! I've added fixes to this PR (#83) - would you mind scoping them out when you've got a chance? I'll merge & reupload to PyPI ASAP :)

80 Should be fixed in the repo already, but I don't think it's reflected in the version on PyPI

EyalRozenberg1 commented 2 years ago

Looks good @a-r-j . Keep up the good work! Thanks