DNA (deoxyribonucleic acid) is made up of pentose Sugar, nitrogenous bases, and phosphate. DNA has a backbone of sugar and phosphate. As we all know DNA is a double helical structure (Watson & crick model) and both the strand of DNA are complementary to each other.
In the previous article(Click here ), we learned how to find out the complementary Sequence of DNA strands using the python program. In this, we are going to learn how we can use the python program to find out the reverse strand and reverse complementary strand of DNA.
For example, suppose we have a DNA strand “GGTACTGACCTGA” and a complementary strand for this is “CCATGACTGGACT”. For the given strand of DNA, the reverse strand is “AGTCCAGTCATGG” and the reverse complement of the given DNA is “TCAGGTCAGTACC”.
IUPAC Degeneracies
Base | Name | Bases Represented | Complementary Base |
A | Adenine | A | T |
T | Thymidine | T | A |
U | Uridine (in RNA) | U | A |
G | Guanidine | G | C |
C | Cytidine | C | G |
Y | pyrimidine | C T | R |
R | purine | A G | Y |
In python programming, there are several ways to find the reverse and reverse complementary of a DNA strand.
Method 1
#install the package biopython using pip install biopython from Bio.Seq import Seq # Create a DNA sequence object dna = Seq("GGTACTGACCTGA") # Find the reverse of the DNA sequence reverse_dna = dna[::-1] print("Reverse DNA:", reverse_dna) # Find the reverse complement of the DNA sequence reverse_complement = dna.reverse_complement() print("Reverse complement:", reverse_complement)
Output:
Reverse DNA: AGTCCAGTCATGG Reverse complement: TCAGGTCAGTACC
Method 2
# DNA sequence dna = ("GGTACTGACCTGA") # Reverse DNA sequence reverse_dna = dna[::-1] print("Reverse DNA:", reverse_dna) # Reverse complement DNA sequence complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'} reverse_complement = "".join(complement.get(base, base) for base in reversed(dna)) print("Reverse complement:", reverse_complement)
Output:
Reverse DNA: AGTCCAGTCATGG Reverse complement: TCAGGTCAGTACC