From 73533b570df060ed4e74a47078692caf0fe96871 Mon Sep 17 00:00:00 2001 From: Johannes Alneberg Date: Tue, 23 Jan 2024 09:08:04 +0100 Subject: [PATCH] Ruff formatting for entropy file --- anglerfish/explore/entropy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anglerfish/explore/entropy.py b/anglerfish/explore/entropy.py index 403d9cd..9ac733a 100644 --- a/anglerfish/explore/entropy.py +++ b/anglerfish/explore/entropy.py @@ -3,6 +3,7 @@ import numpy as np + # Rolling window implementation def _window(seq, n=3): win = deque(maxlen=n) @@ -14,12 +15,12 @@ def _window(seq, n=3): def _entropy(pk, qk): """ - Kullback-Leibler divergence (relative entropy) + Kullback-Leibler divergence (relative entropy) Reference https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html """ if np.sum(pk) - 1 > 1e-5: pk = pk / np.sum(pk) - return np.sum(pk * np.log(pk/qk)) + return np.sum(pk * np.log(pk / qk)) # Each sequence gives matrix of position and k-mer occurence.