-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPercentGC
More file actions
32 lines (30 loc) · 766 Bytes
/
PercentGC
File metadata and controls
32 lines (30 loc) · 766 Bytes
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
# What is the percent GC content of a DNA molecule?
# Problem: the string of sequences doesn't wrap around
#Problem: not printing in a nice sentence format.
pBR322 = ('TTCTCATGTTTGACAGCTTATCATCGATAAGCTTTAATGCGGTAGTTTATCACAGTTAAATTGCTAACGCAGTCAGGCAC')
Gcount = 0
for char in pBR322:
if char =='G':
Gcount = Gcount+1
print('G equals')
print(Gcount)
Acount = 0
for char in pBR322:
if char =='A':
Acount = Acount+1
print('A equals')
print(Acount)
Ccount = 0
for char in pBR322:
if char =='C':
Ccount = Ccount+1
print('C equals')
print(Ccount)
Tcount = 0
for char in pBR322:
if char =='T':
Tcount = Tcount+1
print('T equals')
print(Tcount)
PercentGC = ((Gcount+Ccount)/(Acount+Tcount+Ccount+Gcount))*100
print(PercentGC)