From c310094c5fbe9ea5c98315b61622c38fa8c3cf5a Mon Sep 17 00:00:00 2001 From: kedhammar Date: Wed, 29 May 2024 15:26:05 +0000 Subject: [PATCH] formatting, bugfix, remove prints --- anglerfish/anglerfish.py | 3 ++- anglerfish/demux/adaptor.py | 13 ++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/anglerfish/anglerfish.py b/anglerfish/anglerfish.py index b346f6e..0ce1337 100755 --- a/anglerfish/anglerfish.py +++ b/anglerfish/anglerfish.py @@ -277,7 +277,8 @@ def run_demux(args): sample_dists = [ ( lev.distance( - i[0], f"{x.adaptor.i7.index_seq}+{x.adaptor.i5.index_seq}".lower() + i[0], + f"{x.adaptor.i7.index_seq}+{x.adaptor.i5.index_seq}".lower(), ), x.sample_name, ) diff --git a/anglerfish/demux/adaptor.py b/anglerfish/demux/adaptor.py index 6e0cf87..74184b6 100644 --- a/anglerfish/demux/adaptor.py +++ b/anglerfish/demux/adaptor.py @@ -64,7 +64,6 @@ class AdaptorPart: def __init__(self, sequence_token: str, name: str, index_seq: str | None): # Assign attributes from args - print(name, sequence_token, index_seq) self.sequence_token: str = sequence_token self.name: str = name self.index_seq: str | None = index_seq @@ -133,14 +132,13 @@ def __init__(self, sequence_token: str, name: str, index_seq: str | None): self.len_umi_before_index = 0 self.len_umi_after_index = 0 self.len_before_index = len(split_by_index[0]) - self.len_after_index = len(split_by_index[1]) + self.len_after_index = len(split_by_index[-1]) elif not self.has_index and self.has_umi: # No index, UMI - self.len_umi_before_index = None - self.len_umi_after_index = None - self.len_before_index = len(split_by_index[0]) - self.len_after_index = len(split_by_index[1]) + raise UserWarning( + f"Adaptor {self.name} has UMI but no index. This is not supported." + ) else: # No index, no UMI @@ -149,9 +147,6 @@ def __init__(self, sequence_token: str, name: str, index_seq: str | None): self.len_before_index = None self.len_after_index = None - # Sanity check - print(self.__dict__) - def get_mask(self, insert_Ns: bool = True) -> str: """Get the mask of the adaptor part.