-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Protein Translation] add new practice exercise #312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks this looks good!
To be clear the only change I'm expecting here is uncommenting that test case, the rest below is just for consideration.
I'm never particularly happy to see a for loop in R, but as you say I think it may be called for here given the desire to process sequentially until a stop codon is reached. Maybe the alternative you outlined could be explored as another approach, or we can just wait and see what people come up with (I can't seem to think of anything right now).
Another small consideration here is whether instead of naming the function "proteins" it could be "translate" or "translate_rna" or something similar?
Not really an R specific thing, but I do think it's good to encourage (and model) the principle of preferring verbs for function names to describe what they do. I may not always have done this in the past with the R track, but it's just something that occurred to me when reviewing this and I thought it worth raising (naming things is hard, and actually a massive and under appreciated aspect of good programming in my view)
I assume here that you used ""proteins" simply because that's what the method was called in the python implementation, and scanning a few of the other tracks I see that has been done quite a lot, while others have opted for more verb-like function names. So I'm not sticky on it at all, and it can probably be debated different ways - was just keen to raise it and hear your view.
exercises/practice/protein-translation/test_protein-translation.R
Outdated
Show resolved
Hide resolved
Damn, this was a temporary, local thing that should never have found its way to the PR. Sorry... Co-authored-by: Jon Calder <[email protected]>
Me too, but this was the least-bad solution I could come up with.
Again, I agree. I was copying Molecular biologists (including my former colleagues) use the terms Replication, Transcription and Translation for DNA->DNA, DNA->mRNA and mRNA->protein respectively, so translate is a good name. |
changes function name to `translate`
function name changed
Thanks! I like |
For week [02-13], so not very urgent. Again, just the exercise with no approaches yet.
I had hoped to do something clever and vectorized with this exercise, but tripped over the endless validity-checking. This needs to be done in a specific order, so I ended up putting most things in a
for
loop.Maybe we could translate the whole sequence, then truncate to everything before the first "STOP" codon, then check for invalid elements? Probably still not elegant, and I've done enough molecular biology in my career to have a feel for how big real-world sequences can get - translating onward past a STOP isn't great.