Permalink
Cannot retrieve contributors at this time
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?
CSP_Rank/fig1.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80 lines (68 sloc)
2.49 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import pandas as pd | |
from matplotlib.gridspec import GridSpec | |
from util import * | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
from matplotlib.gridspec import GridSpec | |
data_source_file = './CSPRANK.csv' | |
parsed_data = pd.read_csv(data_source_file) | |
# parsed_data['AF2_TM_top_rank'] = pd.to_numeric(parsed_data['AF2_TM_top_rank'], errors='coerce') | |
# parsed_data['AF2_TM_top_rank'] = parsed_data['AF2_TM_top_rank'].astype(float) | |
parsed_data.dropna(subset=['AF2_TM_top_rank','AF2_DockQ_top_rank'], inplace=True) | |
# Ensure columns are numeric | |
parsed_data['AF2_TM_top_rank'] = pd.to_numeric(parsed_data['AF2_TM_top_rank'], errors='coerce') | |
parsed_data['AF2_DockQ_top_rank'] = pd.to_numeric(parsed_data['AF2_DockQ_top_rank'], errors='coerce') | |
# Drop rows that are still NaN | |
parsed_data.dropna(subset=['AF2_TM_top_rank','AF2_DockQ_top_rank'], inplace=True) | |
fig = plt.figure(figsize=(10, 10)) | |
gs = GridSpec(4, 4, figure=fig) | |
ax_main = fig.add_subplot(gs[1:4, 0:3]) | |
ax_x_hist = fig.add_subplot(gs[0, 0:3], sharex=ax_main) | |
ax_y_hist = fig.add_subplot(gs[1:4, 3], sharey=ax_main) | |
sns.scatterplot( | |
x='AF2_DockQ_top_rank', | |
y='AF2_TM_top_rank', | |
data=parsed_data, | |
ax=ax_main | |
) | |
ax_main.set_xlabel('AF2 DockQ Top Rank') | |
ax_main.set_ylabel('AF2 TM Top Rank') | |
ax_main.axhline(y=0.8, color='red', linestyle='--') | |
ax_main.axvline(x=0.4, color='red', linestyle='--') | |
ax_main.fill_betweenx(y=[0.8, 1], x1=0.4, x2=1, color='gray', alpha=0.3) | |
ax_main.set_title('Scatterplot: AF2 DockQ Top Rank vs AF2 TM Top Rank') | |
ax_main.set_xlim(0, 1) | |
ax_main.set_ylim(0, 1) | |
sns.histplot( | |
data=parsed_data, | |
x='AF2_DockQ_top_rank', | |
bins=30, | |
kde=False, | |
ax=ax_x_hist | |
) | |
ax_x_hist.set_ylabel('Frequency') | |
ax_x_hist.set_xlim(0, 1) | |
# ax_x_hist.set_title('Histogram: AF2 DockQ Top Rank') | |
# print(parsed_data['AF2_TM_top_rank']) | |
# parsed_data['AF2_TM_top_rank'] = pd.to_numeric(parsed_data['AF2_TM_top_rank'], errors='coerce') | |
# print(parsed_data['AF2_TM_top_rank']) | |
sns.histplot( | |
data=parsed_data, | |
y='AF2_TM_top_rank', | |
bins=30, | |
kde=False, | |
ax=ax_y_hist, | |
orientation='horizontal' | |
) | |
ax_y_hist.set_xlabel('Frequency') | |
ax_y_hist.set_ylim(0, 1) | |
ax_y_hist.set_title('Histogram: AF2 TM Top Rank') | |
# Hide overlapping tick labels | |
plt.setp(ax_x_hist.get_xticklabels(), visible=False) | |
plt.setp(ax_y_hist.get_yticklabels(), visible=False) | |
plt.tight_layout() | |
plt.savefig('./Figures/AF2_DockQ_vs_TM_top_rank_scatterplot_with_histograms.png') | |
plt.close() |