From 0c0aa726afeb8741be810c9f15ff379c453f1e8b Mon Sep 17 00:00:00 2001 From: pdimens Date: Fri, 28 Jun 2024 09:22:09 -0400 Subject: [PATCH] add rounding --- src/harpy/scripts/bxStats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/harpy/scripts/bxStats.py b/src/harpy/scripts/bxStats.py index 52421c6ff..29765cfcb 100755 --- a/src/harpy/scripts/bxStats.py +++ b/src/harpy/scripts/bxStats.py @@ -15,11 +15,11 @@ def writestats(x, writechrom): for _mi in x: x[_mi]["inferred"] = x[_mi]["end"] - x[_mi]["start"] try: - x[_mi]["covered_bp"] = min(x[_mi]["bp"] / x[_mi]["inferred"], 1.0) + x[_mi]["covered_bp"] = round(min(x[_mi]["bp"] / x[_mi]["inferred"], 1.0),4) except: x[_mi]["covered_bp"] = 0 try: - x[_mi]["covered_inserts"] = min(x[_mi]["insert_len"] / x[_mi]["inferred"], 1.0) + x[_mi]["covered_inserts"] = round(min(x[_mi]["insert_len"] / x[_mi]["inferred"], 1.0), 4) except: x[_mi]["covered_inferred"] = 0 outtext = f"{writechrom}\t{_mi}\t" + "\t".join([str(x[_mi][i]) for i in ["n", "start","end", "inferred", "bp", "insert_len", "covered_bp", "covered_inserts"]])