Skip to content

Commit

Permalink
add try/except for atomic peptide bonds
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-j committed Jan 29, 2023
1 parent e861145 commit c9dde87
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions graphein/protein/edges/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ def add_sequence_distance_edges(
(n, v) for n, v in G.nodes(data=True) if v["chain_id"] == chain_id
]

# Subset to only N and C atoms in the case of full-atom
# peptide bond addition
try:
if (
G.graph["config"].granularity == "atom"
and name == "peptide_bond"
):
chain_residues = [
(n, v)
for n, v in chain_residues
if v["atom_type"] in {"N", "C"}
]
# If we don't don't find a config, assume it's a residue graph
# This is brittle
except KeyError:
continue

# Iterate over every residue in chain
for i, residue in enumerate(chain_residues):
try:
Expand Down

0 comments on commit c9dde87

Please sign in to comment.