-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlipinski_plots.py
82 lines (54 loc) · 2.54 KB
/
lipinski_plots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#William Huang
#Bioinformatics Data Project
#Dependencies: ChemBL and rdkit (conda install -c rdkit rdkit -y)
import seaborn as sns
sns.set(style='ticks')
import matplotlib.pyplot as plt
class lipinski_plots:
df = 0
def __init__(self, df):
self.df = df
def bar_graph(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.countplot(x='class', data=df, edgecolor='black')
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('Frequency', fontsize=14, fontweight='bold')
plt.show
plt.savefig('plot_bioactivity_class.pdf')
def scatter_plot(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.scatterplot(x='MW', y='LogP', data=df, hue='class', size='pIC50', edgecolor='black', alpha=0.7)
plt.xlabel('MW', fontsize=14, fontweight='bold')
plt.ylabel('LogP', fontsize=14, fontweight='bold')
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0)
plt.savefig('plot_MW_vs_LogP.pdf')
def pIC_50_plot(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.boxplot(x='class', y='pIC50', data=df)
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('pIC50 value', fontsize=14, fontweight='bold')
plt.savefig('plot_ic50.pdf')
def mol_weight(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.boxplot(x='class', y='MW', data=df)
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('MW', fontsize=14, fontweight='bold')
plt.savefig('plot_MW.pdf')
def logP(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.boxplot(x='class', y='LogP', data=df)
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('LogP', fontsize=14, fontweight='bold')
plt.savefig('plot_LogP.pdf')
def num_hdonors(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.boxplot(x='class', y='NumHDonors', data=df)
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('NumHDonors', fontsize=14, fontweight='bold')
plt.savefig('plot_NumHDonors.pdf')
def num_hacceptors(self, df):
plt.figure(figsize=(5.5, 5.5))
sns.boxplot(x='class', y='NumHAcceptors', data=df)
plt.xlabel('Bioactivity class', fontsize=14, fontweight='bold')
plt.ylabel('NumHAcceptors', fontsize=14, fontweight='bold')
plt.savefig('plot_NumHAcceptors.pdf')