Skip to content

Commit

Permalink
ENH Add four more features
Browse files Browse the repository at this point in the history
Resize everything so that it fits
  • Loading branch information
luispedro committed Jan 21, 2024
1 parent 82ff0f2 commit ec21a24
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions Manuscript_Analysis/07_c_AMP_features_comparison.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# Here we will show how c_AMPs from AMPSphere are relatively similar to those in the training set of Macrel (Santos-Júnior et al., 2020) and DRAMP 3.0 (Shi et al., 2021). To that, we will use pre-computed features calculated using Macrel's internal scripts from the peptide sequences in those three databases.

import pandas as pd
Expand All @@ -16,7 +14,7 @@
makedirs('figures', exist_ok=True)
plt.rcParams['svg.fonttype'] = 'none'
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['xtick.labelsize'] = 'smaller'
plt.rcParams['xtick.labelsize'] = 7

ampsphere = pd.read_csv('../data_folder/ampsphere_v2022-03.features.tsv.gz', sep="\t")
dramp = pd.read_csv('../data_folder/dramp_v3.features.tsv.gz', sep="\t")
Expand Down Expand Up @@ -66,31 +64,39 @@ def getlims(feat):
xmax = xs[-cut]
return xmin, xmax

for f in ['smallAA', 'basicAA', 'polarAA', 'aromaticAA', 'chargedAA']:
for feats in [ampsphere, dramp, macrel, neg_macrel]:
feats[f] *= 100
panels = [
('length', 'Length (residues)'),
('smallAA', 'Small residues'),
('basicAA', 'Basic residues'),
('smallAA', 'Small residues (%)'),
('basicAA', 'Basic residues (%)'),
('polarAA', 'Polar residues (%)'),
('aromaticAA', 'Aromatic residues (%)'),
('chargedAA', 'Charged residues (%)'),
('pI', 'Isoelectric point'),
('charge', 'Charge at pH 7.0'),
('aindex', 'Aliphatic index'),
('instaindex', 'Instability index'),
('boman', 'Boman index'),
('hmoment', 'Hydrophobic\nmoment'),
('hydro_ratio','Hydrophobic ratio'),
('hydrophobicity','Hydrophobicity'),
('flexibility','Flexibility'),
('gravy', 'GRAVY'),
]

PANEL_WIDTH = 0.2
SUBPANEL_HEIGHT = 0.07
SUBPANEL_HEIGHT = 0.05

fig = plt.figure()
for ix,(feat,label) in enumerate(panels):
pos_i = ix % 4
pos_j = ix // 4
ax0 = fig.add_axes([.025 + pos_i * .25, 0.075 + pos_j * .3, PANEL_WIDTH, SUBPANEL_HEIGHT])
ax1 = fig.add_axes([.025 + pos_i * .25, 0.100 + pos_j * .3, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
ax2 = fig.add_axes([.025 + pos_i * .25, 0.125 + pos_j * .3, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
ax3 = fig.add_axes([.025 + pos_i * .25, 0.150 + pos_j * .3, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
pos_j = 3 - ix // 4
ax0 = fig.add_axes([.025 + pos_i * .25, 0.075 + pos_j * .23, PANEL_WIDTH, SUBPANEL_HEIGHT])
ax1 = fig.add_axes([.025 + pos_i * .25, 0.100 + pos_j * .23, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
ax2 = fig.add_axes([.025 + pos_i * .25, 0.125 + pos_j * .23, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
ax3 = fig.add_axes([.025 + pos_i * .25, 0.150 + pos_j * .23, PANEL_WIDTH, SUBPANEL_HEIGHT], sharex=ax0)
for data,data_label,ax,c in zip([neg_macrel, macrel, dramp, ampsphere],
['Macrel (neg)', 'Macrel (pos)', 'DRAMP', 'AMPSphere'],
[ax0, ax1, ax2, ax3],
Expand All @@ -100,6 +106,7 @@ def getlims(feat):
sns.kdeplot(ax=ax,
fill=True,
bw_method='silverman',
bw_adjust=(2. if feat.endswith('AA') else 1.),
cut=0,
data=data,
x=feat,
Expand Down

0 comments on commit ec21a24

Please sign in to comment.