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)
| 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 |
| 234 | func (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 |
| 256 | func (table *TranslationTable) Translate(dnaSeq string) (string, error) { |