# Import all required classes
from Bio import Alphabet
from Bio.Alphabet import IUPAC
from Bio.Align.Generic import Alignment
from Bio.Seq import Seq
# Create and name our two sequences
seq1 = 'MHQAIFIYQIGYPLKSGYIQSIRSPEYDNW'
seq2 = 'MH--IFIYQIGYALKSGYIQSIRSPEY-NW'
# Initialize an alignment object
a = Alignment(Alphabet.Gapped(IUPAC.protein))
# Add the sequences to this alignment object
a.add_sequence("asp",seq1)
a.add_sequence("unk",seq2)

This code is part of the book "Python for Bioinformatics", by Sebastian Bassi (sbassi@genesdigitales.com). Return to home page.