Calculate solvent accessible surface areas of proteins
Project description
.. currentmodule:: freesasa
Introduction
============
This package provides Python bindings for the `FreeSASA C Library
<https://github.com/mittinatten/freesasa>`_.
It can be installed using
.. code::
pip install freesasa
Binaries are available for Python 2.7, 3.4, 3.5 and 3.6 for Mac OS X
and Windows, in addition to the source distribution.
Basic calculations
------------------
Using defaults everywhere a simple calculation can be carried out as
follows (assuming the file ``1ubq.pdb`` is available)
.. code:: python
import freesasa
structure = freesasa.Structure("1ubq.pdb")
result = freesasa.calc(structure)
area_classes = freesasa.classifyResults(result, structure)
print "Total : %.2f A2" % result.totalArea()
for key in area_classes:
print key, ": %.2f A2" % area_classes[key]
Which would give the following output
.. code::
Total : 4804.06 A2
Polar : 2504.22 A2
Apolar : 2299.84 A2
The following does a high precision L&R calculation
.. code:: python
result = freesasa.calc(structure,
freesasa.Parameters({'algorithm' : freesasa.LeeRichards,
'n-slices' : 100}))
Using the results from a calculation we can also integrate SASA over a selection of
atoms, using a subset of the Pymol `selection syntax`_:
.. _selection syntax: http://freesasa.github.io/doxygen/Selection.html
.. code:: python
selections = freesasa.selectArea(('alanine, resn ala', 'r1_10, resi 1-10'),
structure, result)
for key in selections:
print key, ": %.2f A2" % selections[key]
which gives the output
.. code::
alanine : 120.08 A2
r1_10 : 634.31 A2
Customizing atom classification
-------------------------------
This uses the NACCESS parameters (the file ``naccess.config`` is
available in the ``share/`` directory of the repository).
.. code:: python
classifier = freesasa.Classifier("naccess.config")
structure = freesasa.Structure("1ubq.pdb", classifier)
result = freesasa.calc(structure)
area_classes = freesasa.classifyResults(result, structure, classifier)
Classification can be customized also by extending the :py:class:`.Classifier`
interface. The code below is an illustration of a classifier that
classes nitrogens separately, and assigns radii based on element only
(and crudely).
.. code:: python
import freesasa
import re
class DerivedClassifier(Classifier):
def classify(self, residueName, atomName):
if re.match('\s*N', atomName):
return 'Nitrogen'
return 'Not-nitrogen'
def radius(self, residueName, atomName):
if re.match('\s*N',atomName): # Nitrogen
return 1.6
if re.match('\s*C',atomName): # Carbon
return 1.7
if re.match('\s*O',atomName): # Oxygen
return 1.4
if re.match('\s*S',atomName): # Sulfur
return 1.8
return 0; # everything else (Hydrogen, etc)
classifier = DerivedClassifier()
# use the DerivedClassifier to calculate atom radii
structure = freesasa.Structure("1ubq.pdb", classifier)
result = freesasa.calc(structure)
# use the DerivedClassifier to classify atoms
area_classes = freesasa.classifyResults(result,structure,classifier)
Of course, this example is somewhat contrived, if we only want the
integrated area of nitrogen atoms, the simpler choice would be
.. code:: python
selection = freesasa.selectArea('nitrogen, symbol n', structure, result)
However, extending :py:class:`.Classifier`, as illustrated above, allows
classification to arbitrary complexity and also lets us redefine the
radii used in the calculation.
Bio.PDB
-------
FreeSASA can also calculate the SASA of a ``Bio.PDB`` structure from BioPython
.. code:: python
from Bio.PDB import PDBParser
parser = PDBParser()
structure = parser.get_structure("Ubiquitin", "1ubq.pdb")
result, sasa_classes = freesasa.calcBioPDB(structure)
If one needs more control over the analysis the structure can be
converted to a :py:class:`.Structure` using :py:func:`.structureFromBioPDB()`
and the calculation can be performed the normal way using this
structure.
Introduction
============
This package provides Python bindings for the `FreeSASA C Library
<https://github.com/mittinatten/freesasa>`_.
It can be installed using
.. code::
pip install freesasa
Binaries are available for Python 2.7, 3.4, 3.5 and 3.6 for Mac OS X
and Windows, in addition to the source distribution.
Basic calculations
------------------
Using defaults everywhere a simple calculation can be carried out as
follows (assuming the file ``1ubq.pdb`` is available)
.. code:: python
import freesasa
structure = freesasa.Structure("1ubq.pdb")
result = freesasa.calc(structure)
area_classes = freesasa.classifyResults(result, structure)
print "Total : %.2f A2" % result.totalArea()
for key in area_classes:
print key, ": %.2f A2" % area_classes[key]
Which would give the following output
.. code::
Total : 4804.06 A2
Polar : 2504.22 A2
Apolar : 2299.84 A2
The following does a high precision L&R calculation
.. code:: python
result = freesasa.calc(structure,
freesasa.Parameters({'algorithm' : freesasa.LeeRichards,
'n-slices' : 100}))
Using the results from a calculation we can also integrate SASA over a selection of
atoms, using a subset of the Pymol `selection syntax`_:
.. _selection syntax: http://freesasa.github.io/doxygen/Selection.html
.. code:: python
selections = freesasa.selectArea(('alanine, resn ala', 'r1_10, resi 1-10'),
structure, result)
for key in selections:
print key, ": %.2f A2" % selections[key]
which gives the output
.. code::
alanine : 120.08 A2
r1_10 : 634.31 A2
Customizing atom classification
-------------------------------
This uses the NACCESS parameters (the file ``naccess.config`` is
available in the ``share/`` directory of the repository).
.. code:: python
classifier = freesasa.Classifier("naccess.config")
structure = freesasa.Structure("1ubq.pdb", classifier)
result = freesasa.calc(structure)
area_classes = freesasa.classifyResults(result, structure, classifier)
Classification can be customized also by extending the :py:class:`.Classifier`
interface. The code below is an illustration of a classifier that
classes nitrogens separately, and assigns radii based on element only
(and crudely).
.. code:: python
import freesasa
import re
class DerivedClassifier(Classifier):
def classify(self, residueName, atomName):
if re.match('\s*N', atomName):
return 'Nitrogen'
return 'Not-nitrogen'
def radius(self, residueName, atomName):
if re.match('\s*N',atomName): # Nitrogen
return 1.6
if re.match('\s*C',atomName): # Carbon
return 1.7
if re.match('\s*O',atomName): # Oxygen
return 1.4
if re.match('\s*S',atomName): # Sulfur
return 1.8
return 0; # everything else (Hydrogen, etc)
classifier = DerivedClassifier()
# use the DerivedClassifier to calculate atom radii
structure = freesasa.Structure("1ubq.pdb", classifier)
result = freesasa.calc(structure)
# use the DerivedClassifier to classify atoms
area_classes = freesasa.classifyResults(result,structure,classifier)
Of course, this example is somewhat contrived, if we only want the
integrated area of nitrogen atoms, the simpler choice would be
.. code:: python
selection = freesasa.selectArea('nitrogen, symbol n', structure, result)
However, extending :py:class:`.Classifier`, as illustrated above, allows
classification to arbitrary complexity and also lets us redefine the
radii used in the calculation.
Bio.PDB
-------
FreeSASA can also calculate the SASA of a ``Bio.PDB`` structure from BioPython
.. code:: python
from Bio.PDB import PDBParser
parser = PDBParser()
structure = parser.get_structure("Ubiquitin", "1ubq.pdb")
result, sasa_classes = freesasa.calcBioPDB(structure)
If one needs more control over the analysis the structure can be
converted to a :py:class:`.Structure` using :py:func:`.structureFromBioPDB()`
and the calculation can be performed the normal way using this
structure.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
freesasa-2.0.3.tar.gz
(177.8 kB
view hashes)
Built Distributions
freesasa-2.0.3-py3.6-linux-x86_64.egg
(487.9 kB
view hashes)
freesasa-2.0.3-py3.5-linux-x86_64.egg
(469.6 kB
view hashes)
freesasa-2.0.3-py3.4-linux-x86_64.egg
(474.6 kB
view hashes)
freesasa-2.0.3-py2.7-linux-x86_64.egg
(447.8 kB
view hashes)
freesasa-2.0.3-cp36-cp36m-win32.whl
(224.4 kB
view hashes)
freesasa-2.0.3-cp35-cp35m-win32.whl
(222.9 kB
view hashes)
freesasa-2.0.3-cp34-cp34m-win32.whl
(225.7 kB
view hashes)
freesasa-2.0.3-cp27-cp27m-win32.whl
(223.7 kB
view hashes)
Close
Hashes for freesasa-2.0.3-py3.6-macosx-10.12-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d4f3b71534a663cf573e9b14fba3a54c3fa55de2550558309a0fea6b0b25932 |
|
MD5 | 5d0ea3c201dc34418bd9aba213747639 |
|
BLAKE2b-256 | 6101c7bf3486554dd6d461715f2d5e2e3cbec3be3dc5406c93a282c87d9ffe53 |
Close
Hashes for freesasa-2.0.3-py3.6-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56421d82d679973f5c426e3e249e871d87ed912665f8832fbef2fde473872fd3 |
|
MD5 | 004c870e515e8606104498f017deee50 |
|
BLAKE2b-256 | 23aba1caa340c4b4a572a17dc95721e4a5fc2c3eaa14ed19b6cc2014d77d72f7 |
Close
Hashes for freesasa-2.0.3-py3.5-macosx-10.12-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | d778dd3b102474051f9bd87f37e40c042b817768c469f1601c35acd0400dfb45 |
|
MD5 | b3d68e5e433e9bbb9231e6ac4aab5957 |
|
BLAKE2b-256 | a8603aff5e63e8c3ade2be1cbf81652866467354e329331b53434b0ddcd688c8 |
Close
Hashes for freesasa-2.0.3-py3.5-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 311d0bb8ef402cb82c16c909aab309f934c17406af49b2354e5b3030d18a2c78 |
|
MD5 | d04c57b7c656a5e11141f98413718c10 |
|
BLAKE2b-256 | e858f9f92c400bef4fbebb32d2527d092b54f80fc78c8cef130b1e5b84bae9d2 |
Close
Hashes for freesasa-2.0.3-py3.4-macosx-10.12-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95ae23a7fbe140f68e82564650f76b2b948ba49a83bba8957bf6917b7b2c10e1 |
|
MD5 | 69c417ecf49dd9d39b2848e08d9a7542 |
|
BLAKE2b-256 | d42dde0bd762854de35feae93fcd61649c9c96c3ac033130eccef4b1f3b5cc54 |
Close
Hashes for freesasa-2.0.3-py3.4-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | f844b7f86b6b14dc49960ecb3d73d1dabb12ecb9bf1c372df6d5f63c6e99e042 |
|
MD5 | 34c64f1bb9b5924bbcb6fcc6cabc1a3d |
|
BLAKE2b-256 | 143d3c755713f481fc4d85971f1cfb013051dfdf0a98b893f4a471e0ae04efbf |
Close
Hashes for freesasa-2.0.3-py2.7-macosx-10.12-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | c486ab66cdde0dad7c69ee80e14f4fd95cdbff2acd23782b9a71650268c6758c |
|
MD5 | 9cb677a46242e3ee667160a59b1ff576 |
|
BLAKE2b-256 | d8453fba2c3695f3ca3bf823d4f47f758b5e976f6e2e834a3bdb7b59adcea527 |
Close
Hashes for freesasa-2.0.3-py2.7-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | e47194718fc24a6bbd268315cab006da378a8e9ac3083c7a4770cc16ceb6b830 |
|
MD5 | 75830b0c303d2c87bb7c68520cf50201 |
|
BLAKE2b-256 | 547d624fd761bc58603f33fd44e10fc8bc8b34ab7c82c628053b7f23bd35452b |
Close
Hashes for freesasa-2.0.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6d0f2bb23ee1f5d3e0bc8336332473054e4523333ca7e8e49974be45a364b44 |
|
MD5 | 6eb8fa81f14793b9e0b95566bcc23ad4 |
|
BLAKE2b-256 | 7f9f4af2f321839c78a72cda69ee6699082ea197f056f630fbbabbf359454812 |
Close
Hashes for freesasa-2.0.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c127c0fd12f8f6abbdc87f1b9412bfbda26303066656cd48dae06705c6e56f |
|
MD5 | 23205e15c6f26a84c8fa91ce0902c9e0 |
|
BLAKE2b-256 | 9ef964cd02f4e908cc49844508c4986536f7ab6dc6ffbca0e710000a388fe4ab |
Close
Hashes for freesasa-2.0.3-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef620114b5a580884a62b2b28b9f5c72887dfc5c7a9517fe26c8795850d385c8 |
|
MD5 | d062ed3de3182ac3642ab02d06b340a7 |
|
BLAKE2b-256 | aeb733731af0f05d1aae8f5a414bcc6b98bdf06fdc7839b8b0e70e084f6e1894 |
Close
Hashes for freesasa-2.0.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f18ce856dfdd7e2bec68b84b96f79afd625b7d882644d41870f2d635b5152463 |
|
MD5 | 26ae927cb0063566bff42c70b1f9dfac |
|
BLAKE2b-256 | d7906492575dfe587f2078ef2d22f7d479864e37a0d9ed9837207e11519da91e |
Close
Hashes for freesasa-2.0.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78a75674b8bf06f36e6ecda4764b1f5c9027b52e427f24379093a076e83d57e2 |
|
MD5 | 2539f668ce8d6ac2698303e8e31be1fe |
|
BLAKE2b-256 | b854c432e880d3117d6809ea0a5878225c8be204ac4368da45167ab9063de218 |
Close
Hashes for freesasa-2.0.3-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d10907fa27e68bbca7e929d2709614605ebecba98047742c53cb32338d415f |
|
MD5 | 22445e3bdf00ac5fbf1651da814c368a |
|
BLAKE2b-256 | 507821248138b0eecd6550dd1e9c48e0b51197abfcef5844809663266462aeaf |
Close
Hashes for freesasa-2.0.3-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc7f159f014f3adea1755843fe7e4dc164efd455bb00786bd03c246afdf5e652 |
|
MD5 | e77cc3dd768a0630ea033fb3d1e81620 |
|
BLAKE2b-256 | e6c22cb529a4cbff304c061ff98cb5c06ffe11cbe0fc69216e26229720e4f231 |
Close
Hashes for freesasa-2.0.3-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a33b71e8659e04f6efc3bdf9f2d357d16c05d5d9dc719e31ca117d7245cfed |
|
MD5 | 15086f06bb9997c6365aec8c624444d4 |
|
BLAKE2b-256 | 85bf359e6ef2d849a3ff34e12ed6e9d1056c55a2c43d2a788331bc63620a3d55 |
Close
Hashes for freesasa-2.0.3-cp34-cp34m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08d7c884a425b757c2fadfc7ff825aa90a80a94371efe5e48223092538018cda |
|
MD5 | ad1ac8fdbf8de13fc02e1d7b085e21c5 |
|
BLAKE2b-256 | c2527fb4a310f4d782ac65239acc440186b14fa60f5e8ca46be090bfce73d5ba |
Close
Hashes for freesasa-2.0.3-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9a50c06bdb436f034819679b15ba8e7761830714c39f3e52cc6ddce9d0ce4a8 |
|
MD5 | 1f6f98fde2e1394c9fb29838c62cf5fd |
|
BLAKE2b-256 | d53b8a2e90d92b5d112278c967fc6cb3e28b6cfc5cf9da60b9c02d169c85403e |
Close
Hashes for freesasa-2.0.3-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cc2972e745eee88fe6481b2043b74b090873f9821addd340b865ffbf7184994 |
|
MD5 | 3c3247bad9bafb8eed310b565f034178 |
|
BLAKE2b-256 | c8769b6e5b99c0cc038ee82a8875b803e15858c26c17984aead474b8525c9b87 |
Close
Hashes for freesasa-2.0.3-cp27-cp27m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a7d9ce2c240ba5525c58a5d78871d9eae3a59cb367f265fc143dac1f328aca0 |
|
MD5 | 28a06ec1db609e0b2f27f4e9799a8101 |
|
BLAKE2b-256 | 95eab89b1eb19da8277b28f448a1a4320d8f5acd511fe8036ce5263951f2975f |