From 3d478ac8bd2e8bdbdbb8e216f01d5ea4e3ff9e60 Mon Sep 17 00:00:00 2001 From: rnmitchell Date: Fri, 12 Jan 2024 06:17:46 -0500 Subject: [PATCH] updated empty bf code --- lusSTR/scripts/repeat.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lusSTR/scripts/repeat.py b/lusSTR/scripts/repeat.py index 76ff49c..bd34789 100644 --- a/lusSTR/scripts/repeat.py +++ b/lusSTR/scripts/repeat.py @@ -163,16 +163,17 @@ def repeat_copy_number(bf, repeat): The input is a sequence string collapsed to bracketed sequence form. """ longest = 0 - if bf != "": - for block in bf.split(" "): - if block == repeat: - if 1 > longest: - longest = 1 - match = re.match(r"\[" + repeat + r"\](\d+)", block) - if match: - length = int(match.group(1)) - if length > longest: - longest = length + if bf == "": + return 0 + for block in bf.split(" "): + if block == repeat: + if 1 > longest: + longest = 1 + match = re.match(r"\[" + repeat + r"\](\d+)", block) + if match: + length = int(match.group(1)) + if length > longest: + longest = length return str(longest)