Skip to content

Commit

Permalink
Vector bugfix #148 (#149)
Browse files Browse the repository at this point in the history
* bugfix to distance edge func #146

* bugfix to distance edge func #146

* bugfix for c-beta vectors not handling altlocs

* update changelog
  • Loading branch information
a-r-j authored Mar 29, 2022
1 parent 4352f2e commit b458f41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* [Feature] - #144 adds support for chord diagram visualisations.
* [Feature] - #144 adds support for automagically downloading new PDB files for obsolete structures.
* [Misc] - #144 makes visualisation functions accessible in the `graphein.protein` namespace. #138
* [Bugfix] - #147 fixes error in `add_distance_threshold` introduced in v1.2.1 that would prevent the edges being added to the graph. [#146](https://github.com/a-r-j/graphein/issues/146)
* [Bugfix] - #147 fixes error in `add_distance_threshold` introduced in v1.2.1 that would prevent the edges being added to the graph. [#146](https://github.com/a-r-j/graphein/issues/146)
* [Bugfix] - #149 fixes a bug in `add_beta_carbon_vector` that would cause coordinates to be extracted for multiple positions if the residue has an altloc. Resolves [#148](https://github.com/a-r-j/graphein/issues/148)

### 1.2.1 - 16/3/21

Expand Down
5 changes: 4 additions & 1 deletion graphein/protein/features/nodes/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def add_beta_carbon_vector(
:param reverse: Reverse vector. Defaults to ``False``.
:type reverse: bool
"""
# Get or compute R-Group DF
if "rgroup_df" not in g.graph.keys():
g.graph["rgroup_df"] = compute_rgroup_dataframe(g.graph["raw_pdb_df"])

c_beta_coords = filter_dataframe(
g.graph["raw_pdb_df"], "atom_name", ["CB"], boolean=True
g.graph["rgroup_df"], "atom_name", ["CB"], boolean=True
)
c_beta_coords.index = c_beta_coords["node_id"]

Expand Down
8 changes: 8 additions & 0 deletions tests/protein/nodes/features/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def test_add_beta_carbon_vector():
np.testing.assert_almost_equal(
cb_true, d["coords"] + d["c_beta_vector"]
)
# Test altloc handling
g = construct_graph(config=config, pdb_code="6rew")
for n, d in g.nodes(data=True):
assert d["c_beta_vector"].shape == (3,)

g = construct_graph(config=config, pdb_code="7w9w")
for n, d in g.nodes(data=True):
assert d["c_beta_vector"].shape == (3,)


def test_add_sidechain_vector():
Expand Down

0 comments on commit b458f41

Please sign in to comment.