Skip to content

Commit 9008eb7

Browse files
authored
Merge pull request #243 from CompOmics/fix/report-gui-fixes
Catch indexerror if no confidently identified PSMs when making report chart
2 parents 1029829 + 149216b commit 9008eb7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ms2rescore/report/charts.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,16 @@ def score_histogram(psms: Union[PSMList, pd.DataFrame]) -> go.Figure:
8181

8282
# Get score thresholds
8383
if all(psm_df["qvalue"]):
84-
score_threshold = (
85-
psm_df[psm_df["qvalue"] <= 0.01]
86-
.sort_values("qvalue", ascending=False)["qvalue"]
87-
.iloc[0]
88-
)
89-
fig.add_vline(x=score_threshold, line_dash="dash", line_color="black")
84+
try:
85+
score_threshold = (
86+
psm_df[psm_df["qvalue"] <= 0.01]
87+
.sort_values("qvalue", ascending=False)["qvalue"]
88+
.iloc[0]
89+
)
90+
except IndexError: # No PSMs below threshold
91+
pass
92+
else:
93+
fig.add_vline(x=score_threshold, line_dash="dash", line_color="black")
9094

9195
return fig
9296

0 commit comments

Comments
 (0)