Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding plot of BAR overlap #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions covid_moonshot/analysis/fah_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,31 @@ def plot_cumulative_distributions(results, minimum=None, maximum=5, cmap='PiYG',
plt.ylabel('Cumulative $N$ ligands')
plt.title(title)
_produce_plot(f"{filename}")

def plot_bar_distributions(results, title='', filename='BARoverlap'):
"""Plots solvent BAR overlap against complex BAR overlap with marginal distribution

>>> results = json.load(open('analysis.json','r'))
>>> plot_bar_distributions(results, 'Sprint 3')

Parameters
----------
results : list(dict)
Contents of analysis.json
title : str, default=''
Title for plot
filename : str, default='BARoverlap'
Location to save fille
"""
import numpy as np
import seaborn as sns
sns.set(style="ticks")

x = [r['analysis']['solvent_phase']['free_energy']['bar_overlap'] for r in results]
y = [r['analysis']['complex_phase']['free_energy']['bar_overlap'] for r in results]

# BAR overlap has range of 0. to 1. so set limits to represent this
sns.jointplot(x, y,kind='scatter', color="#4CB391",xlim=(0.,1.),ylim=(0.,1.)).set_axis_labels(f"Solvent BAR overlap\n{title}", "Complex BAR overlap")
_produce_plot(filename)