Skip to content

Instantly share code, notes, and snippets.

@yfe404
Last active August 29, 2015 14:16
Show Gist options
  • Save yfe404/f042764091e9923e3fed to your computer and use it in GitHub Desktop.
Save yfe404/f042764091e9923e3fed to your computer and use it in GitHub Desktop.
A simple python program to transcript a DNA strand into a RNA one.
"""
An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'.
Given a DNA string t corresponding to a coding strand, its transcribed RNA string u is formed by replacing all occurrences of 'T' in t with 'U' in u.
Given: A DNA string t having length at most 1000 nt.
Return: The transcribed RNA string of t.
"""
import os
imput_filepath = '/tmp/rosalind_rna.txt'
try:
with open(imput_filepath) as line:
dna = line.readline()
print(str(dna.replace('T', 'U')))
except IOError as err:
print('File Error : ' + str(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment