MCPcopy Create free account
hub / github.com/bebop/poly / ExampleCompromiseCodonTable

Function ExampleCompromiseCodonTable

synthesis/codon/example_test.go:141–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139}
140
141func ExampleCompromiseCodonTable() {
142 sequence, _ := genbank.Read("../../data/puc19.gbk")
143
144 // weight our codon optimization table using the regions we collected from the genbank file above
145 optimizationTable, err := codon.NewTranslationTable(11)
146 if err != nil {
147 fmt.Printf("error running example: %s\n", err)
148 return
149 }
150
151 err = optimizationTable.UpdateWeightsWithSequence(sequence)
152 if err != nil {
153 panic(fmt.Errorf("got unexpected error in an example: %w", err))
154 }
155
156 sequence2, _ := genbank.Read("../../data/phix174.gb")
157 optimizationTable2, err := codon.NewTranslationTable(11)
158 if err != nil {
159 fmt.Printf("error running example: %s\n", err)
160 return
161 }
162
163 err = optimizationTable2.UpdateWeightsWithSequence(sequence2)
164 if err != nil {
165 panic(fmt.Errorf("got unexpected error in an example: %w", err))
166 }
167
168 finalTable, _ := codon.CompromiseCodonTable(optimizationTable, optimizationTable2, 0.1)
169 for _, aa := range finalTable.GetWeightedAminoAcids() {
170 for _, codon := range aa.Codons {
171 if codon.Triplet == "TAA" {
172 fmt.Println(codon.Weight)
173 }
174 }
175 }
176 //output: 3863
177}
178
179func ExampleAddCodonTable() {
180 sequence, _ := genbank.Read("../../data/puc19.gbk")

Callers

nothing calls this directly

Calls 5

ReadFunction · 0.92
NewTranslationTableFunction · 0.92
CompromiseCodonTableFunction · 0.92
GetWeightedAminoAcidsMethod · 0.65

Tested by

no test coverage detected