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 27 lines (21 sloc) 0.493 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/env python
 
'''
Python functions
'''
 
def add_tail(seq):
    '''function that adds a poly-T tail to sequences'''
    result = seq + 'TTTTTTTTTTTTTTTTTTTTT'
    return result
 
#opening the file
dnafile = 'AY162388.seq'
file = open(dnafile, 'r')
 
#reading the sequence from the file
sequence = ''
for line in file:
    sequence += line.strip()
 
#printing result
print sequence
#calling the function to add the tail
sequence = add_tail(sequence)
#printing new sequence
print sequence