Skip to content
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

Ensure Non-Met start codons map to Met on translation #322

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

carreter
Copy link
Collaborator

@carreter carreter commented Aug 2, 2023

Also makes Translate() return an error if an invalid start codon is received

Fixes #305.

Also makes Translate() return an error if an invalid start codon is received
Copy link
Contributor

@Koeng101 Koeng101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, and is exactly the kind of checks we needed. Thanks!

Comment on lines +25 to +43
// Non-Met start codons should still map to Met for our standard codon tables.
// See https://github.com/TimothyStiles/poly/issues/305.
func TestTranslationAlwaysMapsStartCodonToMet(t *testing.T) {
gfpTranslation := "MASKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKRHDFFKSAMPEGYVQERTISFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYITADKQKNGIKANFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK*"
gfpDnaSequence := "TTGGCTAGCAAAGGAGAAGAACTTTTCACTGGAGTTGTCCCAATTCTTGTTGAATTAGATGGTGATGTTAATGGGCACAAATTTTCTGTCAGTGGAGAGGGTGAAGGTGATGCTACATACGGAAAGCTTACCCTTAAATTTATTTGCACTACTGGAAAACTACCTGTTCCATGGCCAACACTTGTCACTACTTTCTCTTATGGTGTTCAATGCTTTTCCCGTTATCCGGATCATATGAAACGGCATGACTTTTTCAAGAGTGCCATGCCCGAAGGTTATGTACAGGAACGCACTATATCTTTCAAAGATGACGGGAACTACAAGACGCGTGCTGAAGTCAAGTTTGAAGGTGATACCCTTGTTAATCGTATCGAGTTAAAAGGTATTGATTTTAAAGAAGATGGAAACATTCTCGGACACAAACTCGAGTACAACTATAACTCACACAATGTATACATCACGGCAGACAAACAAAAGAATGGAATCAAAGCTAACTTCAAAATTCGCCACAACATTGAAGATGGATCCGTTCAACTAGCAGACCATTATCAACAAAATACTCCAATTGGCGATGGCCCTGTCCTTTTACCAGACAACCATTACCTGTCGACACAATCTGCCCTTTCGAAAGATCCCAACGAAAAGCGTGACCACATGGTCCTTCTTGAGTTTGTAACTGCTGCTGGGATTACACATGGCATGGATGAGCTCTACAAATAA"

if got, _ := Translate(gfpDnaSequence, GetCodonTable(11)); got != gfpTranslation {
t.Errorf("TestTranslation has failed. Translate has returned %q, want %q", got, gfpTranslation)
}
}

func TestTranslationErrorsOnIncorrectStartCodon(t *testing.T) {
badSequence := "GGG"

if _, gotErr := Translate(badSequence, GetCodonTable(11)); gotErr == nil {
t.Errorf("Translation should return an error if given an incorrect start codon")
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests!

@TimothyStiles TimothyStiles merged commit 18c8a69 into bebop:main Aug 15, 2023
2 checks passed
@carreter carreter deleted the met_codon branch September 26, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate should have a setting to set first codon to M
3 participants