.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery/sequence/avidin_alignment.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_sequence_avidin_alignment.py: Pairwise sequence alignment of Avidin with Streptavidin ======================================================= This script performs a pairwise sequence alignment of avidin (*Gallus gallus*) with streptavidin (*Streptomyces lavendulae*). .. GENERATED FROM PYTHON SOURCE LINES 9-48 .. image-sg:: /examples/gallery/sequence/images/sphx_glr_avidin_alignment_001.png :alt: avidin alignment :srcset: /examples/gallery/sequence/images/sphx_glr_avidin_alignment_001.png :class: sphx-glr-single-img .. code-block:: Python # Code source: Patrick Kunzmann # License: BSD 3 clause import matplotlib.pyplot as plt import biotite.sequence as seq import biotite.sequence.align as align import biotite.sequence.io.fasta as fasta import biotite.database.entrez as entrez import biotite.sequence.graphics as graphics # Download and parse protein sequences of avidin and streptavidin fasta_file = fasta.FastaFile.read(entrez.fetch_single_file( ["CAC34569", "ACL82594"], None, "protein", "fasta" )) for name, sequence in fasta_file.items(): if "CAC34569" in name: avidin_seq = seq.ProteinSequence(sequence) elif "ACL82594" in name: streptavidin_seq = seq.ProteinSequence(sequence) # Get BLOSUM62 matrix matrix = align.SubstitutionMatrix.std_protein_matrix() # Perform pairwise sequence alignment with affine gap penalty # Terminal gaps are not penalized alignments = align.align_optimal(avidin_seq, streptavidin_seq, matrix, gap_penalty=(-10, -1), terminal_penalty=False) # Draw first and only alignment # The color intensity indicates the similiarity fig = plt.figure(figsize=(8.0, 2.5)) ax = fig.add_subplot(111) graphics.plot_alignment_similarity_based( ax, alignments[0], matrix=matrix, labels=["Avidin", "Streptavidin"], show_numbers=True, show_line_position=True ) fig.tight_layout() plt.show() .. _sphx_glr_download_examples_gallery_sequence_avidin_alignment.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: avidin_alignment.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: avidin_alignment.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_