Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing compatibility with python3 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions drugui/druggability.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def pickler(filename, obj=None, **kwargs):
obj.workdir = fileloc

obj.set_logger(**kwargs)
if obj.__dict__.has_key('name'):
if 'name' in obj.__dict__:
obj.logger.info('{0:s} has been reloaded.'.format(obj.name))
else:
print('{0:s} has been unpickled.'.format(filename))
Expand Down Expand Up @@ -1827,7 +1827,10 @@ def identify_hotspots(self, **kwargs):
raise ProbeError('No hotspots found with binding free energy '
'below {0:.f} kcal/mol (~{0:.0f} folds '
'enrichment)'.format(delta_g, enrichment))
spots = zip(-probes.grid.array[which], which[0], which[1], which[2])
if sys.version_info[0] == 3:
spots = zip(-probes.grid.array[tuple(which)], which[0], which[1], which[2])
else:
spots = zip(-probes.grid.array[which], which[0], which[1], which[2])
spots = sorted(spots)
spots = np.array(spots)
radii = np.array([probe.radius for probe in self._probes])
Expand Down Expand Up @@ -2308,7 +2311,11 @@ def evaluate_ligand(self, filename, **kwargs):
ilists[2].append(index[2]-k)
ilists[2].append(index[2]+k)

spots = zip(-self._all.grid.array[ilists], ilists[0], ilists[1], ilists[2])
if sys.version_info[0] == 3:
spots = zip(-self._all.grid.array[tuple(ilists)], ilists[0], ilists[1], ilists[2])
else:
spots = zip(-self._all.grid.array[ilists], ilists[0], ilists[1], ilists[2])

spots = sorted(spots)
spots = np.array(spots)
spots = spots[spots[:, 0] < -population, :]
Expand Down