Skip to content

Commit

Permalink
fix: handle non-normal floats in expected ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
lazear committed Sep 25, 2023
1 parent b48a45a commit 3c0f842
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion proteobench/modules/dda_quant/datapoint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import numpy as np
from dataclasses import asdict, dataclass
from datetime import datetime

Expand Down Expand Up @@ -44,7 +45,7 @@ def calculate_plot_data(self, df):
nr_missing_0 = 0
for spec in species:
f = len(df[df[spec] == True])
sum_s = (df[df[spec] == True]["1|2_expected_ratio_diff"]).sum()
sum_s = np.nan_to_num(df[df[spec] == True]["1|2_expected_ratio_diff"], nan=0, neginf=-1000, posinf=1000).sum()
ratio = sum_s / f
prop_ratio = (f / len(df)) * ratio
prop_ratios.append(prop_ratio)
Expand Down

0 comments on commit 3c0f842

Please sign in to comment.