-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransitionTransversion.py
More file actions
92 lines (49 loc) · 2.07 KB
/
Copy pathTransitionTransversion.py
File metadata and controls
92 lines (49 loc) · 2.07 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
s1='GCAACGCACAACGAAAACCCTTAGGGACTGGATTATTTCGTGATCGTTGTAGTTATTGGAAGTACGGGCATCAACCCAGTT'
s2='TTATCTGACAAAGAAAGCCGTCAACGGCTGGATAATTTCGCGATCGTGCTGGTTACTGGCGGTACGAGTGTTCCTTTGGGT'
#Method_1---------------------------------------------------------------------
transition=0
for i in range(len(s1)):
if s1[i]=='A' and s2[i]=='G' :
transition+=1
elif s1[i]=='C' and s2[i]=='T' :
transition+=1
elif s1[i]=='G' and s2[i]=='A' :
transition+=1
elif s1[i]=='T' and s2[i]=='C' :
transition+=1
print('No of transition : ',transition)
transversion=0
for i in range(len(s1)):
if (s1[i]=='A' and s2[i]=='C') or (s1[i]=='A' and s2[i]=='T') :
transversion+=1
elif (s1[i]=='G' and s2[i]=='C') or (s1[i]=='G' and s2[i]=='T') :
transversion+=1
elif (s1[i]=='C' and s2[i]=='A') or (s1[i]=='C' and s2[i]=='G') :
transversion+=1
elif (s1[i]=='T' and s2[i]=='A') or (s1[i]=='T' and s2[i]=='G') :
transversion+=1
print('No of transversion : ',transversion)
t=transition/transversion
print('ratio : ',t)
#Method_2---------------------------------------------------------------------
transition = 0
transversion = 0
for x in range(0,len(s1)):
first = s1[x]
second = s2[x]
if(first == 'A' and second == 'G') or (first == 'G' and second == 'A'):
transition += 1
elif(first == 'C' and second == 'T') or (first == 'T' and second == 'C'):
transition += 1
elif(first == 'A' and second == 'C') or (first == 'C' and second == 'A'):
transversion += 1
elif(first == 'A' and second == 'T') or (first == 'T' and second == 'A'):
transversion += 1
elif(first == 'G' and second == 'C') or (first == 'C' and second == 'G'):
transversion += 1
elif(first == 'G' and second == 'T') or (first == 'T' and second == 'G'):
transversion += 1
print("No of Transition",transition)
print("No of Transversion",transversion)
t=transition/transversion
print('ratio : ',t)