FreeSASA  2.0.2
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...


def structureArray
 Create array of structures from PDB file. More...
def calc
 Calculate SASA of Structure. More...
def calcCoord
 Calculate SASA for a set of coordinates and radii. 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...


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.
 int: Suppress all warnings and errors (used by setVerbosity())
 int: Suppress all warnings but not errors (used by setVerbosity())
 int: Normal verbosity (used by setVerbosity())
 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.

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.

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.
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
An array of Structures

Definition at line 585 of file freesasa.pyx.

def freesasa.calc (   structure,
  parameters = None 

Calculate SASA of Structure.

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

Definition at line 615 of file freesasa.pyx.

def freesasa.calcCoord (   coord,
  parameters = None 

Calculate SASA for a set of coordinates and radii.

coordlist of size 3*N with atomic coordinates (x1, y1, z1, x2, y2, z2, ..., x_N, y_N, z_N'.
radiiarray of size N with atomic radii (r_1, r_2, ..., r_N)
Parametersto use (if not specified, defaults are used)
AssertionErrormismatched array-sizes
ExceptionOut of memory
Exceptionsomething went wrong in calculation (see C library error messages)

Definition at line 634 of file freesasa.pyx.

def freesasa.classifyResults (   result,
  classifier = None 

Break SASA result down into classes.

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

Definition at line 668 of file freesasa.pyx.

def freesasa.selectArea (   commands,

Sum SASA result over a selection of atoms.

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.
Dictionary with names of selections ("s1","s2",...) as keys, and the corresponding SASA values as values.
ExceptionParser failed (typically syntax error), see library error messages.

Definition at line 689 of file freesasa.pyx.

def freesasa.setVerbosity (   verbosity)

Set global verbosity.

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

Definition at line 707 of file freesasa.pyx.

def freesasa.getVerbosity ( )

Get global verbosity.

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

Definition at line 714 of file freesasa.pyx.

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

Create a freesasa structure from a Bio.PDB structure.

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

Definition at line 730 of file freesasa.pyx.

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

Calc SASA from Bio.PDB structure.


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

Definition at line 780 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 50 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 558 of file freesasa.pyx.