forked from JinyuanSun/PymolFold
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c97ecfc
commit 71076bc
Showing
5 changed files
with
142 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ cloudmol/__pycache__ | |
|
||
*dist* | ||
|
||
*build* | ||
*build* | ||
|
||
test.ipynb |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import matplotlib.patches as mpatches | ||
|
||
def plot_ca_plddt(pdb_file, size=(5,3), dpi=120): | ||
plddts = [] | ||
with open(pdb_file, "r") as f: | ||
lines = f.readlines() | ||
for line in lines: | ||
if " CA " in line: | ||
plddt = float(line[60:66]) | ||
plddts.append(plddt) | ||
if max(plddts) <= 1.0: | ||
y = np.array([plddt * 100 for plddt in plddts]) | ||
print("Guessing the scale is [0,1], we scale it to [0, 100]") | ||
else: | ||
y = np.array(plddts) | ||
x = np.arange(len(y)) + 1 | ||
|
||
# Create color array based on conditions | ||
colors = np.where(y > 90, 'blue', | ||
np.where((y > 70) & (y <= 90), 'lightblue', | ||
np.where((y > 50) & (y <= 70), 'yellow', 'orange'))) | ||
|
||
plt.figure(figsize=size, dpi=dpi) | ||
|
||
# Create scatter plot with colored markers | ||
plt.plot(x, y, color='black') | ||
plt.scatter(x, y, color=colors, zorder=10, edgecolors='black') | ||
|
||
plt.ylim(0, 100) # Make sure y axis is in range 0-100 | ||
plt.xlabel('Residue') | ||
plt.ylabel('pLDDT') | ||
plt.title('Predicted LDDT per residue') | ||
|
||
# Create legend | ||
legend_elements = [mpatches.Patch(color='blue', label='Very high'), | ||
mpatches.Patch(color='lightblue', label='Confident'), | ||
mpatches.Patch(color='yellow', label='Low'), | ||
mpatches.Patch(color='orange', label='Very low')] | ||
plt.legend(handles=legend_elements, title='Confidence', loc='upper left', bbox_to_anchor=(1, 1)) | ||
|
||
plt.tight_layout() # Make sure nothing gets cropped off | ||
plt.show() |
Large diffs are not rendered by default.
Oops, something went wrong.
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