Skip to content

Commit

Permalink
python/protein-translation: 1st iteration - fix enum name case
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Apr 27, 2024
1 parent a7e305f commit 58e93f5
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 150 deletions.
2 changes: 1 addition & 1 deletion python/protein-translation/.coverage.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<coverage branch-rate="0.7" branches-covered="7" branches-valid="10" complexity="0" line-rate="0.8947" lines-covered="34" lines-valid="38" timestamp="1714182958051" version="4.5.4">
<coverage branch-rate="0.7" branches-covered="7" branches-valid="10" complexity="0" line-rate="0.8947" lines-covered="34" lines-valid="38" timestamp="1714183479610" version="4.5.4">
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
Expand Down
44 changes: 22 additions & 22 deletions python/protein-translation/protein_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@


class Proteins(Enum):
Methionine = enum_auto()
Phenylalanine = enum_auto()
Leucine = enum_auto()
Serine = enum_auto()
Tyrosine = enum_auto()
Cysteine = enum_auto()
Tryptophan = enum_auto()
METHIONINE = enum_auto()
PHENYLALANINE = enum_auto()
LEUCINE = enum_auto()
SERINE = enum_auto()
TYROSINE = enum_auto()
CYSTEINE = enum_auto()
TRYPTOPHAN = enum_auto()
STOP = enum_auto()


Expand All @@ -26,20 +26,20 @@ class Proteins(Enum):
CodonToProteinT = dict[CodonSequenceT, Proteins]

CodonToProtein: CodonToProteinT = {
"AUG": Proteins.Methionine,
"UUU": Proteins.Phenylalanine,
"UUC": Proteins.Phenylalanine,
"UUA": Proteins.Leucine,
"UUG": Proteins.Leucine,
"UCU": Proteins.Serine,
"UCC": Proteins.Serine,
"UCA": Proteins.Serine,
"UCG": Proteins.Serine,
"UAU": Proteins.Tyrosine,
"UAC": Proteins.Tyrosine,
"UGU": Proteins.Cysteine,
"UGC": Proteins.Cysteine,
"UGG": Proteins.Tryptophan,
"AUG": Proteins.METHIONINE,
"UUU": Proteins.PHENYLALANINE,
"UUC": Proteins.PHENYLALANINE,
"UUA": Proteins.LEUCINE,
"UUG": Proteins.LEUCINE,
"UCU": Proteins.SERINE,
"UCC": Proteins.SERINE,
"UCA": Proteins.SERINE,
"UCG": Proteins.SERINE,
"UAU": Proteins.TYROSINE,
"UAC": Proteins.TYROSINE,
"UGU": Proteins.CYSTEINE,
"UGC": Proteins.CYSTEINE,
"UGG": Proteins.TRYPTOPHAN,
"UAA": Proteins.STOP,
"UAG": Proteins.STOP,
"UGA": Proteins.STOP,
Expand Down Expand Up @@ -81,6 +81,6 @@ def proteins(rna_sequence: RnaSequenceT) -> ProteinListT:
if protein == Proteins.STOP:
break

result.append(protein.name)
result.append(protein.name.title())

return result
44 changes: 22 additions & 22 deletions python/protein-translation/protein_translation.py,cover
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@


> class Proteins(Enum):
> Methionine = enum_auto()
> Phenylalanine = enum_auto()
> Leucine = enum_auto()
> Serine = enum_auto()
> Tyrosine = enum_auto()
> Cysteine = enum_auto()
> Tryptophan = enum_auto()
> METHIONINE = enum_auto()
> PHENYLALANINE = enum_auto()
> LEUCINE = enum_auto()
> SERINE = enum_auto()
> TYROSINE = enum_auto()
> CYSTEINE = enum_auto()
> TRYPTOPHAN = enum_auto()
> STOP = enum_auto()


Expand All @@ -26,20 +26,20 @@
> CodonToProteinT = dict[CodonSequenceT, Proteins]

> CodonToProtein: CodonToProteinT = {
> "AUG": Proteins.Methionine,
> "UUU": Proteins.Phenylalanine,
> "UUC": Proteins.Phenylalanine,
> "UUA": Proteins.Leucine,
> "UUG": Proteins.Leucine,
> "UCU": Proteins.Serine,
> "UCC": Proteins.Serine,
> "UCA": Proteins.Serine,
> "UCG": Proteins.Serine,
> "UAU": Proteins.Tyrosine,
> "UAC": Proteins.Tyrosine,
> "UGU": Proteins.Cysteine,
> "UGC": Proteins.Cysteine,
> "UGG": Proteins.Tryptophan,
> "AUG": Proteins.METHIONINE,
> "UUU": Proteins.PHENYLALANINE,
> "UUC": Proteins.PHENYLALANINE,
> "UUA": Proteins.LEUCINE,
> "UUG": Proteins.LEUCINE,
> "UCU": Proteins.SERINE,
> "UCC": Proteins.SERINE,
> "UCA": Proteins.SERINE,
> "UCG": Proteins.SERINE,
> "UAU": Proteins.TYROSINE,
> "UAC": Proteins.TYROSINE,
> "UGU": Proteins.CYSTEINE,
> "UGC": Proteins.CYSTEINE,
> "UGG": Proteins.TRYPTOPHAN,
> "UAA": Proteins.STOP,
> "UAG": Proteins.STOP,
> "UGA": Proteins.STOP,
Expand Down Expand Up @@ -81,6 +81,6 @@
> if protein == Proteins.STOP:
> break

> result.append(protein.name)
> result.append(protein.name.title())

> return result
Loading

0 comments on commit 58e93f5

Please sign in to comment.