6 kyu
RNA to Protein Sequence Translation
917 of 1,557torret
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Maybe giving it some invalid input to ignore perhaps would make it a little bit more challenging.
Scala translation
looks hard but very easy challenge !
Ruby 3.0 should be enabled.
Enabled in this fork
All fixed in this fork for Python
Will invalidate solutions due to the second bullet point, and I'm not 100% confident I got the description right.
Ruby done, in this fork
# Stop codon
'UAA':'Stop', 'UGA':'Stop', 'UAG':'Stop'
This is preloaded in Acid dict and gives error in Python version, when set to empty strings - all tests passThe random test cases dont' make sense to me, e.g:
Testing for AUCUUAAGGACAAGCAUCUGUGUC
✘ It should work for random inputs too - Expected: "", instead got: "ILRTSICV"
It is unclear as to why this case should return an empty string rather than be translated. I'm probably missing something.
Thanks for that Kata. I liked it very much for it background - description, and reallife, as you say, test cases.
Would be nice if you could predefine and include the dictionary in the test environment, so that we don't have to copy it to the solution code.
I agree. Every solution has the same dictionary. Instead of two lines of code, my solution is 47 lines.
Ordinarily, I'm not concerned with competing with anyone for who can write the shortest code. (As a teacher, I tend to spell things about a bit more for my students -- all beginners -- anyway.) But the solution to this kata does wind up looking a little ridiculous with the dictionary lines pasted in. Maybe keep the full explanation (with amino acid names) in the instructions, but pre-load a shorter version for coding purposes?
I like that this was a real-world example with a relatively simple application of a Javascript object.
Hi all, I wrote a solution which worked for the test cases given to me, but then I kept on receiving an error that said "MNone should equal M". I can't understand what this means, could anyone help me out? Thanks!
Reason is, input is "" and your output string is "MNone"... and this should be "M" not "MNone" ;-)
Are you saying that "" (None too?) should map to "M"?
Translated into Ruby and if you don't mind, I would add random test cases to other languages as well.
Two small notes: you are imho very either very gifted or passionate in explaining concepts that are by no means a walk in the park, bravo!
Still imho, having to copy&paste the dictionary/hash/object is a meaningless chore and takes room in the window for no value: I did my Ruby translation preloading a $codons hash (and warning the user they got it that way if they wished), thus I would do the same for other languages as well.
Let me know about this and random test cases :)
I can't figure out how to access the predefined dictionary. Where is it?
It is not predefined. You have to copypaste it from description :)
it would be better if it was predefined. It's annoying to copy-paste all that text and it makes solutions a hundred times longer.
This is a good kata - I have a definite interest in chemistry, so I was looking forward to doing it even though I had to do so much work to create the dictionary in code. Not sure everyone willbe so enthusiastic, but it is enjoyable!
Please don't give up on this. It is a nice and unique kata. Issues are easy to correct, please take a couple of minutes to finish it.
I'm in the process of doing it lol. I'm fixing it at work, will take me a little bit of time. Most of it is hammered out already.
Good to hear that! Thanks.
The dictionary is inaccurate, and the test cases are broken (in the JavaScript version anyway). I had to read through all the comments to figure out why I could not pass the tests. No 'F' codon was found, but in fact it was the Phenylalanine. Please correct these frustrating issues.
Fixed.
Instruction is wrong,UUU, UUC is for F instead of K.
Fixed.
I don't have much to add to the issues that MMMAAANNN pointed out. This kata will be a lot more fun if you can do these things:
describe
andit
-Fixed the test case quotes error -Organized by describe and it -Will add more test cases when I have time, possibly later today -I have no plans for edge cases in this kata, I intend to make another one that goes all the way from DNA to protein and requires the presence of the 'Start' codon Methionine ('M') to begin transcription, that will have invalid inputs
As far as the starting dictionary, I'm struggling with how to present that. I don't want to just include the dictionary as starting code but I realize its cumbersome to input as well.
I'm not sure if that's a bug or some browser caching issue, but I see Phenylalanine is still "K" and the quote issue persists as well. Could it be you did not click "Re-publish"?
I'm doing it right now, it might just be taking forever on my end.
This comment has been hidden.
Nice work!
Although now the dictionary loses an important detail: full name of the aminoacid.
I would it somehow. Maybe as a comment, e.g.:
And (to my subjective taste) it looks really long. I would consider at least grouping some pairs to reduce the number of lines, e.g.
Yeah, I like that idea better. Reformatted it again.
Looks okay, but:
I see the update and it looks really good. If I were OverZelaous, I'd mark this issue as resolved.
First time I've been here for a bit, everything looks great to me!
[Python] Typo in Example test cases (third test):
anemone!")
must beanemone!')
(single quote vs. double quote).Fixed by kata author.
Are there any special cases possible, such as codons after stop-sequence or number of nucleodites not divisible by 3 (e.g. 100 nucleotides)?
If not, it might be worthwhile to put it in description that input is always valid.
I will put that in the description, I plan on making a more complicated kata that includes invalid sequences and those with base pair totals not divisible by 3.
Resolved by author.
For these huge strings, standard message provided by
Test.assert_equals
is really hard to interpret. Consider making a test which will show which parts of the test string do not correspond to the control string.I strongly recommend restructuring your test cases. Instead of describing the function of a protein as a third parameter in
test.assert_equals()
(which is supposed to be an error message!), put it in a Test.it("...") statement before each assert-equals statement. This, in my opinion, will look much nicer.Resolved by author.
Consider providing this huge amino acid dictionary in a more usable way. Many people will skip this kata just because retyping or transforming all this is somewhat time-consuming and not fun.
One of the ways I can think of is providing it in pre-set solution template as a string delimited by certain separartors, for example:
'F: UUU, UUC; L: UUA, UUG, CUU, CUC, CUA, CUG'
etc. This will at least make it easier to use some parsing technique on this (instead of hardcoding it manually).You have a typo in provided aminoacid dictionary. In the tests, phenylalanine is F, while in the description it is K (as well as Lysine).
Fixed by kata author
Consider correcting
def protein('UGCGAUGAAUGGGCUCGCUCC') returns 'CDEWARS'
to
protein('UGCGAUGAAUGGGCUCGCUCC')
returns'CDEWARS'
(remove def there).
Done by kata author.