# Q1 vs Q2 contact analysis¶

Here we calculate a Q1 vs Q2 plot, where Q1 refers to fraction of native contacts along a trajectory with reference to the first frame, and Q2 represents the fraction of native contacts with reference to the last.

Last executed: May 18, 2021 with MDAnalysis 1.1.1

Last updated: June 29, 2020 with MDAnalysis 1.0.0

Minimum version of MDAnalysis: 0.17.0

Packages required:

Note

The contacts.q1q2 function uses the radius_cut_q method to calculate the fraction of native contacts for a conformation by determining that atoms i and j are in contact if they are within a given radius ([FKDD07], [BHE13])

:

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PSF, DCD
from MDAnalysis.analysis import contacts

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline


## Background¶

Please see the Fraction of native contacts for an introduction to general native contacts analysis.

The test files we will be working with here feature adenylate kinase (AdK), a phosophotransferase enzyme. ([BDPW09]) The trajectory DCD samples a transition from a closed to an open conformation.

:

u = mda.Universe(PSF, DCD)


## Calculating Q1 vs Q2¶

We choose to calculate contacts for all the alpha-carbons in the protein, and define the contact radius cutoff at 8 Angstrom. contacts.q1q2 returns a contacts.Contacts object, which we can run directly.

:

q1q2 = contacts.q1q2(u, 'name CA', radius=8).run()


The data is in q1q2.timeseries. The first column of the data is always the frame number.

:

q1q2_df = pd.DataFrame(q1q2.timeseries,
columns=['Frame',
'Q1',
'Q2'])

:

Frame Q1 Q2
0 0.0 1.000000 0.946494
1 1.0 0.980926 0.949262
2 2.0 0.973660 0.952952
3 3.0 0.972752 0.951107
4 4.0 0.970027 0.948339

### Plotting¶

We can plot the fraction of native contacts over time.

:

q1q2_df.plot(x='Frame')
plt.ylabel('Fraction of native contacts')

:

Text(0, 0.5, 'Fraction of native contacts') Alternatively, we can create a Q1 vs Q2 plot to characterise the transition of AdK from its opened to closed position.

:

q1q2_df.plot(x='Q1', y='Q2', legend=False)
plt.ylabel('Q2');

:

Text(0, 0.5, 'Q2') 