Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions 3rd-gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,30 @@


def read_csv(filename):
records = []
with open(filename, 'rt') as fp:
reader = csv.reader(fp, delimiter=',')
for ii, row in enumerate(reader):
if ii > 0:
records.append(row)

return records
next(reader)
return list(reader)


codons = read_csv('codon-table-grouped.csv')
#print(codons)

c2s= {}
for c in codons:
c2s[c[1]] = c[0]
c2s= {amino: codon for codon, amino in codons}
print(c2s)


virvac = read_csv("side-by-side.csv")
#print(virvac)

matches = 0

for element in virvac:

vir = element[1]
vac = element[2]
for (_, vir, vac) in virvac:

print(f'{vir} v {vac}, amino: {c2s[vir]} == {c2s[vac]}.')

our = vir

if vir[2] == 'G' or vir[2] == 'C':
if vir[2] in ['G','C']:
print('codon ended on G or C already, not doing anything')

else:
Expand All @@ -46,7 +36,7 @@ def read_csv(filename):
print('amino acid still the same, done!')
our = prop
else:
print(f'Oops, maino acid changed. Trying C, new candidate {prop}')
print(f'Oops, amino acid changed. Trying C, new candidate {prop}')
prop = vir[:2] + "C"

if c2s[vir] == c2s[prop]:
Expand All @@ -55,7 +45,8 @@ def read_csv(filename):

if vac == our:
print('Matched the vaccine!')
matches +=1
matches += 1

else:
print('No Match.')

Expand Down