Skip to content

Commit 48435ad

Browse files
make small updates according to Kevin's comments
1 parent 50c1d06 commit 48435ad

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/src/rosalind/08-prot.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ rna = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA"
7171

7272
# note: this can be created by hand
7373
# or it can be accessed from the BioSequences package (see link above)
74-
codon_table = Dict{String,Char}(
74+
codon_table = Dict(
7575
"AAA" => 'K', "AAC" => 'N', "AAG" => 'K', "AAU" => 'N',
7676
"ACA" => 'T', "ACC" => 'T', "ACG" => 'T', "ACU" => 'T',
7777
"AGA" => 'R', "AGC" => 'S', "AGG" => 'R', "AGU" => 'S',
@@ -101,13 +101,14 @@ function translate_mrna(seq, codon_table)
101101
@warn "this sequence is not divisible by 3"
102102
end
103103
# separate string into codons
104+
# this makes a generator, which allocates less memory than a vector
104105
codons = (join(chunk) for chunk in Iterators.partition(seq, 3))
105106

106107
# map over codons with codon table, return X if not in codon_table
107108
aa_string = join(get(codon_table, c, "X") for c in codons)
108109

109110
# return amino acid string
110-
return(aa_string)
111+
return aa_string
111112

112113
end
113114

@@ -123,7 +124,7 @@ established function from the BioSequences package in BioJulia.
123124
```julia
124125
using BioSequences
125126

126-
rna =("AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA")
127+
rna = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA"
127128

128129
translate(rna"AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA")
129130

0 commit comments

Comments
 (0)