()
| 177 | } |
| 178 | |
| 179 | func ExampleAddCodonTable() { |
| 180 | sequence, _ := genbank.Read("../../data/puc19.gbk") |
| 181 | |
| 182 | // weight our codon optimization table using the regions we collected from the genbank file above |
| 183 | optimizationTable, err := codon.NewTranslationTable(11) |
| 184 | if err != nil { |
| 185 | fmt.Printf("error running example: %s\n", err) |
| 186 | return |
| 187 | } |
| 188 | |
| 189 | err = optimizationTable.UpdateWeightsWithSequence(sequence) |
| 190 | if err != nil { |
| 191 | panic(fmt.Errorf("got unexpected error in an example: %w", err)) |
| 192 | } |
| 193 | |
| 194 | sequence2, _ := genbank.Read("../../data/phix174.gb") |
| 195 | optimizationTable2, err := codon.NewTranslationTable(11) |
| 196 | if err != nil { |
| 197 | fmt.Printf("error running example: %s\n", err) |
| 198 | return |
| 199 | } |
| 200 | |
| 201 | err = optimizationTable2.UpdateWeightsWithSequence(sequence2) |
| 202 | if err != nil { |
| 203 | panic(fmt.Errorf("got unexpected error in an example: %w", err)) |
| 204 | } |
| 205 | |
| 206 | finalTable, err := codon.AddCodonTable(optimizationTable, optimizationTable2) |
| 207 | if err != nil { |
| 208 | panic(fmt.Errorf("got error in adding codon table example: %w", err)) |
| 209 | } |
| 210 | |
| 211 | for _, aa := range finalTable.AminoAcids { |
| 212 | for _, codon := range aa.Codons { |
| 213 | if codon.Triplet == "GGC" { |
| 214 | fmt.Println(codon.Weight) |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | //output: 51 |
| 219 | } |
nothing calls this directly
no test coverage detected