From 56fcbf076cb24712050765088edabc3ef56bcf02 Mon Sep 17 00:00:00 2001 From: karolamik13 Date: Wed, 18 Dec 2024 09:38:42 +0100 Subject: [PATCH] PY3K for getChannelAtoms (CaviFinder) --- prody/proteins/channels.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/prody/proteins/channels.py b/prody/proteins/channels.py index c4e00e5d2..eba7b73af 100644 --- a/prody/proteins/channels.py +++ b/prody/proteins/channels.py @@ -377,6 +377,7 @@ def showCavities(surface, show_surface=False): vis.run() vis.destroy_window() + def calcChannels(atoms, output_path=None, separate=False, r1=3, r2=1.25, min_depth=10, bottleneck=1, sparsity=15): """ Computes and identifies channels within a molecular structure using Voronoi and Delaunay tessellations. @@ -637,6 +638,7 @@ def calcChannelsMultipleFrames(atoms, trajectory=None, output_path=None, separat return channels_all, surfaces_all + def getChannelParameters(channels): """ Extracts and returns the lengths, bottlenecks, and volumes of each channel in a given list of channels. @@ -667,6 +669,7 @@ def getChannelParameters(channels): return lengths, bottlenecks, volumes + def getChannelAtoms(channels, protein=None, num_samples=5): """ Generates an AtomGroup object representing the atoms along the paths of the given channels @@ -698,7 +701,12 @@ def getChannelAtoms(channels, protein=None, num_samples=5): Example usage: atomic_structure = getChannelAtoms(channels, protein) """ - import io + + if PY3K: + import io + else: + import StringIO as io + from prody import parsePDBStream, writePDBStream def convert_lines_to_atomic(atom_lines): @@ -742,6 +750,7 @@ def convert_lines_to_atomic(atom_lines): channels_atomic = convert_lines_to_atomic(pdb_lines) return channels_atomic + class Channel: def __init__(self, tetrahedra, centerline_spline, radius_spline, length, bottleneck, volume): self.tetrahedra = tetrahedra