Hello,
I can see from reading onto that Biopython's Align.PairwiseAligner.align.score() variable is:
'Calling the "score" method on the aligner with two sequences as arguments will calculate the alignment score between the two sequences'.
So I implemented that here:
matrix_names = substitution_matrices.load()
global_aligner = Align.PairwiseAligner(mode='global',substitution_matrix=substitution_matrices.load('PAM30'))
alignment = global_aligner.align(sequence1,sequence2)
alignment_score = alignment.score
alignment_identity = alignment[0].counts().identities
I wanted to ask two things:
Each pair of sequences can produce multiple alignments, with different scores. Is this score function definitely telling me the best possible score that any two alignments for these sequences can make, considering the supplied substitution matrix?
Is there a more elegant way of counting the number of identical residues between the two sequences than the way I did it above in the 'alignment_identity' variable. I presumed that this number would be identical between all of the potential alignments for two sequences, hence why I called 'alignment[0]' and checked the identical sequences in that one, but maybe that is not correct.
Thanks.