Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #readFile.py
- #This function takes a file name as input and
- #reads the entire file and returns the resault as a single string
- #! /usr/bin/env python
- def readFile(str):
- file = open(str)
- return file.read()
- for i in range(1, 3):
- myVar = readFile('lab1/Sequence' + str(i) + '.txt')
- print 'C = ' + str(myVar.count('C'))
- print 'G = ' + str(myVar.count('G'))
- print 'T = ' + str(myVar.count('T'))
- print 'Total = ' + str(len(myVar))
- print 'C fraction = ' + str(float(myVar.count('C'))/len(myVar))
- print 'G fraction = ' + str(float(myVar.count('G'))/len(myVar))
- print '\n'
Add Comment
Please, Sign In to add comment