import prody as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import spearmanr, pearsonr
nmr = pd.parsePDB('1g90')
rsa = pd.parsePDB('1bxw')
nmr_residues = list(nmr.iterResidues())
rsa_residues = list(rsa.iterResidues())[1:]
nmr_filtered = list()
rsa_filtered = list()
for n, r in zip(nmr_residues, rsa_residues):
if str(n) == str(r):
nmr_filtered.append(n)
rsa_filtered.append(r)
else:
print(n, r)
RMSFs = [np.mean(pd.calcRMSF(res)) for res in nmr_filtered]
betas = [np.mean(res.getBetas()) for res in rsa_filtered]
fig, ax = plt.subplots()
ax.scatter(RMSFs, betas, s=1)
ax.set_xlabel("RMSF")
ax.set_ylabel("B-фактор")
#ax.set_ylim([5,40])
fig.show()
RMSFs_filtered = list()
betas_filtered = list()
for r, b in zip(RMSFs, betas):
if b != 20:
RMSFs_filtered.append(r)
betas_filtered.append(b)
fig, ax = plt.subplots()
ax.scatter(RMSFs_filtered, betas_filtered, s=1)
ax.set_xlabel("RMSF")
ax.set_ylabel("B-фактор")
fig.show()
spearmanr(RMSFs_filtered, betas_filtered)
pearsonr(RMSFs_filtered, betas_filtered)
fig, ax = plt.subplots()
ax.scatter(RMSFs_filtered, betas_filtered, s=1)
ax.set_xlabel("RMSF")
ax.set_ylabel("B-фактор")
ax.set_ylim([20,80])
ax.set_xlim([0,4])
fig.show()