FreeSASA  1.1
Open source SASA calculations
View on GitHub
Data Structures | Functions | Variables
freesasa Namespace Reference

FreeSASA Python interface. More...

Data Structures

class  Classifier
 Assigns class and radius to atom by residue and atom name. More...
 
class  Parameters
 Stores parameter values to be used by calculation. More...
 
class  Result
 Stores results from SASA calculation. More...
 
class  Structure
 Represents a protein structure, including its atomic radii. More...
 

Functions

def structureArray
 Create array of structures from PDB file. More...
 
def calc
 Calculate SASA of Structure. More...
 
def classifyResults
 Break SASA result down into classes. More...
 
def selectArea (commands, structure, result)
 Sum SASA result over a selection of atoms. More...
 
def setVerbosity (verbosity)
 Set global verbosity. More...
 
def getVerbosity ()
 Get global verbosity. More...
 
def structureFromBioPDB
 Create a freesasa structure from a Bio.PDB structure. More...
 
def calcBioPDB
 Calc SASA from Bio.PDB structure. More...
 

Variables

string ShrakeRupley = 'ShrakeRupley'
 Used to specify the algorithm by Shrake & Rupley.
 
string LeeRichards = 'LeeRichards'
 Used to specify the algorithm by Lee & Richards.
 
string polar = 'Polar'
 Used for classification.
 
string apolar = 'Apolar'
 Used for classification.
 
 silent = FREESASA_V_SILENT
 int: Suppress all warnings and errors (used by setVerbosity())
 
 nowarnings = FREESASA_V_NOWARNINGS
 int: Suppress all warnings but not errors (used by setVerbosity())
 
 normal = FREESASA_V_NORMAL
 int: Normal verbosity (used by setVerbosity())
 
 debug = FREESASA_V_DEBUG
 int: Print debug messages (used by setVerbosity())
 
dictionary defaultParameters
 The default values for calculation parameters. More...
 
dictionary defaultStructureArrayOptions
 Default options for structureArray. More...
 

Detailed Description

FreeSASA Python interface.

Author
Simon Mitternacht

A minimal program would be something like

1 structure = freesasa.Structure("1abc.pdb")
2 result = freesasa.calc(structure)
3 print "SASA = %f" % result.totalArea()

See documentation of the classes and functions for how to customize behavior

Function Documentation

def freesasa.structureArray (   fileName,
  options = defaultStructureArrayOptions,
  classifier = None 
)

Create array of structures from PDB file.

Split PDB file into several structures by either by treating chains separately, by treating each MODEL as a separate structure, or both.

Parameters
fileName(str) The PDB file.
options(dict) Specification for how to read the PDB-file (see def value for options).
classifierClassifier to assign atoms radii, default is used if none specified.
Exceptions
AssertionErrorif fileName is None
AssertionErrorif an option value is not recognized
AssertionErrorif neither of the options 'separate-chains' and 'separate-models' are specified.
IOErrorif can't open file
Exceptionif there are problems parsing the input
Returns
An array of Structures

Definition at line 551 of file freesasa.pyx.

def freesasa.calc (   structure,
  parameters = None 
)

Calculate SASA of Structure.

Parameters
structureStructure to be used
parametersParameters to use (if not specified defaults are used)
Returns
A Result object
Exceptions
Exceptionsomething went wrong in calculation (see C library error messages)

Definition at line 581 of file freesasa.pyx.

def freesasa.classifyResults (   result,
  structure,
  classifier = None 
)

Break SASA result down into classes.

Parameters
resultResult from sasa calculation.
structureStructure used in calculation.
classifierClassifier (if not specified default is used).
Returns
Dictionary with names of classes as keys and their SASA values as values.
Exceptions
ExceptionProblems with classification, see C library error messages (or Python exceptions if run with derived classifier).

Definition at line 599 of file freesasa.pyx.

def freesasa.selectArea (   commands,
  structure,
  result 
)

Sum SASA result over a selection of atoms.

Parameters
commandsA list of commands with selections using Pymol syntax, e.g. "s1, resn ala+arg" or "s2, chain A and resi 1-5" (see Selection syntax).
structureA Structure.
resultResult from sasa calculation on structure.
Returns
Dictionary with names of selections ("s1","s2",...) as keys, and the corresponding SASA values as values.
Exceptions
ExceptionParser failed (typically syntax error), see library error messages.

Definition at line 620 of file freesasa.pyx.

def freesasa.setVerbosity (   verbosity)

Set global verbosity.

Parameters
verbosityCan have values freesasa.silent, freesasa.nowarnings or freesasa.normal
Exceptions
AssertionErrorif verbosity has illegal value

Definition at line 639 of file freesasa.pyx.

def freesasa.getVerbosity ( )

Get global verbosity.

Returns
Verbosity (freesasa.silent, freesasa.nowarnings or freesasa.normal)

Definition at line 646 of file freesasa.pyx.

def freesasa.structureFromBioPDB (   bioPDBStructure,
  classifier = None,
  options = Structure.defaultOptions 
)

Create a freesasa structure from a Bio.PDB structure.

Remarks
Experimental, not thorougly tested yet
Parameters
bioPDBStructurea Bio.PDB structure
classifieran optional classifier to specify atomic radii
optionsOptions supported are 'hetatm', 'skip-unknown' and 'halt-at-unknown'
Returns
a freesasa.Structure
Exceptions
Exceptionif option 'halt-at-unknown' is selected and unknown atoms are encountered. Passes on exceptions from Structure.addAtom() and Structure.setRadiiWithClassifier().

Definition at line 662 of file freesasa.pyx.

def freesasa.calcBioPDB (   bioPDBStructure,
  parameters = Parameters(),
  classifier = None,
  options = Structure.defaultOptions 
)

Calc SASA from Bio.PDB structure.

Usage

result, sasa_classes = calcBioPDB(structure, ...)  
Remarks
Experimental, not thorougly tested yet
Parameters
bioPDBStructureA Bio.PDB structure
parametersA freesasa.Paremeters object
classifierA freesasa.Classifier object
optionsOptions supported are 'hetatm', 'skip-unknown' and 'halt-at-unknown'
Returns
A freesasa.Result object and a dictionary with classes defined by the classifier and associated areas
Exceptions
Exceptionif unknown atom is encountered and the option 'halt-at-unknown' is active. Passes on exceptions from calc(), classifyResults() and structureFromBioPDB().

Definition at line 712 of file freesasa.pyx.

Variable Documentation

dictionary freesasa.defaultParameters
Initial value:
1 = {
2  'algorithm' : LeeRichards,
3  'probe-radius' : freesasa_default_parameters.probe_radius,
4  'n-points' : freesasa_default_parameters.shrake_rupley_n_points,
5  'n-slices' : freesasa_default_parameters.lee_richards_n_slices,
6  'n-threads' : freesasa_default_parameters.n_threads
7 }

The default values for calculation parameters.

Definition at line 48 of file freesasa.pyx.

dictionary freesasa.defaultStructureArrayOptions
Initial value:
1 = {
2  'hetatm' : False,
3  'hydrogen' : False,
4  'separate-chains' : True,
5  'separate-models' : False
6 }

Default options for structureArray.

Defined separately for Doxygen's sake.

Definition at line 524 of file freesasa.pyx.