-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add protein translation #659
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.
Very cool, thank you @BNAndras!
There are some finishing touches needed, but I can't see any actual problem :)
test "Non-existing codon can't translate" <| | ||
\() -> | ||
ProteinTranslation.proteins "AAA" | ||
|> Expect.equal (Err "Invalid codon") |
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.
Let's use types all the way, I think it's the most idiomatic way.
|> Expect.equal (Err "Invalid codon") | |
|> Expect.equal (Err InvalidCodon) |
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.
I've made the other edits, but I'll need to work my way through adding the types and chasing out the ramifications. I haven't touched Elm in a while so I'm a little rusty. I can poke at it more this weekend.
module ProteinTranslation exposing (proteins) | ||
|
||
|
||
proteins : String -> Result String List todo |
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.
The types need to be adjusted
Ok [] | ||
|
||
codons -> | ||
case processCodons [] codons of |
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.
Not sure if it's better, but I think this whole block could be
codons
|> processCodons []
|> Result.map List.reverse
and if you could somehow treat the empty case in processCodons
the whole function could be
strand
|> splitIntoCodons
|> processCodons []
|> Result.map List.reverse
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 for the review, I'll make the edits tomorrow.
@BNAndras do you still plan on finishing this? I can take over if you like. |
Sorry, I was working on the LFE track this weekend. I'll take a look tonight. |
I’m under the weather so if you wrap this up, I’ll owe you one. :) |
Related to #655