diff --git a/make_prg/utils/seq_utils.py b/make_prg/utils/seq_utils.py index 474a7de..a8d0279 100644 --- a/make_prg/utils/seq_utils.py +++ b/make_prg/utils/seq_utils.py @@ -250,7 +250,9 @@ def generate_random_seed(sequences: List[str]) -> bytes: def get_consensus_residue(position: int, sequences: List[str]) -> str: # Count the residues at this position, ignoring gaps and Ns pos_counts = Counter( - seq[position] for seq in sequences if seq[position] != GAP and seq[position] != "N" + seq[position] + for seq in sequences + if seq[position] != GAP and seq[position] != "N" ) # If there are no residues other than gaps and Ns at this position, use a random base @@ -283,4 +285,3 @@ def get_majority_consensus_from_MSA(alignment: MSA) -> str: consensus += get_consensus_residue(i, all_seqs) return consensus - diff --git a/tests/utils/test_seq_utils.py b/tests/utils/test_seq_utils.py index 653219f..73ecbad 100644 --- a/tests/utils/test_seq_utils.py +++ b/tests/utils/test_seq_utils.py @@ -596,9 +596,7 @@ def test___get_majority_consensus_from_MSA___empty_alignment(self): def test___get_majority_consensus_from_MSA___all_Ns(self): consensus = get_majority_consensus_from_MSA(self.all_N_alignment) for char in consensus: - self.assertIn( - char, "ACGT" - ) + self.assertIn(char, "ACGT") def test___get_majority_consensus_from_MSA___one_N_one_base(self): consensus = get_majority_consensus_from_MSA(self.one_N_one_base_alignment) @@ -624,7 +622,8 @@ def test___get_majority_consensus_from_MSA___lower_case_sample_alignment(self): consensus, "ACGT" ) # The consensus should be the most common base at each position - def test___get_majority_consensus_from_MSA___equally_likely_bases(self): consensus = get_majority_consensus_from_MSA(self.equally_likely_bases) - self.assertEqual(set(consensus), {'A', 'C'}) # A and C should be chosen at random + self.assertEqual( + set(consensus), {"A", "C"} + ) # A and C should be chosen at random