Package Bio :: Module Transcribe
[hide private]
[frames] | no frames]

Source Code for Module Bio.Transcribe

 1  """Code to transcribe DNA into RNA or back (OBSOLETE). 
 2   
 3  You are now encouraged to use the Seq object methods or the functions 
 4  in Bio.Seq instead. 
 5   
 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. 
 8  """ 
 9   
10  from Bio import Alphabet, Seq 
11  from Bio.Alphabet import IUPAC 
12   
13 -class Transcribe:
14 - def __init__(self, dna_alphabet, rna_alphabet):
15 self.dna_alphabet = dna_alphabet 16 self.rna_alphabet = rna_alphabet
17
18 - def transcribe(self, dna):
19 assert dna.alphabet == self.dna_alphabet, \ 20 "transcribe has the wrong DNA alphabet" 21 s = dna.data 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" 26 s = rna.data 27 return Seq.Seq(s.replace("U", "T"), self.dna_alphabet)
28 29 generic_transcriber = Transcribe(Alphabet.generic_dna, 30 Alphabet.generic_rna) 31 ambiguous_transcriber = Transcribe(IUPAC.ambiguous_dna, 32 IUPAC.ambiguous_rna) 33 unambiguous_transcriber = Transcribe(IUPAC.unambiguous_dna, 34 IUPAC.unambiguous_rna) 35