Skip to content

Commit f8b7110

Browse files
authored
Update pycodon.py
Update colors and add Start codon.
1 parent e84b241 commit f8b7110

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pycodon.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
'ATA': 'Isoleucine',
4040
'ATC': 'Isoleucine',
4141
'ATT': 'Isoleucine',
42-
'ATG': 'Methionine',
42+
'ATG': 'Methionine/Start',
4343
'ACA': 'Threonine',
4444
'ACC': 'Threonine',
4545
'ACG': 'Threonine',
@@ -82,8 +82,14 @@ def print_codon(codon):
8282
codon_type = identify_type(codon)
8383
codon_in_table = codon.replace('U', 'T')
8484
if codon_in_table in codon_table:
85-
amino_acid = f"{Fore.GREEN}{codon_table[codon_in_table]}{Style.RESET_ALL}"
86-
table_string = tabulate([[f"{Fore.RED}{codon}{Style.RESET_ALL}", amino_acid, codon_type]],
85+
if codon_table[codon_in_table] == "Stop":
86+
amino_acid = f"{Fore.RED}Stop{Style.RESET_ALL}"
87+
elif codon_table[codon_in_table] == "Methionine/Start":
88+
amino_acid = f"{Fore.GREEN}Methionine{Style.RESET_ALL}{Fore.LIGHTBLACK_EX}/{Fore.LIGHTWHITE_EX}Start{Style.RESET_ALL}"
89+
else:
90+
amino_acid = f"{Fore.GREEN}{codon_table[codon_in_table]}{Style.RESET_ALL}"
91+
92+
table_string = tabulate([[f"{Fore.LIGHTMAGENTA_EX}{codon}{Style.RESET_ALL}", amino_acid, codon_type]],
8793
[f"{Fore.LIGHTBLACK_EX}Codon{Style.RESET_ALL}",
8894
f"{Fore.LIGHTBLACK_EX}Amino Acid{Style.RESET_ALL}",
8995
f"{Fore.LIGHTBLACK_EX}Type{Style.RESET_ALL}"],

0 commit comments

Comments
 (0)