Skip to content

Commit

Permalink
fix: Fix divide by zero error in non CT/GA mismatc
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMichelsen committed Oct 2, 2022
1 parent ea18e7a commit 3bae3c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/metaDMG/fit/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ def add_non_CT_GA_mismatches(fit_result, group_in):
bases = ["AC", "AG", "AT", "CA", "CG", "GC", "GT", "TA", "TC", "TG"]
out = []
for base in bases:
out.append(group[base].values / group[base[0]].values)
num = group[base].values
den = group[base[0]].values
ratio = np.divide(num, den, out=np.zeros_like(num), where=den != 0)
out.append(ratio)

# out = np.concatenate(out)
fit_result["non_CT_GA_damage_frequency_mean"] = np.mean(out, axis=1).mean()
Expand Down

0 comments on commit 3bae3c6

Please sign in to comment.