Functions

calc(structure[, parameters])

Calculate SASA of Structure

calcBioPDB(bioPDBStructure[, parameters, ...])

Calc SASA from BioPython PDB structure.

calcCoord(coord, radii[, parameters])

Calculate SASA for a set of coordinates and radii

classifyResults(result, structure[, classifier])

Break SASA result down into classes.

getVerbosity()

Get global verbosity

selectArea(commands, structure, result)

Sum SASA result over a selection of atoms

setVerbosity(verbosity)

Set global verbosity

freesasa.calc(structure, parameters=None)

Calculate SASA of Structure

Parameters:
  • structureStructure to be used

  • parametersParameters to use (if not specified defaults are used)

Returns:

The results

Return type:

Result

Raises:

Exception – something went wrong in calculation (see C library error messages)

freesasa.calcBioPDB(bioPDBStructure, parameters=<freesasa.Parameters object>, classifier=None, options={'halt-at-unknown': False, 'hetatm': False, 'hydrogen': False, 'join-models': False, 'skip-unknown': False})

Calc SASA from BioPython PDB structure.

Usage:

result, sasa_classes, residue_areas = calcBioPDB(structure, ...)

Experimental, not thorougly tested yet

Parameters:
  • bioPDBStructure – A Bio.PDB structure

  • parameters – A Parameters object (uses default if none specified)

  • classifier – A Classifier object (uses default if none specified)

  • options (dict) – Options supported are ‘hetatm’, ‘skip-unknown’ and ‘halt-at-unknown’ (uses Structure.defaultOptions if none specified

Returns:

A Result object, a dictionary with classes defined by the classifier and associated areas, and a dictionary of the type returned by Result.residueAreas().

Raises:

Exception – if unknown atom is encountered and the option ‘halt-at-unknown’ is active. Passes on exceptions from calc(), classifyResults() and structureFromBioPDB().

freesasa.calcCoord(coord, radii, parameters=None)

Calculate SASA for a set of coordinates and radii

Parameters:
  • coord (list) – array of size 3*N with atomic coordinates (x1, y1, z1, x2, y2, z2, …, x_N, y_N, z_N).

  • radii (list) – array of size N with atomic radii (r_1, r_2, …, r_N).

  • parametersParameters to use (if not specified, defaults are used)

Raises:
  • AssertionError – mismatched array-sizes

  • Exception – Out of memory

  • Exception – something went wrong in calculation (see C library error messages)

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

Break SASA result down into classes.

Parameters:
  • resultResult from SASA calculation.

  • structureStructure used in calculation.

  • classifierClassifier to use (if not specified default is used).

Returns:

Dictionary with names of classes as keys and their SASA values as values.

Return type:

dict

Raises:

Exception – Problems with classification, see C library error messages (or Python exceptions if run with derived classifier).

freesasa.getVerbosity()

Get global verbosity

Returns:

Verbosity silent, nowarnings or normal

Return type:

int

freesasa.setVerbosity(verbosity)

Set global verbosity

Parameters:

verbosity (int) – Can have values silent, nowarnings or normal

Raises:

AssertionError – if verbosity has illegal value

freesasa.selectArea(commands, structure, result)

Sum SASA result over a selection of atoms

Parameters:
  • commands (list) – A list of commands with selections using Pymol syntax, e.g. "s1, resn ala+arg" or "s2, chain A and resi 1-5". See select-syntax.

  • structure – A Structure.

  • resultResult from sasa calculation on structure.

Returns:

Dictionary with names of selections ("s1", "s2", …) as keys, and the corresponding SASA values as values.

Return type:

dict

Raises:

Exception – Parser failed (typically syntax error), see library error messages.

freesasa.structureArray(fileName, options={'hetatm': False, 'hydrogen': False, 'separate-chains': True, 'separate-models': False}, 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 Structure.defaultStructureArrayOptions for options and default value).

  • classifierClassifier to assign atoms radii, default is used if none specified.

Returns:

An array of Structure

Return type:

list

Raises:
  • AssertionError – if fileName is None

  • AssertionError – if an option value is not recognized

  • AssertionError – if neither of the options ‘separate-chains’ and ‘separate-models’ are specified.

  • IOError – if can’t open file

  • Exception – if there are problems parsing the input

freesasa.structureFromBioPDB(bioPDBStructure, classifier=None, options={'halt-at-unknown': False, 'hetatm': False, 'hydrogen': False, 'join-models': False, 'skip-unknown': False})

Create a freesasa structure from a Bio.PDB structure

Experimental, not thorougly tested yet. Structures generated this way will not preserve whitespace in residue numbers, etc, as in Structure.

Parameters:
  • bioPDBStructure – a Bio.PDB structure

  • classifier – an optional Classifier to specify atomic radii

  • options (dict) – Options supported are ‘hetatm’, ‘skip-unknown’ and ‘halt-at-unknown’

Returns:

The structure

Return type:

Structure

Raises:

Exception – if option ‘halt-at-unknown’ is selected and unknown atoms are encountered. Passes on exceptions from Structure.addAtom() and Structure.setRadiiWithClassifier().