Entering edit mode
5.8 years ago
brimaloney24
•
0
I have an alignment of a gene across species from MAFFT, I am hoping to create a pairwise alignment of each of the species in this alignment such that each species is compared to each other using Biopython. Seq1 vs Seq2 Seq1 vs Seq3 Seq1 vs Seq4 ect. From there, I hope to be able to pick out all of the nucleotide differences between each pair. currently, I have been able to read in the Mafft file as a clustal format and double checked that each species can be read as a sequence record. I know it will require an iteration and the pairwise2 command but I am a bit lost beyond that
import itertools, sys
from Bio import AlignIO, SeqIO, pairwise2
alignment = AlignIO.read("beluga slit1 alignment cluster.txt", "clustal")
print(alignment)
print ("Alignment length %i" % alignment.get_alignment_length())
for record in alignment:
print ("%s %i" % record.id, len(record)))
How is this different to your other question here: C: Resources for absolute Beginner? and analyzing MAFFT alignment in Biopython ??
Also, see the link in my comment on that thread which shows you exactly how to do combinatorial pairwise alignments.