Self-avoiding walk

Usage examples and full code reference for SAW. For the underlying theory, see Self-avoiding walk.

Quick start

from afrc.polymer_models.saw import SAW

model = SAW('MASNDYTQQATQSYGAYPTQPGQGYSQQSSQPYG')

model.get_mean_end_to_end_distance()
model.get_root_mean_squared_end_to_end_distance()
model.get_mean_radius_of_gyration()

# full end-to-end distribution (distances, probabilities)
r, p = model.get_end_to_end_distribution()

The dimensions are tuned with the prefactor argument (default 5.5 A), which can be passed to any of the methods:

for pref in (4.5, 5.5, 6.5):
    print(pref, model.get_mean_end_to_end_distance(prefactor=pref))

See also the demo/demo_SAW.ipynb notebook for a worked, plotted example.

Code reference

class afrc.polymer_models.saw.SAW(seq, p_of_r_resolution=0.05)

This class generates an object that returns polymer statistics consistent with a self-avoiding random walk (SAW). This model was developed by Jhulian ‘J’ Alston, and is based on the reference implementation by O’Brein et al [1]

[1] O’Brien, E. P., Morrison, G., Brooks, B. R., & Thirumalai, D. (2009). How accurate are polymer models in the analysis of Forster resonance energy transfer experiments on proteins? The Journal of Chemical Physics, 130(12), 124903.

__init__(seq, p_of_r_resolution=0.05)

Method to create SAW (self-avoiding walk) object. Seq should be a valid upper-case amino acid sequence and p_of_r_resolution defines the resolution (in angstroms) to be used for distributions.

By default p_of_r_resolution is taken from the config.py file in the afrc package which defines the resolution at 0.05 A.

Parameters:
  • seq (str) – Amino acid sequence (used only to calculate number of residues)

  • p_of_r_resolution (float) – Bin width for bulding probability distributions. In Angstroms.

get_end_to_end_distribution(prefactor=5.5)

Defines the end-to-end distribution based on the SAW as defined by https://aip.scitation.org/doi/10.1063/1.3082151.

This is a composition independent model for which the end-to-end distance depends solely on the number of amino acids. It is included here as an additional reference model.

By default this uses a prefactor of 5.5 A (0.55 nanometers).

Parameters:

prefactor (float) – Prefactor is a number that tunes the SAW dimensions. 0.5 is in the right ballpark but this number should be tuned to match EV sims.

Returns:

A 2-pair tuple of numpy arrays where the first is the distance (in Angstroms) and the second array is the probability of that distance.

Return type:

tuple of arrays

get_mean_end_to_end_distance(prefactor=5.5)

Returns the mean end-to-end distance (\(R_e\)). As calculated from the SAW model as defined https://aip.scitation.org/doi/10.1063/1.3082151.

The mean is computed by integrating over the \(P(r)\) vs. \(r\) distribution (i.e. \(\sum r \cdot P(r)\)), consistent with the convention used by the other models in this package.

By default this uses a prefactor of 5.5 A (0.55 nanometers).

Parameters:

prefactor (float) – Prefactor that tunes the SAW dimensions. Default is 5.5 A.

Returns:

Value equal to the mean end-to-end distance.

Return type:

float

get_mean_radius_of_gyration(prefactor=5.5)

Returns the mean radius of gyration (\(R_g\)) for the SAW model.

\(R_g\) is obtained from the mean-squared end-to-end distance via the analytical ratio \(\langle R_g^2 \rangle / \langle R_e^2 \rangle\) expressed in terms of the gamma exponent and the scaling exponent \(\nu\) (see [1]).

Parameters:

prefactor (float) – Prefactor that tunes the SAW dimensions. Default is 5.5 A.

Returns:

Value equal to the mean radius of gyration.

Return type:

float

get_root_mean_squared_end_to_end_distance(prefactor=5.5)

Returns the root-mean-square end-to-end distance (\(\sqrt{\langle R_e^2 \rangle}\)) as calculated from the SAW model.

The value is computed by taking the square root after integrating over \(P(r)\) vs. \(r^2\).

Parameters:

prefactor (float) – Prefactor that tunes the SAW dimensions. Default is 5.5 A.

Returns:

Value equal to the root-mean-square end-to-end distance.

Return type:

float