Skip to content

Commit 93e89eb

Browse files
committed
fixed bug that produced wrong overhang in linear, non-directional, single cut reactions.
1 parent 916c92d commit 93e89eb

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

‎clone/clone.go‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,15 @@ func CutWithEnzyme(part Part, directional bool, enzyme Enzyme) []Fragment {
188188
// In the case of a single cut in a linear sequence, we get two fragments with only 1 stick end
189189
fragmentSequence1 := sequence[overhangs[0].Position+overhangs[0].Length:]
190190
fragmentSequence2 := sequence[:overhangs[0].Position]
191-
overhangSequence := sequence[overhangs[0].Position : overhangs[0].Position+overhangs[0].Length]
191+
192+
var overhangSequence string
193+
194+
if len(forwardOverhangs) > 0 {
195+
overhangSequence = sequence[overhangs[0].Position : overhangs[0].Position+overhangs[0].Length]
196+
} else {
197+
overhangSequence = sequence[overhangs[0].Position-overhangs[0].Length : overhangs[0].Position]
198+
}
199+
192200
fragments = append(fragments, Fragment{fragmentSequence1, overhangSequence, ""})
193201
fragments = append(fragments, Fragment{fragmentSequence2, "", overhangSequence})
194202
return fragments

‎clone/clone_test.go‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,44 @@ func TestCutWithEnzyme(t *testing.T) {
9696
}
9797
}
9898

99+
func TestCutWithEnzymeRegression(t *testing.T) {
100+
sequence := "AGCTGCTGTTTAAAGCTATTACTTTGAGACC" // this is a real sequence I came across that was causing problems
101+
102+
part := Part{sequence, false}
103+
104+
// get enzymes with enzyme manager
105+
enzymeManager := NewEnzymeManager(GetBaseRestrictionEnzymes())
106+
bsa1, err := enzymeManager.GetEnzymeByName("BsaI")
107+
if err != nil {
108+
t.Errorf("Error when getting Enzyme. Got error: %s", err)
109+
}
110+
111+
// cut with BsaI
112+
fragments := CutWithEnzyme(part, false, bsa1)
113+
114+
// check that the fragments are correct
115+
if len(fragments) != 2 {
116+
t.Errorf("Expected 2 fragments, got: %d", len(fragments))
117+
}
118+
119+
if fragments[0].ForwardOverhang != "ACTT" {
120+
t.Errorf("Expected forward overhang to be ACTT, got: %s", fragments[0].ForwardOverhang)
121+
}
122+
123+
if fragments[0].ReverseOverhang != "" {
124+
t.Errorf("Expected reverse overhang to be GAGT, got: %s", fragments[0].ReverseOverhang)
125+
}
126+
127+
if fragments[1].ForwardOverhang != "" {
128+
t.Errorf("Expected forward overhang to be empty, got: %s", fragments[1].ForwardOverhang)
129+
}
130+
131+
if fragments[1].ReverseOverhang != "ACTT" {
132+
t.Errorf("Expected reverse overhang to be GAGT, got: %s", fragments[1].ReverseOverhang)
133+
}
134+
135+
}
136+
99137
func TestCircularLigate(t *testing.T) {
100138
// The following tests for complementing overhangs. Specific, this line:
101139
// newSeed := Fragment{seedFragment.Sequence + seedFragment.ReverseOverhang + ReverseComplement(newFragment.Sequence), seedFragment.ForwardOverhang, ReverseComplement(newFragment.ForwardOverhang)}

0 commit comments

Comments
 (0)