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

Removed update weights #410

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion synthesis/codon/codon.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ func (table *TranslationTable) Optimize(aminoAcids string, randomState ...int) (
}

var codons strings.Builder
codonChooser := table.Choosers
codonChooser, err := newAminoAcidChoosers(table.AminoAcids)
if err != nil {
return "", err
}

for _, aminoAcid := range aminoAcids {
chooser, ok := codonChooser[string(aminoAcid)]
Expand Down
18 changes: 18 additions & 0 deletions synthesis/codon/codon_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package codon

import (
_ "embed"
"errors"
"os"
"strings"
Expand Down Expand Up @@ -534,3 +535,20 @@ func TestUpdateWeights(t *testing.T) {
})
}
}

//go:embed default_tables/freqB.json
var ecoliCodonTable []byte

func TestCodonJSONRegression(t *testing.T) {
ct := ParseCodonJSON(ecoliCodonTable)
gfp := "MASKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKRHDFFKSAMPEGYVQERTISFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYITADKQKNGIKANFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK"
seed := 0
sequence, err := ct.Optimize(gfp, seed)
if err != nil {
t.Errorf("Failed to optimize with premade table. Got error: %s", err)
}
expectedSequence := `ATGGCATCCAAGGGCGAGGAGTTGTTCACCGGTGTTGTGCCGATCCTGGTGGAGCTGGACGGTGACGTGAACGGTCACAAATTTAGCGTGTCCGGTGAGGGTGAGGGTGATGCTACCTATGGCAAGCTGACCCTGAAATTCATTTGTACCACGGGTAAACTGCCGGTCCCGTGGCCGACGCTGGTGACCACCTTCAGCTATGGTGTGCAGTGTTTCAGCCGCTACCCGGACCACATGAAGCGCCACGACTTTTTCAAGAGCGCGATGCCGGAGGGTTATGTGCAAGAACGTACCATCAGCTTTAAAGATGATGGTAACTATAAGACCCGCGCGGAAGTCAAGTTTGAGGGTGACACGCTGGTGAATCGTATTGAGTTGAAGGGTATTGACTTTAAGGAGGATGGTAATATTTTGGGCCACAAACTGGAGTACAATTACAATAGCCACAATGTTTACATCACGGCAGATAAACAGAAGAACGGTATCAAGGCGAACTTCAAAATTCGTCACAACATTGAGGACGGTTCTGTTCAACTGGCGGACCATTACCAACAGAATACCCCGATCGGTGACGGCCCGGTTCTGCTGCCGGACAACCATTATTTGAGCACCCAGTCCGCCCTGAGCAAGGACCCGAATGAGAAGCGTGATCATATGGTTCTGCTGGAGTTTGTGACCGCGGCGGGCATCACCCACGGCATGGACGAGCTGTACAAG`
if sequence != expectedSequence {
t.Errorf("Failed to output expected sequence.")
}
}
Loading
Loading