-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRosalindPt1.py
48 lines (40 loc) · 4.52 KB
/
RosalindPt1.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
__author__ = 'ssen'
def countingNtV2(s):
return s.count('A'), s.count('C'),s.count('G'),s.count('T')
def countingNt(s):
numA = 0
numC = 0
numG = 0
numT = 0
for i in range(0,len(s)):
if (s[i]=='A'):
numA += 1
elif(s[i]=='C'):
numC += 1
elif(s[i]=='G'):
numG += 1
else:
numT += 1
print str(numA) + ' ' + str(numC) + ' ' + str(numG) + ' ' + str(numT)
def generateRnaFromDna(s):
return s.replace('T','U')
def reverseComplement(s):
s=s.upper().replace('A', 't').replace('C', 'g').replace('G','c').replace('T','a').upper()[::-1]
return s
def reverseComplementV2(s):
revComp = ""
for i in range(len(s)-1,-1,-1):
if (s[i]=='A'):
revComp += 'T'
elif(s[i]=='C'):
revComp += 'G'
elif(s[i]=='G'):
revComp += 'C'
else:
revComp += 'A'
return revComp
countingNt('TCCAGTCTGTCCTGTTTTATTGCTCGATCACGGCGGTCTTAAGTGGCTTGACTTTTGGCTGCAATCCTTGAGTTTGACGGATGGTATAATAGGAAACTAGTGTGTCAGCCCTTGCCACGTGTTCTTCCTTATGGTCTCTCCATCCTTGAAAGGTTCATTATCGTCGTTAGTCTGCGAGAACGACTAACTTCAACCACGACAGATTACGTACTGGGATATGACTCCAAGGTCTAAGACTTTCTTACACCGAGCCCTACTCAGTCCTGCGTGCCAGTCTCGGCAGTGCCCATCCGGGTTTGAATTGAAGGACCCCTCCGCTAGTCGGCCACTACGTACCGCATCCGACACATTCTTTCCAAGAATGTCCGATGAGTTAGGGTATTGAAAATGACAAGCTCAGATTGTGCGACCCCGAGACGCCGCTAATGAAGACTGTATTTTGAGACTCCGGGCTGCTTTGATTTCTATCGCCCTGGGTACCCTCGCACCTGTCGGGACCATTAGTTACACCGGGACGGTTCTGTAATCAGTTAAGACAAACCAGTGCTGTCGGTGAATTCGAGGGCTCGCGTACTAGATCCATGTCCGTCGTACATGTCCTTTGGGGGTGGCCTCAGCCTCCTCCCAGCCATGGACGCTTACAGGGTCTTAGCAGAGGCACGCGCTTGCAACACCATACGTAATGGATGACCTCACCCTCCGCTCGTTATGAGGGTAAAGATCCGTACGATTAGATGCCACCAATTGTCACATAGGGGACAGAAAATGCTAGATACTGCGTGCATACCTACATATCGCGAGTGGTATTCCTTC')
print countingNtV2('TCCAGTCTGTCCTGTTTTATTGCTCGATCACGGCGGTCTTAAGTGGCTTGACTTTTGGCTGCAATCCTTGAGTTTGACGGATGGTATAATAGGAAACTAGTGTGTCAGCCCTTGCCACGTGTTCTTCCTTATGGTCTCTCCATCCTTGAAAGGTTCATTATCGTCGTTAGTCTGCGAGAACGACTAACTTCAACCACGACAGATTACGTACTGGGATATGACTCCAAGGTCTAAGACTTTCTTACACCGAGCCCTACTCAGTCCTGCGTGCCAGTCTCGGCAGTGCCCATCCGGGTTTGAATTGAAGGACCCCTCCGCTAGTCGGCCACTACGTACCGCATCCGACACATTCTTTCCAAGAATGTCCGATGAGTTAGGGTATTGAAAATGACAAGCTCAGATTGTGCGACCCCGAGACGCCGCTAATGAAGACTGTATTTTGAGACTCCGGGCTGCTTTGATTTCTATCGCCCTGGGTACCCTCGCACCTGTCGGGACCATTAGTTACACCGGGACGGTTCTGTAATCAGTTAAGACAAACCAGTGCTGTCGGTGAATTCGAGGGCTCGCGTACTAGATCCATGTCCGTCGTACATGTCCTTTGGGGGTGGCCTCAGCCTCCTCCCAGCCATGGACGCTTACAGGGTCTTAGCAGAGGCACGCGCTTGCAACACCATACGTAATGGATGACCTCACCCTCCGCTCGTTATGAGGGTAAAGATCCGTACGATTAGATGCCACCAATTGTCACATAGGGGACAGAAAATGCTAGATACTGCGTGCATACCTACATATCGCGAGTGGTATTCCTTC')
print generateRnaFromDna('ACGGCCAAACAATGTTCGTCTTTACTGATGGAGGATACCCTCTCCCCGACCGAGCCGGTTGGGGACACTCGTCATCATCCTGGGGATGTCTGGTTTTTGCCCCCTCCATTCCTCTCTTAGCGAGGTCGCACCGTGAAGCTCATTAAGGAGAACTACTCCGCCCTGGTGCCACGGGGGGAGCCTTGATTTGGGGAACGTTCCGCAATACCGCGAGAATTATCGTTATACCCGCGTTTGCCCGAAATGTTAACAGTGTACGTGGACAACGGGACAGGACCGGCTATATTAGATTTTGTTGGAATAATATTTTATGGTGTCTTGAAGCGAACCCGGCGCTCGTCATTATGTAGCACATCTCGAATGCAATTTACTCTAGTGTAGCTGCTCTTTTCCAATCAAGCCTCTGGGTCTCTATCTATACAGCGAGTATCTCACGATCCCTTATCTTCACCGTTGCTCCGACAGGCGCCCGTCGTAAGTATGCGCGCTATCAGCATTCCCTATTGATGTCACCGTGAGGCGAGTGGGCCGAATCCTAGAGTCATAAGACTCGGTTATTCGGATACGCTATGGACCTTCTACGAAAGCAGGTCACCATACTCGTACAGTTAGGTAAACATCCGTCGCATCGTCGCAGGGTGACCTTCCTGCCGGCTCGTGCAAGAGGCTGGGGATGAAGTTTCGACTTTCGTTCCATCCTTATATAGGATTGAGTATAATTCGACTTCCACGACGTTGAGCTAAGCGATCCGCGCACTGTTGCATGTCTGGCTGAAGGGATCTCTATGGACCCTCGAGAGTGGCCCATAGAGCCATATCCGGAAGTCGTAAGCATCGTCTGAACACTCAAAATCACTGGCGTAAGCTTAAAGGGTTGCCACTCCGGGGAGTATAGGTACGCGGAGCTTCTTGTTGTCGGGCGCTTGCTAATTCCTGGACTTGCTACAATGGAACACGGCATTTGCCTGTGTGACACT')
print (reverseComplementV2('AAAACCCGGT'))
print (reverseComplementV2('GGCACTTGACTCTCCCCACAGTAGCGTCAATGATAACTGGCAGTCGCCCTTCTGGCACAAATTTCCTATGATCACCCTCATATGGCTAATTTGATACCGGGAGCACTTACCGGCTCTTGAGAGCTACATCACTCCTCATGGGCAGCTGTTGGTGGATTAACCTGCAGATTTGCTATTGTAAGCGAAGTACTAGTATTGTAACTCTAATTCTGAGATACCCGCCAACACTAAAACCGTGGCTCCCCTGACCTAGTGTAGAAGATCACCGTTTTCGGTCCTGCGCGTGCAGTATCCTCTGGTAGACACACATTACATTGCTCGCGGAAATAGCAACTGTTCGTTTTGAATGGGACTTACCTGAGGACTGATTAGAGATGCCCAGCTTAAAAGCCCCGCGAGACGAGACTGGAGCTCCGGTCAGAACCCCTTGTCCAAGATGAAAAGAACGACCCGACAGCGTAAACGAAATAACTTCTTATATCACATTCGGTGATGTGAGTACTCGCCTGTTCGTTTACACCCATTGATGCGGTAGAGGATATTCGTAGAAGATTGGCGTGGCCGACGTCATGAACGTGTTGTGGGCATTAGTTTGGTTTGTGAGAGTAAGTGCTAGTTATCCGATTTCCATAATCAGTCGTCGAAAACATGTGATGTGACCTGGATGGATAGAAGTCCAGTATCCGAAGTCCCAAATACAGCCCTGCTGAGAGGATTCCGCCATGCGAGTCCGACATGTGCCGTAGTAATACAGATCATCACACATCTTATTGGGTGCTCCTGAGACTCCCAATTATTCTCCAGTCCAATATTCCGACCGGCGGCTGACACAGTTTCCTTTGATACTCACAAGTCCCTGGACTGCATGCGGGTGTACATCTCACCGAACTTTGAGTCATCGTACAAGGTTGGTACTATCCCTTATGAAC'))