This is a read-only mirror of pymolwiki.org

Difference between revisions of "Get Area"

From PyMOL Wiki
Jump to navigation Jump to search
(flag ignore in PyMOL 2.5)
m (1 revision)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''get_area''' calculates the surface area in square Angstroms of the selection given. Note that the accessibility is assessed in the context of the object(s) that the selection is part of. So, to get the surface areas of e.g. a component of a complex, you should make a new object containing a copy of just that component and calculate its area.
+
#REDIRECT [[Get area]]
 
 
The "get_area selection" command will return the effective surface area of the dots that you would see from "[[show]] [[dots]], selection".  This is a discrete approximation -- not an exact calculation.
 
 
 
'''Attention:''' Atoms with the "[[Surface#Calculating_a_partial_surface|ignore]]" [[flag]] may lead to unexpected results. Clear the "ignore" flag first or exclude those atoms from the calculation.
 
''Fixed in PyMOL 2.5, [https://github.com/schrodinger/pymol-open-source/commit/1659fde83d2a125f86cad13414cead6b8f74abe9 ignored atoms are now excluded]. Previously, their entire sphere surface was added to the surface area.''
 
 
 
= Usage =
 
 
 
get_area [ selection [, state [, load_b ]]]
 
 
 
== Arguments ==
 
 
 
* '''selection''' = str: atom selection {default: all}
 
* '''state''' = int: object state {default: 1}
 
* '''load_b''' = 0/1: Load the surface area per atom into the b-factor {default: 0}
 
 
 
== Settings ==
 
 
 
The following PyMOL settings control how '''get_area''' works:
 
 
 
{| class="wikitable"
 
|-
 
! Setting
 
! Description
 
|-
 
| [[dot_solvent]]
 
| '''0''' = calculate '''molecular surface''' area {default}
 
'''1''' = calculate '''solvent accessible surface''' area (SASA)
 
|-
 
| [[dot_density]]
 
| 1-4 {default: 2}. Sampling density. Higher density (more dots) means higher accuracy but slower performance.
 
|-
 
| [[solvent_radius]]
 
| The solvent radius {default: 1.4}
 
|}
 
 
 
The [[dot_hydrogens]] setting is '''not''' used.
 
 
 
For example:
 
<source lang="python">
 
PyMOL> load $TUT/1hpv.pdb
 
PyMOL> show dots, resn arg
 
PyMOL> get_area resn arg
 
cmd.get_area: 1147.956 Angstroms^2.
 
PyMOL>set dot_solvent, on
 
PyMOL>get_area resn arg
 
cmd.get_area: 673.084 Angstroms^2.
 
PyMOL>set dot_density, 3
 
PyMOL>get_area resn arg
 
cmd.get_area: 674.157 Angstroms^2.
 
PyMOL>set dot_density, 4
 
PyMOL>get_area resn arg
 
cmd.get_area: 672.056 Angstroms^2.
 
PyMOL>get_area all
 
cmd.get_area: 13837.804 Angstroms^2.
 
</source>
 
 
This code has not been recently validated though it was checked a couple years back. We suggest that people perform some kind of independent check on their system before trusting the results. 
 
 
 
== Python API ==
 
<source lang="python">
 
float cmd.get_area(str selection="(all)", int state=1, int load_b=0)
 
</source>
 
 
 
= Examples =
 
== Example 1 - starting with a complex in a single file ==
 
<source lang="python">
 
# load complex
 
# Haemoglobin in this example illustrates careful use of selection algebra
 
load 2HHB.pdb
 
 
 
# create objects for alpha1, beta1 and alpha1,beta1 pair of subunits
 
create alpha1, 2HHB and chain A
 
create beta1, 2HHB and chain B
 
create ab1, 2HHB and chain A+B
 
 
 
# get hydrogens onto everything (NOTE: must have valid valences on e.g. small organic molecules)
 
h_add
 
 
 
# make sure all atoms within an object occlude one another
 
flag ignore, none
 
 
 
# use solvent-accessible surface with high sampling density
 
set dot_solvent, 1
 
set dot_density, 3
 
 
 
# measure the components individually storing the results for later
 
alpha1_area=cmd.get_area("alpha1")
 
beta1_area=cmd.get_area("beta1")
 
 
 
 
 
# measure the alpha1,beta1 pair
 
ab1_area=cmd.get_area("ab1")
 
 
 
# now print results and do some maths to get the buried surface
 
print alpha1_area
 
print beta1_area
 
print ab1_area
 
print (alpha1_area + beta1_area) - ab1_area
 
</source>
 
 
 
== Example 2 - starting with two components in separate files ==
 
<source lang="python">
 
# load components separately
 
load my_ligand.pdb
 
load my_target.pdb
 
 
 
# get hydrogens onto everything (NOTE: must have valid valences on the ligand...)
 
h_add
 
 
 
# make sure all atoms within an object occlude one another
 
flag ignore, none
 
 
 
# use solvent-accessible surface with high sampling density
 
set dot_solvent, 1
 
set dot_density, 3
 
 
 
# measure the components individually
 
ligand_area=cmd.get_area("my_ligand")
 
target_area=cmd.get_area("my_target")
 
 
 
# create the complex
 
create my_complex, my_ligand my_target
 
 
 
# measure the complex
 
complex_area=cmd.get_area("my_complex")
 
 
 
# now print results
 
print ligand_area
 
print target_area
 
print complex_area
 
print (ligand_area + target_area) - complex_area
 
</source>
 
 
 
==Example 3 - using load_b to get surface area per atom ==
 
<source lang="python">
 
# example usage of load_b
 
# select some organic small molecule
 
select ligand, br. first organic
 
# get its area and load it into it's b-factor column
 
get_area ligand, load_b=1
 
# print out the b-factor/areas per atom
 
iterate ligand, print b
 
</source>
 
 
 
 
 
==Example 4 - using a Python script to compute the SASA for individual residues==
 
<source lang="python">
 
import __main__
 
__main__.pymol_argv = ['pymol','-qc']
 
import pymol
 
from pymol import cmd, stored
 
pymol.finish_launching()
 
 
 
cmd.set('dot_solvent', 1)
 
cmd.set('dot_density', 3)
 
 
 
cmd.load('file.pdb')  # use the name of your pdb file
 
stored.residues = []
 
cmd.iterate('name ca', 'stored.residues.append(resi)')
 
 
 
sasa_per_residue = []
 
for i in stored.residues:
 
    sasa_per_residue.append(cmd.get_area('resi %s' % i))
 
 
 
print sum(sasa_per_residue)
 
print cmd.get_area('all')  # just to check that the sum of sasa per residue equals the total area
 
</source>
 
 
 
 
 
= See Also =
 
* For an example of '''load_b''' in use check out [[FindSurfaceResidues]].
 
* [[Surface]], most notably [[Surface#Calculating_a_partial_surface]].
 
 
 
[[Category:Commands|Get Area]]
 
[[Category:Biochemical_Properties|Get Area]]
 

Latest revision as of 03:43, 6 December 2021

Redirect to: