I have two strings in a file like this:
>1
atggca---------gtgtggcaatcggcacat
>2
atggca---------gtgtggcaatcggcacat
Using the AlignIO function in Biopython:
from Bio import AlignIO
print AlignIO.read("neighbor.fas", "fasta")
returns this:
SingleLetterAlphabet() alignment with 2 rows and 33 columns
atggca---------gtgtggcaatcggcacat 1
atggca---------gtgtggcaatcggcacat 2
I want to calculate the percentage identity between the two rows in this alignment.
row = align[:,n]
allows for the extraction of individual columns that can be compared.
Columns that contain only "-" should not be counted.