From b0deaea07e8086e81a6010cda5528df615ae2967 Mon Sep 17 00:00:00 2001 From: padix-key Date: Fri, 28 Feb 2020 10:47:04 +0100 Subject: [PATCH 1/2] Added comment --- src/biotite/structure/graphics/atoms.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/biotite/structure/graphics/atoms.py b/src/biotite/structure/graphics/atoms.py index 2ed199764..240906f73 100644 --- a/src/biotite/structure/graphics/atoms.py +++ b/src/biotite/structure/graphics/atoms.py @@ -49,24 +49,32 @@ def plot_atoms(axes, atoms, colors, line_width=1.0, background_color=None): raise ValueError("The given axes mut be an 'Axes3D'") if atoms.bonds is None: raise ValueError("The atom array must have an associated bond list") - + + # Calculating connections between atoms line_coord = [] line_colors = [] for index1, index2 in atoms.bonds.as_array()[:,:2]: + # Every connection consist of two lines: + # One from the first atom to the center + # and from from the second atom to the center line_start = atoms.coord[index1] line_end = atoms.coord[index2] line_center = (line_start + line_end) / 2 + # Add line from first atom line_coord.append(( - line_start, line_center + line_start, line_center )) line_colors.append(colors[index1]) + # Add line from second atom line_coord.append(( - line_end, line_center + line_end, line_center )) line_colors.append(colors[index2]) + # Plot computed line coordinates and colors + # Use 'Line3DCollection' for higher efficiency lines = Line3DCollection( line_coord, color=line_colors, linewidths=line_width ) From 0c5aed2893e1ffa478b973d6c3a7bad5f27d451d Mon Sep 17 00:00:00 2001 From: padix-key Date: Fri, 28 Feb 2020 12:50:00 +0100 Subject: [PATCH 2/2] Fix for Msgpack 1.0 --- src/biotite/structure/info/atoms.py | 2 +- src/biotite/structure/info/bonds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biotite/structure/info/atoms.py b/src/biotite/structure/info/atoms.py index a626bd4bf..4b8109db7 100644 --- a/src/biotite/structure/info/atoms.py +++ b/src/biotite/structure/info/atoms.py @@ -28,7 +28,7 @@ def _init_dataset(): # Database is already initialized return - # Residuue data is taken from + # Residue data is taken from # ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif # (2019/01/27) _info_dir = dirname(realpath(__file__)) diff --git a/src/biotite/structure/info/bonds.py b/src/biotite/structure/info/bonds.py index 6718bc543..e2ebb3115 100644 --- a/src/biotite/structure/info/bonds.py +++ b/src/biotite/structure/info/bonds.py @@ -32,7 +32,7 @@ def _init_dataset(): _info_dir = dirname(realpath(__file__)) with open(join(_info_dir, "intra_bonds.msgpack"), "rb") as file: _intra_bonds_raw = msgpack.unpack( - file, use_list=False, raw=False + file, use_list=False, raw=False, strict_map_key=False ) _intra_bonds = {} for group, group_bonds_raw in _intra_bonds_raw.items():