Skip to content
Snippets Groups Projects
Commit b75e9781 authored by tobias's avatar tobias
Browse files

msms: attach also SESA to each atom for calculating surface area


git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2128 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent e0dffbd9
No related branches found
No related tags found
No related merge requests found
...@@ -59,14 +59,15 @@ def _SetupFiles(entity, selection): ...@@ -59,14 +59,15 @@ def _SetupFiles(entity, selection):
tmp_file_handle.close() tmp_file_handle.close()
return (tmp_dir_name, tmp_file_name) return (tmp_dir_name, tmp_file_name)
## \brief Reads Area file (-af) and attach sasa and sesa per atom to an entitiy ## \brief Reads Area file (-af) and attach sasa and sesa per atom to an entitiy
# #
# \param entity EntityHandle or EntityView for attaching sasa and sesa on atom level # \param entity EntityHandle or EntityView for attaching sasa and sesa on atom level
# \param file Filename of area file # \param file Filename of area file
# \param property Name of the float property # \param asa_prop Name of the float property for SASA
# \param esa_prop Name of the float property for SESA
# \exception RuntimeError if number of atoms in file != number of atoms in entity # \exception RuntimeError if number of atoms in file != number of atoms in entity
def _ParseAreaFile(entity,file, asa_prop, esa_prop):
def _ParseAreaFile(entity,file, property):
area_fh = open(file) area_fh = open(file)
area_lines = area_fh.readlines() area_lines = area_fh.readlines()
area_fh.close() area_fh.close()
...@@ -76,8 +77,11 @@ def _ParseAreaFile(entity,file, property): ...@@ -76,8 +77,11 @@ def _ParseAreaFile(entity,file, property):
raise RuntimeError, "Atom count (%d) unequeal to number of atoms in area file (%d)" % (entity.GetAtomCount(), len(area_lines)) raise RuntimeError, "Atom count (%d) unequeal to number of atoms in area file (%d)" % (entity.GetAtomCount(), len(area_lines))
for l in area_lines: for l in area_lines:
atom_no, sesa, sasa = l.split() atom_no, sesa, sasa = l.split()
a = entity.atoms[int(atom_no)] a = entity.atoms[int(atom_no)]
a.SetFloatProp(property, float(sasa)) if asa_prop:
a.SetFloatProp(asa_prop, float(sasa))
if esa_prop:
a.SetFloatProp(esa_prop, float(sesa))
## \brief Method which recursively deletes a directory ## \brief Method which recursively deletes a directory
...@@ -126,11 +130,13 @@ def _RunMSMS(command): ...@@ -126,11 +130,13 @@ def _RunMSMS(command):
# \param msms_exe msms executable (full path to executable) # \param msms_exe msms executable (full path to executable)
# \param msms_env msms environment variable # \param msms_env msms environment variable
# \param keep_files Do not delete temporary files # \param keep_files Do not delete temporary files
# \param attach_asa Attaches per atom SASA to specified FloatProp at atom level
# \param attach_esa Attaches per atom SESA to specified FloatProp at atom level
# \return Touplet of lists for (SES, SAS) # \return Touplet of lists for (SES, SAS)
def CalculateSurfaceArea(entity, density=1.0, radius=1.5, all_surf=False, def CalculateSurfaceArea(entity, density=1.0, radius=1.5, all_surf=False,
no_hydrogens=False, selection="", no_hydrogens=False, selection="",
msms_exe=None, msms_env=None, keep_files=False, msms_exe=None, msms_env=None, keep_files=False,
attach_asa = None): attach_asa=None, attach_esa=None):
import re import re
# check if msms executable is specified # check if msms executable is specified
...@@ -155,7 +161,8 @@ def CalculateSurfaceArea(entity, density=1.0, radius=1.5, all_surf=False, ...@@ -155,7 +161,8 @@ def CalculateSurfaceArea(entity, density=1.0, radius=1.5, all_surf=False,
# add sesa and asa to entity if attach_asa is specified # add sesa and asa to entity if attach_asa is specified
if attach_asa != None: if attach_asa != None:
_ParseAreaFile(entity, os.path.join(msms_data_dir, "asa_atom.area"), attach_asa) _ParseAreaFile(entity, os.path.join(msms_data_dir, "asa_atom.area"),
attach_asa, attach_esa)
# parse MSMS output # parse MSMS output
msms_ases=[] msms_ases=[]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment