Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
# Load data for the other plots
CSmethod = ""
while CSmethod not in ['SPARTA', 'UCBShift', 'ShiftX', 'consensus']:
CSmethod = input("What CS prediciton method to use? [SPARTA, UCBShift, ShiftX, consensus]")
data_source_file = './csp_stats_' + CSmethod + '.csv'
df = pd.read_csv(data_source_file)
# Setting up the figure and subplots
fig, axs = plt.subplots(2, 2, figsize=(20, 20), gridspec_kw={'height_ratios': [1, 1], 'width_ratios': [1, 1]})
plt.subplots_adjust(hspace=0.4, wspace=0.4) # Increase spacing between subplots
# Calculate residuals for each pair
df['residual_2'] = df['consensus_AF3'] - df['consensus']
sns.scatterplot(ax=axs[0, 0], x=df['consensus'], y=df['consensus_AF3'])
axs[0, 0].plot([0, 1], [0, 1], color='red') # y=x line
axs[0, 0].set_title('NMR vs AF3 CSP_Rank_Scores', fontsize=20)
axs[0, 0].set_xlabel('PDB Score', fontsize=20)
axs[0, 0].set_ylabel('AF3 Score', fontsize=20)
axs[0, 0].text(0.7, 0.1, 'PDB>AF3', color='red', fontweight='bold', fontsize=16, verticalalignment='bottom', horizontalalignment='left', transform=axs[0, 0].transAxes)
axs[0, 0].text(0.1, 0.9, 'AF3>PDB', color='red', fontweight='bold', fontsize=16, verticalalignment='top', horizontalalignment='left', transform=axs[0, 0].transAxes)
# Histogram of residuals for consensus_AF2
data = df['residual_2']
max_abs_value = max(abs(data.min()), abs(data.max()))
symmetric_range = (-max_abs_value, max_abs_value)
bin_width = (symmetric_range[1] - symmetric_range[0]) / 20
bins = np.arange(symmetric_range[0], symmetric_range[1] + bin_width, bin_width)
sns.histplot(ax=axs[0, 1], data=data, kde=True, bins=bins)
axs[0, 1].set_title('Histogram of Residuals for CSP_Rank_Score', fontsize=20)
axs[0, 1].set_xlabel('Residual', fontsize=20)
axs[0, 1].set_ylabel('Frequency', fontsize=20)
axs[0, 1].axvline(x=0.0, color='red', linestyle='-', linewidth=2)
axs[0, 1].text(0.7, 0.7, 'AF3>PDB', color='red', fontweight='bold', fontsize=16, verticalalignment='bottom', horizontalalignment='left', transform=axs[0, 1].transAxes)
axs[0, 1].text(0.05, 0.7, 'PDB>AF3', color='red', fontweight='bold', fontsize=16, verticalalignment='top', horizontalalignment='left', transform=axs[0, 1].transAxes)
df['residual_3'] = df['consensus_AF3'] - df['consensus_AF2']
# Scatter plot for consensus vs consensus_AF2
sns.scatterplot(ax=axs[1, 0], x=df['consensus_AF2'], y=df['consensus_AF3'])
axs[1, 0].plot([0, 1], [0, 1], color='red') # y=x line
axs[1, 0].set_title('AF2 vs AF3 CSP_Rank_Scores', fontsize=20)
axs[1, 0].set_xlabel('AF2 Score', fontsize=20)
axs[1, 0].set_ylabel('AF3 Score', fontsize=20)
axs[1, 0].text(0.7, 0.1, 'AF2>AF3', color='red', fontweight='bold', fontsize=16, verticalalignment='bottom', horizontalalignment='left', transform=axs[1, 0].transAxes)
axs[1, 0].text(0.1, 0.9, 'AF3>AF2', color='red', fontweight='bold', fontsize=16, verticalalignment='top', horizontalalignment='left', transform=axs[1, 0].transAxes)
# Histogram of residuals for consensus_AF2
data = df['residual_3']
max_abs_value = max(abs(data.min()), abs(data.max()))
symmetric_range = (-max_abs_value, max_abs_value)
bin_width = (symmetric_range[1] - symmetric_range[0]) / 20
bins = np.arange(symmetric_range[0], symmetric_range[1] + bin_width, bin_width)
sns.histplot(ax=axs[1, 1], data=data, kde=True, bins=bins)
axs[1, 1].set_title('Histogram of Residuals for CSP_Rank_Score', fontsize=20)
axs[1, 1].set_xlabel('Residual', fontsize=20)
axs[1, 1].set_ylabel('Frequency', fontsize=20)
axs[1, 1].axvline(x=0.0, color='red', linestyle='-', linewidth=2)
axs[1, 1].text(0.7, 0.7, 'AF3>AF2', color='red', fontweight='bold', fontsize=16, verticalalignment='bottom', horizontalalignment='left', transform=axs[1, 1].transAxes)
axs[1, 1].text(0.05, 0.7, 'AF2>AF3', color='red', fontweight='bold', fontsize=16, verticalalignment='top', horizontalalignment='left', transform=axs[1, 1].transAxes)
# Adjust spacing between subplots
plt.subplots_adjust(hspace=0.4, wspace=0.15)
plt.show()