Skip to content

Commit

Permalink
Fix synthesis buffer problem (#204)
Browse files Browse the repository at this point in the history
* Fix synthesis buffer problem

* Simplify error handling in test functions for complex genes
  • Loading branch information
Koeng101 authored Sep 12, 2021
1 parent 86e4812 commit 3a8faf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion synthesis/synthesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func GcContentFixer(upperBound, lowerBound float64) func(string, chan DnaSuggest
// sequence check and returns a list of all the suggested changes.
func findProblems(sequence string, problematicSequenceFuncs []func(string, chan DnaSuggestion, *sync.WaitGroup)) []DnaSuggestion {
// Run functions to get suggestions
suggestions := make(chan DnaSuggestion, 100)
suggestions := make(chan DnaSuggestion, 1000000)
var waitgroup sync.WaitGroup
for _, function := range problematicSequenceFuncs {
waitgroup.Add(1)
Expand Down
14 changes: 11 additions & 3 deletions synthesis/synthesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,18 @@ func TestBtgZIComplexFix(t *testing.T) {
complexGene := "ATGAAGCTGATTATTGGCGCAATGCATGAAGAATTGCAGGATTCCATCGCGTTCTATAAGCTGAATAAGGTGGAAAACGAGAAGTTCACCATTTATAAGAATGAAGAGATCATGTTTTGCATTACCGGTATCGGTCTGGTGAACGCGGCGGCGCAGCTGAGCTACATTCTGTCTAAATATGATATTGACTCCATTATTAACATCGGTACCAGCGGCGGTTGCGACAAAGAGCTGAAACAAGGCGACATCCTGATCATCGACAAGATCTATAACAGCGTGGCGGACGCCACCGCATTCGGCTACGCGTACGGCCAAGTTCCGCGTATGCCGAAGTACTATGAAACCAGCAACAAAGATATTATTAAAACCATCAGCAAGGCGAAAATTAAGAATATCGCGAGCTCCGACATCTTCATCCATTCTACGGAGCAAGTGAAGAACTTCATCAATAAAATTGAGGACAAGATTAGCGTCCTGGATATGGAGTGTTTTGCGTATGCTCAGACGGCTTATTTGTTCGAAAAGGAGTTTTCTGTGATTAAAATCATTAGCGACGTCATCGGCGAAAAGAATACCAACAACGTGCAGTTCAACGACTTTATCAAGATTGCCGGTAAGGAGATTTTGGAGATTCTGAAGAAAATTCTG"
codonTable := codon.ReadCodonJSON(dataDir + "freqB.json")
restrictionEnzymes := []string{"GAAGAC", "GGTCTC", "GCGATG", "CGTCTC", "GCTCTTC", "CACCTGC"}
sequence, changes, err := FixCdsSimple(complexGene, codonTable, restrictionEnzymes)
_, _, err := FixCdsSimple(complexGene, codonTable, restrictionEnzymes)
if err != nil {
t.Errorf("Failed to fix complex gene with error: %s", err)
}
}

func TestBufferFailure(t *testing.T) {
complexGene := "ATGAAAAAGCTGCTGGCACTGCTGGTTGTGGTCACCTTGACCACCAATGTTGTCGTGGCGGGCGTGGCCATTGCAAACGCGGATAAGAAGAAGCAAAACGACATCCGTATCCTGCAAAGCAAACTGGAGGCAATCCTGAAGAGCAAAACCGATGCGAAGTGGGACGTTTCCGAATTGCAAAAAAAAGTGGATACCGAATTCGGCGAGGGCGAGATTACCGTTAGCTTCAAAGATTATACCAAAGTTACGAGCATTGCAAAGGCTGAATTTATCTTTAAAGCCAACAACAAAAAATACACCGGTCAGCTGACCCTGACCCAGACCTACGAAGTTAAGGATAACAAAGCTGAGGATATCAGCGTCATTAGCACCCGCCTGACGAGCATCCTGAGCGAGAAACCGCACGATGAATGGACCGTTACGGACCTGCAAACCAAGATTGACAGCGAGTTTGGTAATGGTGAGATTGCGGTTAGCGGTGGTACGTATAGCGATGATAACAACTACACCGGCGAAACGAAGAAAAAGGCCGAATTCACGTTCACGGGCAATGCGACCACCGATCCGGAAAACACCCTGAAATACATTGGCGAGATTACGCTGACGCATACGTACACGAAACAAACCGTGATTAGCAACGCTCAGATTAATACGGTGGTGACGGATCTGGCGAATCACGATAAATTCGATAACAAGGAAGCAGCGAAATCCGCGATCGAAGCAGCGTTCGCATACAAGGAGGCGGCAAGCGATGCGGAGCCGACCGGTATCAAGGGTATTGAAAAAGCAGAAGCCAAGTATAACAAGTCCGTGGAAGATGATAAAAGCAGCTTCACCGTGACGTTGACGCTGAGCACGGGTTATGTCCTGGAGCAAACGACCAACACCGTCGAGGTTACGGTGAACTTGATGAGCCGTACCGATATCTCTACCAACGAAGAGTTTAAACAAGAGCTGACCAGCTTTGTGAATGACGAGGCGCACAAGAACCAAGCGTGGACCAAGGACGGTCTGCAAAGCGCGCTGAATACCAAGTATGGCAGCGAGGAGTTTGACGTTACGGAAGACGATAGCACCGTTACGTACGATAATAGCGAACTGGGCAAGAAGACGGAAAAGTTCGTCATCACCGGCCAAGGCAGCAAGGAGAATAATAAACAGTACCAGGGTGAGTTGAAGGTTACGCACGATTACAAGGTTACCGCCAATATTTCTACCATTAAGAACGAGCTGGAGACCATTCTGAAGGATAAAGACTATGAGGAGAAAACGTGGACGCTGGACGAGCTGCAAAAAGCGGTTGATACCGAGTTCAACAAAGGTCAAATTACCGTGGAGGAAGTTATTCTGCTGAAGGATGACAATAGCAATGTGGTTAAAAATACCAAAGAATGGAAATTCATCGGCAATAGCAATGATGAAAACGAATTTGTTTATACCGGTGATGTGACCCTGCCGCACACCTGGAAAAGCTATAAAGTGTTGGCCTCTGATATCCAAACGGCGGCAGAAGTTGCAATTAATGGCAAGAGCTATGCAAATATCGAAGCGGCGCAAGAAGACATCACGAACGCAGTCCAAGCCATCACGGGTGTTGACTCCGTTATTTACCCGACGGAAACGCCGAAAGACTGGAATGATGAAACCATTAAATTTACGGTTACGTTCAAAGAGAACTACGTGATTGAAGGTAAAAATGATTTCAGCGTCAAAGCCCGCGTCGGTAATAGCTCCCAGAATCTGGCGGATATTATTAAGGCGGACGACCTGAAAATCAGCGCGGCAAAAGGCAATGATGCTAGCGCGGTTAAAACCCAAATTGAAACCGTGCTGACCGCTGCGGGTCTGGTGAATGGTACCGATTATGTGGACTTCACCGTGGCGCGTACCGATGATGAGGCTACCACCAGCGTTGAGATCACCGGCAAGGGTAGCGATAAAGTTGTTGATGGTTCCAAAGTTACCTTCGTTGTCACCTGGTCCACCGATTTTTCTAAAGACTTGGCAGACATTATTAAGGCGGACGACCTGAAAATCAGCGCGGCGAAAGGCAATGATGTGAGCACCGTGAAGACCCAAATTGAAACCGTTCTGACGGCTGCGGGTCTGGTGAACGGCACCGACTATGTTGATTTCACCGTCGCGCGTACCGACGATGAAGCGACCACCAGCGTTGAGATTACCGGTAAAGGTAGCGATAAGGTTGTCGACGGCAGCAAGGTTACGTTTGTTGTTACCTGGAGCACCGACTTTAGCAAGGACCTGGCGGACATCATTAAGGCGGACGACTTGAAGATTTCTGCCGCAAAGGGTAATGACGTCAGCACCGTTAAAACCCAAATCGAGACGGTTTTGACCGCAGCGGGTCTGGTGAATGGTACCGATTATGTGGACTTTACGGTGGCACGCACCGACGACGAGGCGACCACCAGCGTGGAAATTACCGGTAAGGGTAGCGACAAGGTTGTTGACGGTAGCAAAGTTACGTTTGTTGTTACGTGGAGCACCGACTTTAGCAAGGATTTGGCAGACATTATCAAAGCCGACGACCTGAAAATTTCTGCGGCCAAGGGCAACGATGTCAGCACCGTTAAGATCCAGATTGAGACCGTGCTGACCGCGGCGGGCCTGGTCAACGGCACCGATTATGTTGATTTCACCGTTGCACGCACCGATGATGAGGCCACGACCAGCGTGGAGATTACCGGTAAGGGTAGCGACAAAGTGGTGGACGGTAGCAAAGTGACCTTCGTTGTGACGTGGAGCATTGATTTCAGCAAAGATCTGGCGGATATTATTAAAGCAGACGACCTGAAGATCTCCGCGGCCAAAGGTAATGATGTTAGCGCGGTCAAGATCCAGATCGAGACGGTTCTGACCGCGGCCGGCTTGGTCAACGGTACGGATTATGTGGACTTCACCGTGGCTCGTACGGATGACGAGGCAACGACCTCTGTGGAGATCACGGGTAAGGGTTCTGATAAGGTTGTCGACGGCAGCAAAGTGACCTTTGTCGTTACCTGGAGCACCGACTTCTCCAAGGACTTGGCAGATATCATTAAGGCCGATGACCTGAAGATCAGCGCTGCGAAAGGTAACGACGTGAGCGCGGTTAAGACCCAAATTGAGACCGTCCTGACCGCAGCGGGCTTGGTTAACGGCACGGATTATGTGGACTTCACCGTTGCACGTACCGATGATGAAGCGACGACCAGCGTCGAGATTACCGGTAAGGGTTCTGACAAAGTGGTTGACGGTAGCAAAGTGACCTTCGTGGTCACCTGGAGCACCGATTTCAGCAAAGATCTGGCGGACATTATTAAAGCGGACGATCTGAAGATCAGCGCGGCCAAGGGCAACGACGTGAGCACGGTGAAAACGCAGATTGAAACCGTGCTGACCGCGGCAGGCCTGGTTAACGGTACCGACTATGTCGACTTCACGGTTGCTCGCACGGACGACGAAGCCACCACCAGCGTGGAGATCACGGGTAAAGGCAGCGATAAGGTTGTGGACGGTAGCAAAGTGACGTTCGTGGTTACCTGGAGCACCGATTTCAGCAAAGACCTGGCCGACATCATCAAGGCAGACGACCTGAAGATCAGCGCAGCTAAGGGCAATGACGACAGCGCTGTTAAGACGCAGATTGAGACCGTGCTGACCGCAGCAGGCCTGGTCAACGGTACGGATTACGTCGACTTTACGGTTGCGCGCACGGACGATGAGGCGACCACCAGCGTTGAAATCACCGGTAAGGGTAGCGATAAAGTCGTCGACGGCAGCAAAGTCACCTTCGTGGTCACCTGGAGCACCGATTTCTCTAAGTATTTGGCGGATATCATCAAGGCAGACGACTTGAAGATTAGCGCGGCAAAGGGCAATGACGCAAGCGCGGTGAAAATCCAGATCGAAACGGTCCTGACCGCCGCAGGCCTGGTCAACGGTACCGACTACGTCGATTTTACCGTCGCACGCACGGACGACGAGGCAACGACCAGCGTCGAAATTACGGGTAAGGGTAGCGACAAAGTTGTGGATGGTAGCAAAGTGACCTTTGTTGTCACCTGGTCCACCGATTTCAGCAAGGATCTGGCAGACATTATTAAAGCGGATGATCTGAAAATCTCCGCCGCGAAAGGCAACGACGTTAGCACCGTTAAAACCCAGATCGAGACGGTCCTGACCGCAGCCGGCCTGGTCAATGGCACGGACTATGTGGACTTCACCGTTGCCCGTACCGACGATGAGGCCACCACCAGCGTTGAGATCACCGGCAAAGGTAGCGATAAGGTGGTTGATGGTAGCAAGGTCACGTTCGTTGTGACCTGGAGCACCGACAGCGGTAACGGTGAAGAGCCGGAGAGCGAAGCACTGAGCATCTTTAGCTATAGCATCATTAGCGATAAGTATTCTAAC"
codonTable := codon.ReadCodonJSON(dataDir + "freqB.json")
restrictionEnzymes := []string{"GAAGAC", "GGTCTC", "GCGATG", "CGTCTC", "GCTCTTC", "CACCTGC"}
_, _, err := FixCdsSimple(complexGene, codonTable, restrictionEnzymes)
if err != nil {
t.Errorf("Failed to fix complex gene with error: %s", err)
fmt.Println(sequence)
fmt.Println(changes)
}
}

0 comments on commit 3a8faf4

Please sign in to comment.