-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProteinTranslation.cs
46 lines (44 loc) · 1.51 KB
/
ProteinTranslation.cs
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
public static class ProteinTranslation
{
public static string[] Proteins(string strand)
{
if (string.IsNullOrEmpty(strand) || strand.Length % 3 != 0) return [];
var proteins = new List<string>();
for (int i = 0; i < strand.Length; i += 3)
{
var udnMach = strand.Substring(i, 3);
if (udnMach.Length == 3)
{
switch (udnMach)
{
case "AUG":
proteins.Add("Methionine");
continue;
case "UUU" or "UUC":
proteins.Add("Phenylalanine");
continue;
case "UUA" or "UUG":
proteins.Add("Leucine");
continue;
case "UCU" or "UCC" or "UCA" or "UCG":
proteins.Add("Serine");
continue;
case "UAU" or "UAC":
proteins.Add("Tyrosine");
continue;
case "UGU" or "UGC":
proteins.Add("Cysteine");
continue;
case "UGG":
proteins.Add("Tryptophan");
continue;
case "UAA" or "UAG" or "UGA":
break;
default:
continue;
}
}
}
return [.. proteins];
}
}