KKULHARIA LABComputational Biology & BioinformaticsProf. Mahesh Kulharia
Central University of Himachal Pradesh
Bioinfo Compass

Transcription, reverse complement and translation

Reverse complement

DNA strands pair A with T and C with G. To write the reverse complement, complement each base and reverse the order.

from bioinfo_practice import reverse_complement
print(reverse_complement("AAGC"))  # GCTT

Transcription

For a coding-strand DNA representation, replace T with U to write the corresponding RNA sequence.

from bioinfo_practice import transcribe
print(transcribe("ATGGCTTAA"))  # AUGGCUUAA

Translate a coding frame

Translation reads groups of three bases, called codons. The bundled function uses the standard genetic code, accepts frame 0, 1 or 2, requires complete codons, and stops at the first stop codon.

from bioinfo_practice import translate
print(translate("ATGGCTTAA"))  # MA*

Frame is essential: starting at index 0, 1 or 2 yields different codons. This example assumes the supplied sequence is already the coding strand in the intended frame. A DNA sequence alone does not establish its strand, gene boundaries or genetic code.

Exercises

  1. Translate ATG GCT TAA.
  2. What is the reverse complement of AAGC?
  3. Why is ATGAA rejected by this translator?
Worked answers

MA*; GCTT; the length is not divisible by three in the chosen frame, so the final partial codon cannot be translated by this simple function.