Biopython‎ > ‎Examples‎ > ‎

Inverse seq

get the reverse complement of a DNA sequence

from Bio.Seq import Seq
from Bio.Alphabet import generic_dna

my_dna = Seq("TGCAA", generic_dna)
my_dna
Seq('TGCAA', DNAAlphabet())

my_dna.complement()
Seq('ACGTT', DNAAlphabet())

my_dna.reverse_complement()
Seq('TTGCA', DNAAlphabet())

my_dna[::-1] # reverse only
Seq('AACGT', DNAAlphabet())



http://biopython.org/wiki/Seq#Complement_and_reverse_complement