bebop / poly

A Go package for engineering organisms.
https://pkg.go.dev/github.com/bebop/poly
MIT License
659 stars 68 forks source link

Removed update weights #410

Closed Koeng101 closed 7 months ago

Koeng101 commented 7 months ago

The current branch doesn't work with JSON codon tables. The expectation is and should be that when you call Optimize with a codon table, you get an optimized sequence back, not that you must update the codon table with itself.

For example, previously you'd have to do the following:

ct := ParseCodonJSON(ecoliCodonTable)
ct.UpdateWeights(ct.AminoAcids) // what? why are we updating a codon table with itself?
seq, err := ct.OptimizeSequence(protein, 0)

I think codon can be reduced quite a bit while maintaining functionality, so this is a start. For example:

  1. Remove all extraneous structs in table: TranslationMap, StartCodonTable, Choosers
  2. Remove table interface, have one table struct that contains the data for a codon table
  3. Remove all updating functions, treat codon tables as essentially static outside of initially building them (as this is almost universally how they are worked with)
  4. Remove functions for copying tables (ie, I cannot think of a single case where this is useful)

I think a lot of this stems from figuring out how codon tables are actually practically used. Ie, calculated extremely rarely, but used a lot.

I also removed ExampleTranslationTable_UpdateWeights, unless someone can think of a single real example of when this would be used.