Module 8
Comparing sequences
Measuring similarity between sequences.
How similar are two sequences?
You can compare two sequences by counting how many positions have the same base.
Python
seq1 = "ATGC"
seq2 = "ATGG"
matches = 0
for i in range(len(seq1)):
if seq1[i] == seq2[i]:
matches += 1
print(matches, "of", len(seq1))→ 3 of 4
Your task
Compare sequences
- Count matching positions between ATGC and ATGG.