public
Description: repository for the code featured in the blog
Homepage: http://python.genedrift.org
Clone URL: git://github.com/nuin/beginning-python-for-bioinformatics.git
100755 21 lines (15 sloc) 0.435 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env python
 
'''third script, shows how to import a module and use the
regex module to transcribe DNA to RNA
'''
 
#import regular expression module
import re
 
#setting the DNA string
myDNA = 'ACGTTGCAACGTTGCAACGTTGCA'
 
#assigning a new regex and compiling it
#to find all Ts
regexp = re.compile('T')
 
#create a new string tha will receive
#the regex result with Us replacing Ts
myRNA = regexp.sub('U', myDNA)
 
print myRNA