Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
leoisl committed Jul 13, 2023
1 parent 2089324 commit 7454a89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions make_prg/utils/seq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -283,4 +285,3 @@ def get_majority_consensus_from_MSA(alignment: MSA) -> str:
consensus += get_consensus_residue(i, all_seqs)

return consensus

9 changes: 4 additions & 5 deletions tests/utils/test_seq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit 7454a89

Please sign in to comment.