()
| 79 | } |
| 80 | |
| 81 | func ExampleTranslationTable_Optimize() { |
| 82 | gfpTranslation := "MASKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKRHDFFKSAMPEGYVQERTISFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYITADKQKNGIKANFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK*" |
| 83 | |
| 84 | sequence, _ := genbank.Read("../../data/puc19.gbk") |
| 85 | codonTable, err := codon.NewTranslationTable(11) |
| 86 | if err != nil { |
| 87 | fmt.Printf("error running example: %s\n", err) |
| 88 | return |
| 89 | } |
| 90 | |
| 91 | _ = codonTable.UpdateWeightsWithSequence(sequence) |
| 92 | |
| 93 | // Here, we double check if the number of genes is equal to the number of stop codons |
| 94 | stopCodonCount := 0 |
| 95 | for _, aa := range codonTable.AminoAcids { |
| 96 | if aa.Letter == "*" { |
| 97 | for _, codon := range aa.Codons { |
| 98 | stopCodonCount = stopCodonCount + codon.Weight |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | if stopCodonCount != codonTable.Stats.GeneCount { |
| 104 | fmt.Println("Stop codons don't equal number of genes!") |
| 105 | } |
| 106 | |
| 107 | optimizedSequence, _ := codonTable.Optimize(gfpTranslation) |
| 108 | optimizedSequenceTranslation, _ := codonTable.Translate(optimizedSequence) |
| 109 | |
| 110 | fmt.Println(optimizedSequenceTranslation == gfpTranslation) |
| 111 | // output: true |
| 112 | } |
| 113 | |
| 114 | func ExampleReadCodonJSON() { |
| 115 | codontable := codon.ReadCodonJSON("../../data/bsub_codon_test.json") |
nothing calls this directly
no test coverage detected