OpenStructure
Loading...
Searching...
No Matches
Functions
ost.bindings.naccess Namespace Reference

Functions

 _GetExecutable (naccess_exe)
 
 _CheckNaccessRoot (naccess_root)
 
 _SetupFiles (entity, selection, scratch_dir, max_number_of_atoms)
 
 _ParseAsaFile (entity, file, asa_atom)
 
 _ParseRsaFile (entity, file, asa_abs, asa_rel)
 
 _RunACCALL (command, temp_dir, query)
 
 _RunNACCESS (command, temp_dir)
 
 CalculateSurfaceArea (entity, radius=1.4, include_hydrogens=False, include_hetatm=False, include_water=False, selection="", naccess_exe=None, naccess_root=None, keep_files=False, asa_abs="asaAbs", asa_rel="asaRel", asa_atom="asaAtom", scratch_dir=None, max_number_of_atoms=50000)
 

Detailed Description

Naccess module

Author: Florian Kiefer, Gerardo Tauriello (cleanup/speedup)

This module is for calculating surface areas
from OpenStructure using the external program naccess

How To Use This Module:
 1. Import it (e.g. as "from ost.bindings import naccess")
 2. Use it (e.g. as "sasa = naccess.CalculateSurfaceArea(entity)")

Requirement:
 - naccess installed

Function Documentation

◆ _CheckNaccessRoot()

_CheckNaccessRoot (   naccess_root)
protected
:return: True, if given directory contains "accall" binary and files
         "vdw.radii" and "standard.data".
:param naccess_root: Path to naccess folder to check.

Definition at line 33 of file naccess.py.

◆ _GetExecutable()

_GetExecutable (   naccess_exe)
protected
Method to check if naccess executable is present

:param naccess:   Explicit path to naccess executable
:returns:         Path to the executable
:exception:       FileNotFound if executable is not found

Definition at line 23 of file naccess.py.

◆ _ParseAsaFile()

_ParseAsaFile (   entity,
  file,
  asa_atom 
)
protected
Reads Area file (.asa) and attach asa per atom to an entitiy

:param entity:   EntityHandle or EntityView for attaching sasa on atom level
:param file:     Filename of area file
:param asa_atom: Name of the float property for SASA

Definition at line 88 of file naccess.py.

◆ _ParseRsaFile()

_ParseRsaFile (   entity,
  file,
  asa_abs,
  asa_rel 
)
protected
Reads Area file (.rsa) and attach asa (absolute + relative) per residue to an entitiy

:param entity:     EntityHandle or EntityView for attaching sasa on atom level
:param file:       Filename of .rsa file
:param asa_atom:   Name of the float property for absolute SASA
:param asa_atom:   Name of the float property for relative SASA
:exception:        RuntimeError if residue names are not the same

Definition at line 127 of file naccess.py.

◆ _RunACCALL()

_RunACCALL (   command,
  temp_dir,
  query 
)
protected
Fast method to run the Naccess surface calculation.

This method starts the accall binary directly and pipes in the input provided
in *query*. This is faster than calling the "naccess" script since the script
has a constant overhead of roughly 1.3s in each call.

:param command:  Command to execute
:param temp_dir: Command is executed with this working directory
:param query:    User input to pipe into *command*
:returns:        stdout of command
:exception:      CalledProcessError for non-zero return value

Definition at line 179 of file naccess.py.

◆ _RunNACCESS()

_RunNACCESS (   command,
  temp_dir 
)
protected
Method to run the Naccess surface calculation.

This method starts the external Naccess executable and returns the stdout.

:param command:  Command to execute
:param temp_dir: Command is executed with this working directory
:returns:        stdout of command
:exception:      CalledProcessError for non-zero return value

Definition at line 207 of file naccess.py.

◆ _SetupFiles()

_SetupFiles (   entity,
  selection,
  scratch_dir,
  max_number_of_atoms 
)
protected
Setup files for naccess calculation in temporary directory

:param entity:              OST entity to calculate surface
:param selection:           Calculate surface for subset of entity
:param scratch_dir:         Scratch directory. A subfolder for temporary files
                            is created in there. If not specified, a default
                            directory is used (see :func:`tempfile.mkdtemp`).
:param max_number_of_atoms: Max Number of atoms in the entity (i.e. is limited
                            in the default NACCESS version to 50 000)
:returns: Tuple containing temporary directory, input filename for naccess and
          directory of the input file
:exception: RuntimeError if selection is not valid or too many atoms

Definition at line 48 of file naccess.py.

◆ CalculateSurfaceArea()

CalculateSurfaceArea (   entity,
  radius = 1.4,
  include_hydrogens = False,
  include_hetatm = False,
  include_water = False,
  selection = "",
  naccess_exe = None,
  naccess_root = None,
  keep_files = False,
  asa_abs = "asaAbs",
  asa_rel = "asaRel",
  asa_atom = "asaAtom",
  scratch_dir = None,
  max_number_of_atoms = 50000 
)
Calculates analytical the solvent accessible surface area by using the
external naccess program

This method calculates the molecular surface areas by invoking the external
program naccess. First, it is checked if the naccess executable is present, then,
the necessary files are prepared in a temporary directory and naccess is
executed. The last step is to remove the temporary directory.


:param entity:              OST entity to calculate surface
:param radius:              Surface probe radius
:param include_hydrogens:   Calculate surface including hydrogens
:param include_hetatm:      Calculate surface including hetatms
:param include_water:       Calculate surface including water
:param selection:           Calculate surface for subset of entity
:param naccess_exe:         naccess executable (full path to executable)
:param naccess_root:        Path to folder containing "accall" binary and
                            files "vdw.radii" and "standard.data". This is the
                            fastest way to call naccess!
:param keep_files:          If True, do not delete temporary files
:param asa_abs:             Attaches per residue absolute SASA to specified
                            FloatProp on residue level
:param asa_rel:             Attaches per residue relative SASA to specified
                            FloatProp on residue level
:param asa_atom:            Attaches per atom SASA to specified FloatProp at
                            atom level
:param scratch_dir:         Scratch directory. A subfolder for temporary files
                            is created in there. If not specified, a default
                            directory is used (see :func:`tempfile.mkdtemp`).
:param max_number_of_atoms: Max Number of atoms in the entity (i.e. is limited
                            in the default NACCESS version to 50 000)

:returns:                   absolute SASA calculated using asa_atom

Definition at line 230 of file naccess.py.