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

Method UpdateWeightsWithSequence

synthesis/codon/codon.go:234–253  ·  view source on GitHub ↗

UpdateWeightsWithSequence will look at the coding regions in the given genbank data, and use those to generate new weights for the codons in the translation table. The next time a sequence is optimised, it will use those updated weights. This can be used to, for example, figure out which DNA sequen

(data genbank.Genbank)

Source from the content-addressed store, hash-verified

232// This can be used to, for example, figure out which DNA sequence is needed to give the best yield of protein when
233// trying to express a protein across different species
234func (table *TranslationTable) UpdateWeightsWithSequence(data genbank.Genbank) error {
235 codingRegions, err := extractCodingRegion(data)
236 if err != nil {
237 return err
238 }
239
240 table.Stats.GeneCount = len(codingRegions)
241 for _, sequence := range codingRegions {
242 table.Stats.StartCodonCount[sequence[:3]]++
243 }
244
245 if len(codingRegions) == 0 {
246 return errNoCodingRegions
247 }
248
249 // weight our codon optimization table using the regions we collected from the genbank file above
250 newWeights := weightAminoAcids(strings.Join(codingRegions, ""), table.AminoAcids)
251
252 return table.UpdateWeights(newWeights)
253}
254
255// Translate will return an amino acid sequence which the given DNA will yield
256func (table *TranslationTable) Translate(dnaSeq string) (string, error) {

Callers 10

ExampleAddCodonTableFunction · 0.95
TestOptimizeFunction · 0.95
TestOptimizeSameSeedFunction · 0.95
TestCompromiseCodonTableFunction · 0.95
TestAddCodonTableFunction · 0.95
TestOptimizeSequenceFunction · 0.95

Calls 3

UpdateWeightsMethod · 0.95
extractCodingRegionFunction · 0.85
weightAminoAcidsFunction · 0.85

Tested by 10

ExampleAddCodonTableFunction · 0.76
TestOptimizeFunction · 0.76
TestOptimizeSameSeedFunction · 0.76
TestCompromiseCodonTableFunction · 0.76
TestAddCodonTableFunction · 0.76
TestOptimizeSequenceFunction · 0.76