1 """Code to transcribe DNA into RNA or back (OBSOLETE).
3 You are now encouraged to use the Seq object methods or the functions
6 This module is now considered to be obsolete, and is likely to be deprecated
7 in a future release of Biopython, and later removed.
10 from Bio import Alphabet, Seq
11 from Bio.Alphabet import IUPAC
14 def __init__(self, dna_alphabet, rna_alphabet):
15 self.dna_alphabet = dna_alphabet
16 self.rna_alphabet = rna_alphabet
18 def transcribe(self, dna):
19 assert dna.alphabet == self.dna_alphabet, \
20 "transcribe has the wrong DNA alphabet"
22 return Seq.Seq(s.replace("T", "U"), self.rna_alphabet)
23 def back_transcribe(self, rna):
24 assert rna.alphabet == self.rna_alphabet, \
25 "back transcribe has the wrong RNA alphabet"
27 return Seq.Seq(s.replace("U", "T"), self.dna_alphabet)
29 generic_transcriber = Transcribe(Alphabet.generic_dna,
31 ambiguous_transcriber = Transcribe(IUPAC.ambiguous_dna,
33 unambiguous_transcriber = Transcribe(IUPAC.unambiguous_dna,
34 IUPAC.unambiguous_rna)