.. 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.
Metadata
Release files for freesasa 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| freesasa-2.0.3.tar.gz | 177.8 kB | Without provenance | Details |
Built distributions (wheels)
Total release size: 5.5 MB
Release files / freesasa-2.0.3.tar.gz
| Download URL | freesasa-2.0.3.tar.gz |
|---|---|
| Size | 177.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e4bafdf6ed524a4b1cbc6bb6b49fb7ad8dda478f131a86e1967cc4e0d121096
|
|
BLAKE2b-256 checksum How to use checksums |
28f4c4dfb19d9be49539f31a15d786870eaaddc14d3504d2ece71d10a04ba183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.6-macosx-10.12-x86_64.egg
| Download URL | freesasa-2.0.3-py3.6-macosx-10.12-x86_64.egg |
|---|---|
| Size | 136.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
6d4f3b71534a663cf573e9b14fba3a54c3fa55de2550558309a0fea6b0b25932
|
|
BLAKE2b-256 checksum How to use checksums |
6101c7bf3486554dd6d461715f2d5e2e3cbec3be3dc5406c93a282c87d9ffe53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.6-linux-x86_64.egg
| Download URL | freesasa-2.0.3-py3.6-linux-x86_64.egg |
|---|---|
| Size | 487.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
56421d82d679973f5c426e3e249e871d87ed912665f8832fbef2fde473872fd3
|
|
BLAKE2b-256 checksum How to use checksums |
23aba1caa340c4b4a572a17dc95721e4a5fc2c3eaa14ed19b6cc2014d77d72f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.5-macosx-10.12-x86_64.egg
| Download URL | freesasa-2.0.3-py3.5-macosx-10.12-x86_64.egg |
|---|---|
| Size | 138.4 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
d778dd3b102474051f9bd87f37e40c042b817768c469f1601c35acd0400dfb45
|
|
BLAKE2b-256 checksum How to use checksums |
a8603aff5e63e8c3ade2be1cbf81652866467354e329331b53434b0ddcd688c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.5-linux-x86_64.egg
| Download URL | freesasa-2.0.3-py3.5-linux-x86_64.egg |
|---|---|
| Size | 469.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
311d0bb8ef402cb82c16c909aab309f934c17406af49b2354e5b3030d18a2c78
|
|
BLAKE2b-256 checksum How to use checksums |
e858f9f92c400bef4fbebb32d2527d092b54f80fc78c8cef130b1e5b84bae9d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.4-macosx-10.12-x86_64.egg
| Download URL | freesasa-2.0.3-py3.4-macosx-10.12-x86_64.egg |
|---|---|
| Size | 137.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
95ae23a7fbe140f68e82564650f76b2b948ba49a83bba8957bf6917b7b2c10e1
|
|
BLAKE2b-256 checksum How to use checksums |
d42dde0bd762854de35feae93fcd61649c9c96c3ac033130eccef4b1f3b5cc54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py3.4-linux-x86_64.egg
| Download URL | freesasa-2.0.3-py3.4-linux-x86_64.egg |
|---|---|
| Size | 474.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
f844b7f86b6b14dc49960ecb3d73d1dabb12ecb9bf1c372df6d5f63c6e99e042
|
|
BLAKE2b-256 checksum How to use checksums |
143d3c755713f481fc4d85971f1cfb013051dfdf0a98b893f4a471e0ae04efbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py2.7-macosx-10.12-x86_64.egg
| Download URL | freesasa-2.0.3-py2.7-macosx-10.12-x86_64.egg |
|---|---|
| Size | 137.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
c486ab66cdde0dad7c69ee80e14f4fd95cdbff2acd23782b9a71650268c6758c
|
|
BLAKE2b-256 checksum How to use checksums |
d8453fba2c3695f3ca3bf823d4f47f758b5e976f6e2e834a3bdb7b59adcea527
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-py2.7-linux-x86_64.egg
| Download URL | freesasa-2.0.3-py2.7-linux-x86_64.egg |
|---|---|
| Size | 447.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
e47194718fc24a6bbd268315cab006da378a8e9ac3083c7a4770cc16ceb6b830
|
|
BLAKE2b-256 checksum How to use checksums |
547d624fd761bc58603f33fd44e10fc8bc8b34ab7c82c628053b7f23bd35452b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp36-cp36m-win_amd64.whl
| Download URL | freesasa-2.0.3-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 240.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f6d0f2bb23ee1f5d3e0bc8336332473054e4523333ca7e8e49974be45a364b44
|
|
BLAKE2b-256 checksum How to use checksums |
7f9f4af2f321839c78a72cda69ee6699082ea197f056f630fbbabbf359454812
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp36-cp36m-win32.whl
| Download URL | freesasa-2.0.3-cp36-cp36m-win32.whl |
|---|---|
| Size | 224.4 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
46c127c0fd12f8f6abbdc87f1b9412bfbda26303066656cd48dae06705c6e56f
|
|
BLAKE2b-256 checksum How to use checksums |
9ef964cd02f4e908cc49844508c4986536f7ab6dc6ffbca0e710000a388fe4ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp36-cp36m-macosx_10_12_x86_64.whl
| Download URL | freesasa-2.0.3-cp36-cp36m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 263.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ef620114b5a580884a62b2b28b9f5c72887dfc5c7a9517fe26c8795850d385c8
|
|
BLAKE2b-256 checksum How to use checksums |
aeb733731af0f05d1aae8f5a414bcc6b98bdf06fdc7839b8b0e70e084f6e1894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp35-cp35m-win_amd64.whl
| Download URL | freesasa-2.0.3-cp35-cp35m-win_amd64.whl |
|---|---|
| Size | 239.1 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f18ce856dfdd7e2bec68b84b96f79afd625b7d882644d41870f2d635b5152463
|
|
BLAKE2b-256 checksum How to use checksums |
d7906492575dfe587f2078ef2d22f7d479864e37a0d9ed9837207e11519da91e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp35-cp35m-win32.whl
| Download URL | freesasa-2.0.3-cp35-cp35m-win32.whl |
|---|---|
| Size | 222.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
78a75674b8bf06f36e6ecda4764b1f5c9027b52e427f24379093a076e83d57e2
|
|
BLAKE2b-256 checksum How to use checksums |
b854c432e880d3117d6809ea0a5878225c8be204ac4368da45167ab9063de218
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp35-cp35m-macosx_10_12_x86_64.whl
| Download URL | freesasa-2.0.3-cp35-cp35m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 265.5 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
60d10907fa27e68bbca7e929d2709614605ebecba98047742c53cb32338d415f
|
|
BLAKE2b-256 checksum How to use checksums |
507821248138b0eecd6550dd1e9c48e0b51197abfcef5844809663266462aeaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp34-cp34m-win_amd64.whl
| Download URL | freesasa-2.0.3-cp34-cp34m-win_amd64.whl |
|---|---|
| Size | 240.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
dc7f159f014f3adea1755843fe7e4dc164efd455bb00786bd03c246afdf5e652
|
|
BLAKE2b-256 checksum How to use checksums |
e6c22cb529a4cbff304c061ff98cb5c06ffe11cbe0fc69216e26229720e4f231
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp34-cp34m-win32.whl
| Download URL | freesasa-2.0.3-cp34-cp34m-win32.whl |
|---|---|
| Size | 225.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
97a33b71e8659e04f6efc3bdf9f2d357d16c05d5d9dc719e31ca117d7245cfed
|
|
BLAKE2b-256 checksum How to use checksums |
85bf359e6ef2d849a3ff34e12ed6e9d1056c55a2c43d2a788331bc63620a3d55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp34-cp34m-macosx_10_12_x86_64.whl
| Download URL | freesasa-2.0.3-cp34-cp34m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 264.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
08d7c884a425b757c2fadfc7ff825aa90a80a94371efe5e48223092538018cda
|
|
BLAKE2b-256 checksum How to use checksums |
c2527fb4a310f4d782ac65239acc440186b14fa60f5e8ca46be090bfce73d5ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp27-cp27m-win_amd64.whl
| Download URL | freesasa-2.0.3-cp27-cp27m-win_amd64.whl |
|---|---|
| Size | 241.2 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e9a50c06bdb436f034819679b15ba8e7761830714c39f3e52cc6ddce9d0ce4a8
|
|
BLAKE2b-256 checksum How to use checksums |
d53b8a2e90d92b5d112278c967fc6cb3e28b6cfc5cf9da60b9c02d169c85403e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp27-cp27m-win32.whl
| Download URL | freesasa-2.0.3-cp27-cp27m-win32.whl |
|---|---|
| Size | 223.7 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
4cc2972e745eee88fe6481b2043b74b090873f9821addd340b865ffbf7184994
|
|
BLAKE2b-256 checksum How to use checksums |
c8769b6e5b99c0cc038ee82a8875b803e15858c26c17984aead474b8525c9b87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / freesasa-2.0.3-cp27-cp27m-macosx_10_12_x86_64.whl
| Download URL | freesasa-2.0.3-cp27-cp27m-macosx_10_12_x86_64.whl |
|---|---|
| Size | 264.3 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1a7d9ce2c240ba5525c58a5d78871d9eae3a59cb367f265fc143dac1f328aca0
|
|
BLAKE2b-256 checksum How to use checksums |
95eab89b1eb19da8277b28f448a1a4320d8f5acd511fe8036ce5263951f2975f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for freesasa 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.