Function Repository Resource:

BioMoleculeResidueFluctuations

Source Notebook

Calculate the fluctuations of residues in a biomolecule

Contributed by: Soutick Saha

ResourceFunction["BioMoleculeResidueFluctuations"][biomol]

calculates the fluctuations in the backbone atoms of residues of a biomolecule biomol.

Details and Options

Biomolecules are flexible and atoms move around their mean position. Fluctuation is the measure of this deviation of the atoms in biomolecules from their mean position.
ResourceFunction["BioMoleculeResidueFluctuations"] is based on Bahar, Ivet, et al. "Vibrational dynamics of folded proteins: significance of slow and fast motions in relation to function and stability." Physical review letters 80.12 (1998): 2733.
The backbone atom for amino acids is Cα and for neucleic acids is O3'.
ExternalIdentifier can take "PDBStructureID" or "UniProtKBAccessionNumber" as "Type".
The String can be a file path, URL or a four letter PDB ID.
To compute the fluctuations, we perform the following operations: 1) the matrix of inter-residue distances (in Å) of a BioMolecule. 2) Compute the KirchhoffMatrix from the distance matrix, where all residues within a given "CutOff" are connected. 3) compute the Eigensystem ({λ_k, u_k}) of the KirchhoffMatrix and get rid of zero eigenvalues and corresponding eigenvectors. 4) Finally, the normalized mean squared fluctuations of the residues in mode k are computed by taking the diagonal elements of the outer product of the kth eigenvector with its transpose, weighted by inverse of the kth eigenvalue.
The output returns an association containing the "Eigenvalues" and "Eigenvectors" of the KirchhoffMatrix and also the "NormalizedMeanSquaredFluctuations" of the protein residues.
The eigenvalues, eigenvectors and corresponding fluctuations are sorted from slowest (least eigenvalue) to fastest (largest eigenvalue) modes.
ResourceFunction["BioMoleculeResidueFluctuations"] can take the following option:
"CutOff"distance within which inter-residue interactions will be considered

Examples

Basic Examples (2) 

Find the eigenvalues of myoglobin:

In[1]:=
myoglobinFluctuations = ResourceFunction["BioMoleculeResidueFluctuations"][
   ExternalIdentifier["PDBStructureID", "1MBN"]];
myoglobinFluctuations["Eigenvalues"]
Out[2]=

Visualize the fluctuations in the second mode:

In[3]:=
slowModeFluctuations = myoglobinFluctuations["NormalizedMeanSquaredFluctuations"][[2]];
Show[ListLinePlot[
  slowModeFluctuations, {Frame -> True, PlotRange -> {All, All}, PlotStyle -> Black, FrameStyle -> Directive[GrayLevel[0], 12], FrameLabel -> {"Residue Index", "Normalized mean squared fluctuations"}}], ListPlot[slowModeFluctuations, PlotStyle -> {PointSize[Medium], Black}, PlotRange -> {All, All}]]
Out[4]=

Scope (3) 

BioMoleculeResidueFluctuations can accept a BioMolecule as an input:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/7b22b77d-5ec2-48f5-9546-263051d71d1c"]

See the keys available in the result:

In[6]:=
Keys[fluctuations]
Out[6]=

Display a correlation matrix of the human KRAS G12C mutant for the slowest mode constructed using the "Eigenvectors" and "Eigenvalues":

In[7]:=
slowestEigenVec = fluctuations["Eigenvectors"][[2]];
correlationMatrix = Outer[Times, slowestEigenVec, Transpose@slowestEigenVec]/(fluctuations["Eigenvalues"][[2]]);
ArrayPlot[correlationMatrix, ColorFunction -> "BlueGreenYellow", Frame -> True, FrameTicks -> {{True, False}, {False, True}}, FrameTicksStyle -> Directive[Black, Thick, 15], FrameStyle -> Directive[Black, 15], PlotLegends -> Automatic, FrameLabel -> {{None, "Residue Index"}, {"Residue Index", None}}]
Out[9]=

BioMoleculeResidueFluctuations can analyze nucleic acid structures and protein-nucleic acid complexes too. Here is the visualization of the "NormalizedMeanSquaredFluctuations" in slow and fast modes for a protein-nucleic acid complex:

In[10]:=
fluctuations = ResourceFunction["BioMoleculeResidueFluctuations"]["6TPH"];
slowModeFluctuations = fluctuations["NormalizedMeanSquaredFluctuations"][[2]];
fastModesFluctuations = Table[Total[
   fluctuations["NormalizedMeanSquaredFluctuations"][[-6 ;; -1, i]]], {i, Length@fluctuations["NormalizedMeanSquaredFluctuations"][[
     1]]}]; colorList = (cFunc@slowModeFluctuations)[#] & /@ slowModeFluctuations;
colorList2 = (cFunc@fastModesFluctuations)[#] & /@ fastModesFluctuations;
GraphicsRow[{PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"]["6TPH",
    "ColorList" -> colorList, PlotLabel -> Style["Slowest mode \n High fluctuations: Red, Low fluctuations: Blue", Black, Bold]], PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"]["6TPH",
    "ColorList" -> colorList2, PlotLabel -> Style["Fastest six modes \n High fluctuations: Red, Low fluctuations: Blue", Black, Bold]]}]
Out[11]=

Analysis of computationally predicted structures in the AlphaFold Protein Structure Database can be performed by providing the relevant UniProt ID using the ExternalIdentifier:

In[12]:=
fluctuations = ResourceFunction["BioMoleculeResidueFluctuations"][
   ExternalIdentifier["UniProtKBAccessionNumber", "Q8W3K0"]];
slowModeFluctuations = fluctuations["NormalizedMeanSquaredFluctuations"][[2]];
fastModesFluctuations = Table[Total[
    fluctuations["NormalizedMeanSquaredFluctuations"][[-6 ;; -1, i]]], {i, Length@fluctuations["NormalizedMeanSquaredFluctuations"][[1]]}];
GraphicsRow[{Show[
   ListLinePlot[
    slowModeFluctuations, {Frame -> True, PlotLabel -> Style["Slowest mode", 
GrayLevel[0], Bold], PlotRange -> {All, All}, PlotStyle -> Black, FrameStyle -> Directive[
GrayLevel[0], 12], FrameLabel -> {"Residue Index", "Normalized mean squared fluctuations"}}],
   ListPlot[slowModeFluctuations, Sequence[PlotStyle -> {
PointSize[Medium], Black}, PlotRange -> {All, All}]]],
  Show[
   ListLinePlot[
    fastModesFluctuations, {Frame -> True, PlotLabel -> Style["Fastest six modes", 
GrayLevel[0], Bold], FrameStyle -> Directive[
GrayLevel[0], 12], FrameLabel -> {"Residue Index", "Normalized mean squared fluctuations"}, PlotStyle -> Black, PlotRange -> {All, All}}],
   ListPlot[fastModesFluctuations, Sequence[PlotStyle -> {
PointSize[Medium], Black}, PlotRange -> {All, All}]]]}, ImageSize -> 1000]
Out[13]=

Applications (4) 

Let us analyze the mean squared fluctuations in HIV-1 protease:

In[14]:=
hivProteaseFluctuations = ResourceFunction["BioMoleculeResidueFluctuations"][
   ExternalIdentifier["PDBStructureID", "1HIV"]];

These are the following Keys for the hivProteaseFluctuations association:

In[15]:=
Keys@hivProteaseFluctuations
Out[15]=

Since the "Eigenvalues" are sorted in ascending order let us get the lowest five eigenvalues:

In[16]:=
hivProteaseFluctuations["Eigenvalues"][[1 ;; 5]]
Out[16]=

The lowest eigenvalue is much much smaller than the others and close to zero and it does not return any meaningful variation in the fluctuations. So the slowest mode (smallest eigenvalue) for which we can see meaningful patterns in the fluctuation is k=2:


If we take the outer-product of an eigenvector corresponding to a given mode and divide it by the eigenvalue, the diagonal elements represent the residue fluctuations and the off diagonal elements represents correlations. Let us visualize the correlation matrix for the slowest mode. The colorbar indicates normalized mean squared fluctuations:

In[17]:=
slowestEigenVec = hivProteaseFluctuations["Eigenvectors"][[2]];
ArrayPlot[
 Outer[Times, slowestEigenVec, Transpose@
    slowestEigenVec]/(hivProteaseFluctuations["Eigenvalues"][[
    2]]), {ColorFunction -> "BlueGreenYellow", Frame -> True, FrameTicks -> {{True, False}, {False, True}}, FrameTicksStyle -> Directive[
GrayLevel[0], 
Thickness[Large], 15], FrameStyle -> Directive[
GrayLevel[0], 15], PlotLegends -> Automatic, FrameLabel -> {{None, "Residue Index"}, {"Residue Index", None}}}]
Out[15]=

HIV-1 protease is a dimer and the fluctuations for two chains (99 residues each) follows identical pattern, as can be seen in the correlation matrix. Here we plot the fluctuation for a single chain for both the slowest mode (left) and fastest six modes combined (right). Usually the fastest mode (largest eigenvalue) has very sharp peaks, so to see the average fluctuation, we combine the fastest six modes:

In[18]:=
slowModeFluctuations = hivProteaseFluctuations["NormalizedMeanSquaredFluctuations"][[2]];
fastModesFluctuations = Table[Total[
    hivProteaseFluctuations[
      "NormalizedMeanSquaredFluctuations"][[-6 ;; -1, i]]], {i, Length@hivProteaseFluctuations[
       "NormalizedMeanSquaredFluctuations"][[1]]}];
GraphicsRow[{Show[
   ListLinePlot[slowModeFluctuations, Sequence[
    Frame -> True, PlotLabel -> Style["Slowest mode", Black, Bold], PlotRange -> {{1, 99}, All}, PlotStyle -> Black, FrameStyle -> Directive[Black, 12], FrameLabel -> {"Residue Index", "Normalized mean squared fluctuations"}]], ListPlot[slowModeFluctuations, Sequence[PlotStyle -> {
PointSize[Medium], Black}, PlotRange -> {{1, 99}, All}]]], Show[ListLinePlot[fastModesFluctuations, Sequence[
    Frame -> True, PlotLabel -> Style["Fastest six modes", Black, Bold], FrameStyle -> Directive[Black, 12], FrameLabel -> {"Residue Index", "Normalized mean squared fluctuations"}, PlotStyle -> Black, PlotRange -> {{1, 99}, All}]], ListPlot[fastModesFluctuations, Sequence[PlotStyle -> {
PointSize[Medium], Black}, PlotRange -> {{1, 99}, All}]]]}, ImageSize -> 1000]
Out[19]=

Visualize the fluctuations for the slowest and fastest modes on the structure. For the slow modes the minima of fluctuations (in blue) corresponds to hinge regions which plays important functions in the protein and the maxima (in red) represents regions of highest mobility. For the fastest modes, the large fluctuation region (in red), plays a key role in the stability of the protein:

In[20]:=
cFunc[ls_] := (Blend[{{Min@ls, RGBColor[0, 0, 1]}, {Mean[ls], GrayLevel[1]}, {Max@ls, RGBColor[1, 0, 0]}}, #1] &);
In[21]:=
colorList = (cFunc@slowModeFluctuations)[#] & /@ slowModeFluctuations;
colorList2 = (cFunc@fastModesFluctuations)[#] & /@ fastModesFluctuations;
GraphicsRow[{PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"][
   ExternalIdentifier["PDBStructureID", "1HIV"], "ColorList" -> colorList, ViewMatrix -> {{{0.016154907919898626`, -0.0058412945266863945`, 0.004478548142589588, -0.1671404648124019}, {
    0.000532864520760192, -0.009845186541582479, -0.014763045840115467`, 0.269199307008683}, {-0.0073412649193108455`, -0.013568741479125438`, 0.008783749152301033, 3.269080507244387}, {0.,
     0., 0., 1.}}, {{3.663171099739466, 0., 0.5, 0.}, {0., 3.663171099739466, 0.5, 0.}, {0., 0., 3.369678399022946, -9.41558651689875}, {0., 0., 1., 0.}}}, PlotLabel -> Style["Slowest mode \n High fluctuations: Red, Low fluctuations: Blue", Black, Bold]], PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"][
   ExternalIdentifier["PDBStructureID", "1HIV"], "ColorList" -> colorList2, ViewMatrix -> {{{0.016154907919898626`, -0.0058412945266863945`, 0.004478548142589588, -0.1671404648124019}, {
    0.000532864520760192, -0.009845186541582479, -0.014763045840115467`, 0.269199307008683}, {-0.0073412649193108455`, -0.013568741479125438`, 0.008783749152301033, 3.269080507244387}, {0.,
     0., 0., 1.}}, {{3.663171099739466, 0., 0.5, 0.}, {0., 3.663171099739466, 0.5, 0.}, {0., 0., 3.369678399022946, -9.41558651689875}, {0., 0., 1., 0.}}}, PlotLabel -> Style["Fastest six modes \n High fluctuations: Red, Low fluctuations: Blue", Black, Bold]]}]
Out[22]=

Options (1) 

CutOff (1) 

Set a custom "CutOff" distance within which inter-residue interactions will be taken into account. Here are the structures of the COVID-19 main protease in complex with an inhibitor N3 showing high (in red) and low (in blue) fluctuation regions in the slowest mode:

In[23]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/27cd8359-a245-4633-8ad7-66fae77596a8"]
Out[21]=

Neat Examples (2) 

We analyze the average fluctuations in the slowest six modes of HIV-1 protease in open (PDB ID - 2PC0) and closed state (PDB ID - 4TVH):

In[24]:=
flucOpen = ResourceFunction["BioMoleculeResidueFluctuations"][
   "https://files.rcsb.org/download/2pc0-assembly1.cif.gz"];
flucSlowOpen = flucOpen["NormalizedMeanSquaredFluctuations"][[2]];
colorListOpen = (cFunc@flucSlowOpen)[#] & /@ flucSlowOpen;

flucClosed = ResourceFunction["BioMoleculeResidueFluctuations"][
   ExternalIdentifier["PDBStructureID", "4TVH"]];
flucSlowClosed = flucClosed["NormalizedMeanSquaredFluctuations"][[2]];
colorListClosed = (cFunc@flucSlowClosed)[#] & /@ flucSlowClosed;

The plots below highlight the motion in the flap area in open state (right) and lack thereof in closed state (left) which is very similar to an existing study of molecular dynamics simulation of HIV-1 protease[2]:

In[25]:=
slowModesOpenFluctuations = Table[Total[
    flucOpen["NormalizedMeanSquaredFluctuations"][[2 ;; 7, i]]], {i, Length@flucOpen["NormalizedMeanSquaredFluctuations"][[1]]}];
slowModesClosedFluctuations = Table[Total[
    flucClosed["NormalizedMeanSquaredFluctuations"][[2 ;; 7, i]]], {i,
     Length@flucClosed["NormalizedMeanSquaredFluctuations"][[1]]}];
colorListOpenAvg = (cFunc@slowModesOpenFluctuations)[#] & /@ slowModesOpenFluctuations;
colorListClosedAvg = (cFunc@slowModesClosedFluctuations)[#] & /@ slowModesClosedFluctuations;
GraphicsRow[{PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"][
   ExternalIdentifier["PDBStructureID", "4TVH"], "ColorList" -> colorListClosedAvg, ViewMatrix -> {{{0.0002509943251449412, 0.0009947061948996925, -0.01782470562620628, 0.1556048034726999}, {-0.001758063754508701, -0.017738440479379686`, -0.0010146479295418483`, -0.08729023414296588}, {0.01776566303041247, -0.0017694231183266954`, 0.00015142042300571567`, 3.6150345408851607`}, {0., 0., 0., 1.}}, {{3.9852855283766497`, 0., 0.5, 0.}, {0., 3.9852855283766497`, 0.5, 0.}, {0., 0., 5.275621893955077, -15.964661695412527`}, {0., 0., 1., 0.}}}, PlotLabel -> Style["Slowest six modes (Closed state) \n High fluctuations: Red Low fluctuations: Blue", Black, Bold]], PacletSymbol[
   "WolframChemistry/ProteinVisualization", "WolframChemistry`ProteinVisualization`BiomoleculePlot3D"][
   "https://files.rcsb.org/download/2pc0-assembly1.cif.gz", "ColorList" -> colorListOpenAvg, ViewMatrix -> {{{0.0067397157585003045`, -0.004818892899064937, 0.01561521443484324, -0.0067678329397113605`}, {
    0.0125174449516268, 0.012381105246939614`, -0.001581841923635056, -0.08772762535450558}, {
    0.01050572332120867, -0.01166048554802579, -0.008132851492967667, 3.3840686926427375`}, {0., 0., 0., 1.}}, {{3.5135605335852076`, 0., 0.5, 0.}, {0., 3.5135605335852076`, 0.5, 0.}, {0., 0., 3.1931965505262805`, -8.789250782823748}, {0., 0., 1., 0.}}}, PlotLabel -> Style["Slowest six modes (Open state) \n High fluctuations: Red Low fluctuations: Blue", Black, Bold]]}, ImageSize -> 700]
Out[26]=

Publisher

WolframChemistry

Version History

  • 1.0.0 – 11 September 2024

Source Metadata

Related Resources

Author Notes

The author is grateful to Dr. Melik C. Demirel and Dr. Michael Trott for helpful discussions.

License Information