Skip to content

Commit d0f6ab3

Browse files
fixed bug that produced wrong overhang in linear, non-directional, single cut reactions. (#408)
* fixed bug that produced wrong overhang in linear, non-directional, single cut reactions.
1 parent 916c92d commit d0f6ab3

File tree

3 files changed

+47
-25
lines changed

3 files changed

+47
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Added
11-
- Alternative start codons can now be used in the `synthesis/codon` DNA -> protein translation package (#305)
12-
- Added a parser and writer for the `pileup` sequence alignment format (#329)
13-
- Added statistics to the `synthesis/codon` package (keeping track of the observed start codon occurrences in a translation table) (#350)
14-
- Added option to fragmenter to fragment with only certain overhangs (#387)
15-
16-
17-
18-
1910
### Fixed
20-
- `fastq` parser no longer becomes de-aligned when reading (#325)
21-
- `fastq` now handles optionals correctly (#323)
22-
- No more data race in GoldenGate (#276)
23-
24-
### Breaking
25-
- CutWithEnzymeByName is now a receiver of EnzymeManager. GoldenGate now takes an Enzyme instead of the name of an enzyme.
26-
This is an effort to remove dependence on some package level global state and build some flexibility managing enzymes
27-
over the lifetime of the program.
28-
- Enzyme.OverhangLen is now named Enzyme.OverhangLength
29-
30-
## [0.26.0] - 2023-07-22
31-
Oops, we weren't keeping a changelog before this tag!
32-
33-
[unreleased]: https://github.com/TimothyStiles/poly/compare/v0.26.0...main
34-
[0.26.0]: https://github.com/TimothyStiles/poly/releases/tag/v0.26.0
11+
- Fixed bug that produced wrong overhang in linear, non-directional, single cut reactions. #408

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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,43 @@ 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+
99136
func TestCircularLigate(t *testing.T) {
100137
// The following tests for complementing overhangs. Specific, this line:
101138
// newSeed := Fragment{seedFragment.Sequence + seedFragment.ReverseOverhang + ReverseComplement(newFragment.Sequence), seedFragment.ForwardOverhang, ReverseComplement(newFragment.ForwardOverhang)}

0 commit comments

Comments
 (0)