Skip to content

Instantly share code, notes, and snippets.

@Vini2
Last active September 2, 2017 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vini2/8915ef70753e9c1c20892aca6daa6898 to your computer and use it in GitHub Desktop.
Save Vini2/8915ef70753e9c1c20892aca6daa6898 to your computer and use it in GitHub Desktop.
# Import pairwise2 module
from Bio import pairwise2
# Import format_alignment method
from Bio.pairwise2 import format_alignment
# Define two sequences to be aligned
X = "ACGGGT"
Y = "ACG"
# Get a list of the global alignments between the two sequences ACGGGT and ACG
# No parameters. Identical characters have score of 1, else 0.
# No gap penalties.
alignments = pairwise2.align.globalxx(X, Y)
# Use format_alignment method to format the alignments in the list
for a in alignments:
print(format_alignment(*a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment