Skip to content

Commit 3ebe9c3

Browse files
return X if aa not in codon_table
1 parent a80c198 commit 3ebe9c3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

docs/src/rosalind/08-prot.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ function translate_mrna(seq)
9696
if seq%3!=0
9797
warn("this sequence is not divisible by 3")
9898
end
99-
# separate string into codons, map over with codon table
99+
# separate string into codons
100100
codons = (join(chunk) for chunk in Iterators.partition(seq, 3))
101-
102-
protein = join(codon_table[c] for c in codons if haskey(codon_table, c))
103101

104-
# return amino acid string
102+
# map over codons with codon table
103+
aa_string = join(get(codon_table, c, "X") for c in codons)
105104

105+
# return amino acid string
106+
return(aa_string)
106107
```
107108

108109

0 commit comments

Comments
 (0)