Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5f3cdff
Added manual function for running github actions and added pipeline e…
okkevaneck Aug 12, 2023
48de941
Forget variable sign
okkevaneck Aug 12, 2023
e57944d
Another try
okkevaneck Aug 12, 2023
eeab8e1
Another one
okkevaneck Aug 12, 2023
36fb5c3
Different appraoch
okkevaneck Aug 12, 2023
260b476
Changed usage
okkevaneck Aug 12, 2023
0b03a58
Removed brackets to don't reploy on push for non-master branches
okkevaneck Aug 12, 2023
666d893
Removed condition statements, as they might already be added by the i…
okkevaneck Aug 12, 2023
a06c2ef
Changed to string eval of true as github actions is possibly broken b…
okkevaneck Aug 12, 2023
f988140
Removed string eval as it appearently works
okkevaneck Aug 12, 2023
021e74d
Fix/locate version module from @rubenhorn (#58)
okkevaneck Aug 12, 2023
a44e3b8
Added specific typing for the pull_request workflow
okkevaneck Aug 12, 2023
8145e22
Merge branch 'develop' of github.com:OkkeVanEck/prospr into develop
okkevaneck Aug 12, 2023
386c327
Fixed typo
okkevaneck Aug 12, 2023
0d2e838
Added dependencies with develop as root branch (#59)
okkevaneck Aug 12, 2023
b37a36b
Upped version
okkevaneck Aug 12, 2023
d193104
Merged master into develop. Shouldn't be needed, but here we are.
okkevaneck Oct 22, 2025
212b9b7
Updated the archives
okkevaneck Oct 22, 2025
1bf2d5d
Added export_protein(protein, path) for writing PDB files (#71)
rubenhorn Oct 23, 2025
25babe5
Upated Mol* link syntax
okkevaneck Oct 26, 2025
0dc5b5b
Enable PDF generation in Read the Docs config (#74)
rubenhorn Oct 26, 2025
4671b21
Removed the push trigger for CI/CD to prevent unwanted executions.
okkevaneck Oct 26, 2025
b8ac39b
Bumped version of Numpy to v2.0.0 in order to overcome multiarray re-…
okkevaneck Oct 26, 2025
2677bb5
Changed github.ref to github.base_ref to allow for deployment on merg…
okkevaneck Oct 26, 2025
84b1447
Added an actions trigger for push on master branch
okkevaneck Oct 26, 2025
a1e50c1
Merge branch 'master' into develop
okkevaneck Oct 26, 2025
5bcb922
Merge branch 'master' of github.com:OkkeVanEck/prospr into develop
okkevaneck Nov 12, 2025
a8ce69c
Bumped version for deploy on master
okkevaneck Nov 12, 2025
4bf584f
Upgraded the pre-commit config to be functional
okkevaneck Nov 12, 2025
4df9c55
Bumped version for future merge
okkevaneck Nov 12, 2025
873811c
Ran pre-commit
okkevaneck Nov 12, 2025
7fbd9a2
Checkpoints for depth_first_bnb (#77) - Author: Ruben Horn
rubenhorn Dec 7, 2025
10ede7c
Merge branch 'master' into develop
okkevaneck Dec 7, 2025
ff4754c
Bump version for next merge
okkevaneck Dec 7, 2025
973df10
Merge branch 'develop' of github.com:OkkeVanEck/prospr into develop
okkevaneck Dec 7, 2025
7c3f2e6
Solved dfs_bnb checkpointing type problems. 1) Iterations do wrap-aro…
okkevaneck Jan 15, 2026
4056876
Merged forgotten master commits into develop
okkevaneck Jan 15, 2026
705297c
Updated the visualizer to correctly scale aminos
okkevaneck Feb 5, 2026
9567e00
Pulled master and resolved conflicts
okkevaneck Feb 5, 2026
51f1ac8
Upped version for next changes
okkevaneck Feb 5, 2026
782e668
Increased edgewidth size for P amino acids
okkevaneck Feb 5, 2026
06f315b
Merged with master
okkevaneck Feb 5, 2026
2afb014
Shifted the legend to the center right
okkevaneck Feb 5, 2026
cd8de81
Made box for legend smaller.
okkevaneck Feb 5, 2026
7ef6087
Merge branch 'master' of github.com:OkkeVanEck/prospr into develop
okkevaneck Feb 5, 2026
a750b55
Removed notion of minimum edge size
okkevaneck Feb 5, 2026
927ee0a
Merge branch 'master' of github.com:OkkeVanEck/prospr into develop
okkevaneck Feb 6, 2026
edc4dbf
Changed annotated_first amino to be a diamond shape and with pink color
okkevaneck Feb 6, 2026
8238910
Removed marker_first initialization
okkevaneck Feb 6, 2026
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
2 changes: 1 addition & 1 deletion prospr/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.14"
__version__ = "1.2.15"
212 changes: 112 additions & 100 deletions prospr/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Global colors.
COLOR_H = "tab:blue"
COLOR_P = "orange"
COLOR_ANNOTATE = "#00ce00"
COLOR_ANNOTATE = "#ff00ff"
COLOR_CONTACT = "indianred"
COLOR_CHAIN = "black"

Expand All @@ -43,13 +43,16 @@ def _plot_aminos_2d_basic(
:param float markersize: Size of the markers.
:param bool annotate_first: Annotate first amino acid.
"""
# Plot protein chain.
ax.plot(
df["x"], df["y"], color=COLOR_CHAIN, alpha=0.65, zorder=1, lw=linewidth
)

# Plot all aminos except first as it might be annotated.
sns.scatterplot(
x="x",
y="y",
data=df,
data=df.iloc[1:],
hue="Type",
hue_order=["H", "P"],
style="Type",
Expand All @@ -60,26 +63,26 @@ def _plot_aminos_2d_basic(
ax=ax,
)

# Plot first point with a green edge color.
# Plot the first amino acid as a diamond when annotating it.
if df.iloc[0]["Type"] == "H":
facecolor = COLOR_H
marker_first = "o"
elif df.iloc[0]["Type"] == "P":
facecolor = COLOR_P
marker_first = "s"

if annotate_first:
if df.iloc[0]["Type"] == "H":
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
marker="o",
fc=COLOR_ANNOTATE,
s=markersize,
zorder=2,
)
else:
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
marker="s",
fc=COLOR_ANNOTATE,
s=markersize,
zorder=2,
)
facecolor = COLOR_ANNOTATE
marker_first = "D"

ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
fc=facecolor,
marker=marker_first,
s=markersize,
zorder=2,
)

# Plot dotted lines between the aminos that increase the stability.
pairs = get_scoring_pairs(protein)
Expand Down Expand Up @@ -115,11 +118,7 @@ def _plot_aminos_2d_paper(
if markersize < PAPER_MARKERSIZE:
edgewidth *= 2

# Split dataframe on amino acid type.
df_H = df.loc[df["Type"] == "H"]
df_P = df.loc[df["Type"] == "P"]

# Plot protein.
# Plot protein chain.
ax.plot(
df["x"],
df["y"],
Expand All @@ -128,10 +127,12 @@ def _plot_aminos_2d_paper(
linewidth=linewidth,
zorder=1,
)

# Plot everything but the first amino acid as it might be annotated.
sns.scatterplot(
x="x",
y="y",
data=df_H,
data=df.iloc[1:].loc[df["Type"] == "H"],
marker="o",
facecolor=COLOR_H,
edgecolor=COLOR_H,
Expand All @@ -143,7 +144,7 @@ def _plot_aminos_2d_paper(
sns.scatterplot(
x="x",
y="y",
data=df_P,
data=df.iloc[1:].loc[df["Type"] == "P"],
marker="o",
facecolor="white",
edgecolor=COLOR_P,
Expand All @@ -154,31 +155,29 @@ def _plot_aminos_2d_paper(
label="P",
)

# Plot first point with a green edge color.
# Plot the first amino acid as a diamond when annotating it.
if df.iloc[0]["Type"] == "H":
edgecolor = COLOR_H
facecolor = COLOR_H
elif df.iloc[0]["Type"] == "P":
edgecolor = COLOR_P
facecolor = "white"
marker_first = "o"

if annotate_first:
# Plot first point with a different color.
if df.iloc[0]["Type"] == "H":
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
marker="o",
fc=COLOR_H,
ec=COLOR_ANNOTATE,
lw=edgewidth,
s=markersize,
zorder=2,
)
else:
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
marker="o",
fc="white",
ec=COLOR_ANNOTATE,
lw=edgewidth,
s=markersize,
zorder=2,
)
marker_first = "D"
edgecolor = COLOR_ANNOTATE

ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
marker=marker_first,
fc=facecolor,
ec=edgecolor,
lw=edgewidth,
s=markersize,
zorder=2,
)

# Plot dotted lines between the aminos that increase the stability.
pairs = get_scoring_pairs(protein)
Expand Down Expand Up @@ -210,10 +209,7 @@ def _plot_aminos_3d_basic(
:param float markersize: Size of the markers.
:param bool annotate_first: Annotate first amino acid.
"""
# Split dataframe on amino acid type.
df_H = df.loc[df["Type"] == "H"]
df_P = df.loc[df["Type"] == "P"]

# Plot protein chain.
ax.plot(
df["x"],
df["y"],
Expand All @@ -224,28 +220,49 @@ def _plot_aminos_3d_basic(
lw=linewidth,
)

# Plot the aminos connected with an opaque line.
# Plot all except the first amino acid, as it might be annotated.
ax.scatter(
df_H["x"],
df_H["y"],
df_H["z"],
df.iloc[1:].loc[df["Type"] == "H"]["x"],
df.iloc[1:].loc[df["Type"] == "H"]["y"],
df.iloc[1:].loc[df["Type"] == "H"]["z"],
c=COLOR_H,
marker="o",
depthshade=False,
s=markersize,
label="H",
)
ax.scatter(
df_P["x"],
df_P["y"],
df_P["z"],
df.iloc[1:].loc[df["Type"] == "P"]["x"],
df.iloc[1:].loc[df["Type"] == "P"]["y"],
df.iloc[1:].loc[df["Type"] == "P"]["z"],
c=COLOR_P,
marker="s",
depthshade=False,
s=markersize,
label="P",
)

# Plot the first amino acid as a diamond when annotating it.
if df.iloc[0]["Type"] == "H":
facecolor = COLOR_H
elif df.iloc[0]["Type"] == "P":
facecolor = "white"
marker_first = "o"

if annotate_first:
facecolor = COLOR_ANNOTATE
marker_first = "D"

ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
df.iloc[0]["z"],
fc=facecolor,
marker=marker_first,
s=markersize,
zorder=2,
)

# Plot dotted lines between the aminos that increase the stability.
pairs = get_scoring_pairs(protein)

Expand Down Expand Up @@ -278,11 +295,7 @@ def _plot_aminos_3d_paper(
if markersize < PAPER_MARKERSIZE:
edgewidth *= 2

# Split dataframe on amino acid type.
df_H = df.loc[df["Type"] == "H"]
df_P = df.loc[df["Type"] == "P"]

# Plot protein.
# Plot protein chain.
ax.plot(
df["x"],
df["y"],
Expand All @@ -293,10 +306,11 @@ def _plot_aminos_3d_paper(
zorder=1,
)

# Plot everything but the first amino acid as it might be annotated.
ax.scatter(
df_H["x"],
df_H["y"],
df_H["z"],
df.iloc[1:].loc[df["Type"] == "H"]["x"],
df.iloc[1:].loc[df["Type"] == "H"]["y"],
df.iloc[1:].loc[df["Type"] == "H"]["z"],
marker="o",
edgecolor=COLOR_H,
s=markersize,
Expand All @@ -305,9 +319,9 @@ def _plot_aminos_3d_paper(
depthshade=False,
)
ax.scatter(
df_P["x"],
df_P["y"],
df_P["z"],
df.iloc[1:].loc[df["Type"] == "P"]["x"],
df.iloc[1:].loc[df["Type"] == "P"]["y"],
df.iloc[1:].loc[df["Type"] == "P"]["z"],
marker="o",
facecolor="white",
edgecolor=COLOR_P,
Expand All @@ -318,32 +332,30 @@ def _plot_aminos_3d_paper(
depthshade=False,
)

# Plot first point with a green edge color.
# Plot the first amino acid as a diamond when annotating it.
if df.iloc[0]["Type"] == "H":
edgecolor = COLOR_H
facecolor = COLOR_H
if df.iloc[0]["Type"] == "P":
edgecolor = COLOR_P
facecolor = "white"
marker_first = "o"

if annotate_first:
if df.iloc[0]["Type"] == "H":
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
df.iloc[0]["z"],
marker="o",
fc=COLOR_H,
ec=COLOR_ANNOTATE,
lw=edgewidth,
s=markersize,
zorder=2,
)
else:
ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
df.iloc[0]["z"],
marker="o",
fc="white",
ec=COLOR_ANNOTATE,
lw=edgewidth,
s=markersize,
zorder=2,
)
marker_first = "D"
edgecolor = COLOR_ANNOTATE

ax.scatter(
df.iloc[0]["x"],
df.iloc[0]["y"],
df.iloc[0]["z"],
marker=marker_first,
fc=facecolor,
ec=edgecolor,
lw=edgewidth,
s=markersize,
zorder=2,
)

# Plot dotted lines between the aminos that increase the stability.
pairs = get_scoring_pairs(protein)
Expand Down Expand Up @@ -483,7 +495,7 @@ def plot_protein(
linestyle=":",
linewidth=linewidth,
alpha=0.9,
label="Bond",
label="Contact",
)
handles.append(score_patch)
labels.append(score_patch.get_label())
Expand Down
26 changes: 17 additions & 9 deletions tests/visualize/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ def test_2d_visualization(self, show=False):
"""
Test the 2D plotting in all different styles.
"""
p = Protein("HPHPPPPPPP", dim=2, model="HP")
p.set_hash([-1, -1, 2, 2, 2, 2, 2, 2, 2])
plot_protein(p, style="paper", show=False)

p = Protein("HPPHPPHPPH", dim=2, model="HP")
p.set_hash([-1, -2, 1, -2, 1, 2, 1, 2, -1])
plot_protein(p, style="paper", show=False)
Expand Down Expand Up @@ -50,13 +46,25 @@ def test_2d_visualization(self, show=False):
p.set_hash([-1, -1, 2, 2, -1, 2, 2, 1, -2, 1, -2, 1, -2, -1])
plot_protein(p, style="basic", legend=False, show=False)

p = Protein("PHPHHPPPHHPHPHH", dim=2, model="HP")
p.set_hash([-1, -1, 2, 2, -1, 2, 2, 1, -2, 1, -2, 1, -2, -1])
plot_protein(p, style="paper", legend_style="inner", show=False)

p = Protein("HPPHPPPHPPPPPHH", dim=2, model="HP")
p.set_hash([-1, -2, 1, -2, 1, 2, 2, 1, 2, 2, -1, -1, -2, 1])
plot_protein(p, style="paper", legend_style="inner", show=False)
plot_protein(
p,
style="paper",
legend_style="inner",
annotate_first=True,
show=False,
)

p = Protein("PHPPPHPPPPPHH", dim=2, model="HP")
p.set_hash([1, -2, 1, 2, 2, 1, 2, 2, -1, -1, -2, 1])
plot_protein(
p,
style="paper",
legend_style="inner",
annotate_first=True,
show=False,
)

p = Protein("HHPHPHPPPHPHHHPPPPPPHPPPH", dim=2, model="HP")
p.set_hash(
Expand Down
Loading