def hamming_distance(seq_1, seq_2, ignore_case): """Hamming distance between two sequences Calculate the Hamming distance between SEQ_1 and SEQ_2. """ result = pb.hamming_distance(seq_1, seq_2, ignore_case=ignore_case) click.echo(result)
def test_hamming_distance_ignore_case(): expect = 0 result = pb.hamming_distance("CAGATA", "cagata", ignore_case=True) assert result == expect
def test_hamming_distance_different_case(): expect = 6 result = pb.hamming_distance("CAGATA", "cagata", ignore_case=False) assert result == expect
def test_hamming_distance_error(): with pytest.raises(ValueError): pb.hamming_distance("CAGATA", "CACACACA")
def test_hamming_distance_many(): expect = 6 result = pb.hamming_distance("CAGATA", "GTCTAT") assert result == expect
def test_mutate_sequence_aa_many(sample_aa_sequence): result = pb.mutate_sequence(sample_aa_sequence, mutations=10, alphabet="aa") assert len(result) == len(sample_aa_sequence) assert set(result) == set(pb._AA_LIST) assert pb.hamming_distance(sample_aa_sequence, result) <= 10
def test_mutate_sequence_nt_many(sample_nt_sequence): result = pb.mutate_sequence(sample_nt_sequence, mutations=10) assert len(result) == len(sample_nt_sequence) assert set(result) == set(pb._NT_LIST) assert pb.hamming_distance(sample_nt_sequence, result) <= 10
def test_hamming_distance_one(): expect = 1 result = pb.hamming_distance("CAGATA", "CACATA") assert result == expect
def test_hamming_distance_zero(): expect = 0 result = pb.hamming_distance("CAGATA", "CAGATA") assert result == expect