Solvent Accessible Surface Area (SASA)
These functions are used to compute the solvent accessible surface area (SASA) of structures or parts of a structure. They provide a very fast implementation of the Shake-Rupley method, using a Fibbonacy lattice to construct the grid points.
PDBTools.sasa_particles — Functionsasa_particles(atoms; probe_radius, n_dots)Calculates the Solvent Accessible Surface Area (SASA) for a vector of Atoms. 
Main argument
- atoms::Vector{PDBTools.Atom}: A vector of atoms in the molecule.
Returns
PDBTools.SASA structure, containing the vector of atoms, the SASA of each atom (in Ų) and, optionally, the solvent accessible dots that define the surface. 
The sasa function computes the total SASA or the SASA of a subset of the atoms in the structure.
Optional arguments
- probe_radius::Real=1.4f0: The radius of the solvent probe in Angstroms.
- n_dots::Int=512: The number of grid points along one axis for dot generation. Higher values lead to more accurate but slower calculations.
- unitcell=nothing: if periodic boundary conditions are used, provide a 3x3 matrix with the unitcell, or alternatively a vector of length 3 with the sides, for orthorhombic cells.
- parallel::Bool=true: Control if the computation runs in parallel (requires running Julia with multiple threads).
Example
julia> using PDBTools
julia> prot = select(read_pdb(PDBTools.TESTPDB), "protein");
julia> at_sasa = sasa_particles(prot);
julia> sasa(at_sasa) # total sasa of prot
5389.0146f0
julia> sasa(at_sasa, "backbone") # backbone sasa in prot
988.7648f0
julia> sasa(at_sasa, "not backbone") # other atoms
4400.246f0
julia> sasa(at_sasa, "resname ARG GLU") # some residue types
543.29846f0Additional control:
Two arguments can control the atom radii used for computing the SASA. These arguments are functions:
- atom_type: Function that given each atom of the array of atoms, returns the atom "type".
- atom_radius_from_type: Given the atom "type", returns the vdW radius of the atom.
- output_dots::Bool=false: If true, the resulting- SASAstructure will contain the solvent accessible dots per particle in the- dotsfield.
By default, atom_type = PDBTools.element, a function that just returns the element symbol of the atom, and atom_radius_from_type obtains the vdW radius from the PDBTools.elements list given the element symbol. Here, the atomc radii of https://en.wikipedia.org/wiki/Atomicradiioftheelements(datapage) are used.  Atoms with missing radius have a NaN value, and the computation will not return meaningful values. 
PDBTools.sasa — Functionsasa(s::SASA)
sasa(s::SASA{<:AbstractVector{<:PDBTools.Atom}})
sasa(atoms::SASA{<:AbstractVector{PDBTools.Atom}}, selection::Union{Function,String})Given the output of sasa_particles, sums up contributions of atoms to compute the SASA of the full structure, an atom, or a subset of atoms. The function can be called with only a  SASA object (in which case the full SASA is returned), or with the object and a selection, given by a function or selection string. 
Example
julia> using PDBTools
julia> prot = select(read_pdb(PDBTools.TESTPDB), "protein");
julia> at_sasa = sasa_particles(prot);
julia> sasa(at_sasa) # total sasa of prot
5389.0146f0
julia> sasa(at_sasa, "backbone") # selection string
988.7648f0
julia> sasa(at_sasa, at -> name(at) == "CA") # selection function
44.078426f0
julia> sasa(at_sasa[1]) # single atom SASA
5.467941f0A typical run of these functions consists in providing the structure of a protein to the first function, sasa_particles, to obtain a SASA object, which contains the accessible area per atom:
using PDBTools
prot = read_pdb(PDBTools.TESTPDB, "protein")
atom_sasa = sasa_particles(prot)PDBTools.SASA{3, Vector{Atom{Nothing}}}
    Number of particles: 1463
    Total SASA: 5363.5557
    Output of dots: false The atom_sasa object created above can be used to extract the total accessible area or the accessible area of any sub-surface. The sasa function provides an interface for those extractions:
sasa(atom_sasa) # total5363.5557f0sasa(atom_sasa, "polar")4687.9873f0sasa(atom_sasa, "backbone")977.308f0sasa(atom_sasa, "resname THR and residue < 50")174.11f0In some situations, it might be useful to visualize the surface. The dots that form the surface can be obtained by running sasa_particles with the output_dots option set to true. Here, we use fewer dots for better visualization:
atom_sasa = sasa_particles(prot; n_dots=100, output_dots=true)PDBTools.SASA{3, Vector{Atom{Nothing}}}
    Number of particles: 1463
    Total SASA: 5342.6357
    Output of dots: true Where the atom_sasa.dots field contais the dots that are accessible to the surface for each atom. These can be plotted, for example, with:
using Plots
dots = reduce(vcat, atom_sasa.dots)
scatter(Tuple.(coor.(prot)); color=:orange, msw=0, label="") # atom coordinates
scatter!(Tuple.(dots); # surface dots
    color=:blue, ms=1, msw=0, ma=0.5, # marker properties
    label="",
)The sasa_particles function supports periodic boundary conditions if a unit cell is provided.  See the how to read the unitcell  for further information.