Skip to content

Commit

Permalink
Add linear ligation as an option (#82)
Browse files Browse the repository at this point in the history
* Add linear ligation as an option
  • Loading branch information
Koeng101 authored Aug 12, 2024
1 parent 2d5c684 commit 4fb1185
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Added option for linear ligations [#82](https://github.com/Koeng101/dnadesign/pull/82)
- Added minimal python packaging [#81](https://github.com/Koeng101/dnadesign/pull/81)
- Greatly simplified the Ligate function [#77](https://github.com/Koeng101/dnadesign/pull/77)
- Updated barcoding functions to handle edge case of hanging-edge barcodes [#74](https://github.com/Koeng101/dnadesign/pull/74)
Expand Down
13 changes: 8 additions & 5 deletions lib/clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func CutWithEnzyme(part Part, directional bool, enzyme Enzyme, methylated bool)
// the first fragment WILL be used in the ligation reaction. This function
// is a massive simplification of the original ligation code which can do more.
// If this does not fulfill your needs, please leave an issue in git.
func Ligate(fragments []Fragment) (string, error) {
func Ligate(fragments []Fragment, circular bool) (string, error) {
if len(fragments) == 0 {
return "", errors.New("no fragments to ligate")
}
Expand Down Expand Up @@ -316,10 +316,13 @@ func Ligate(fragments []Fragment) (string, error) {
}

// attempt circularization
if finalFragment.ForwardOverhang != finalFragment.ReverseOverhang {
return "", errors.New("does not circularize")
if circular {
if finalFragment.ForwardOverhang != finalFragment.ReverseOverhang {
return "", errors.New("does not circularize")
}
return finalFragment.ForwardOverhang + finalFragment.Sequence, nil
}
return finalFragment.ForwardOverhang + finalFragment.Sequence, nil
return finalFragment.ForwardOverhang + finalFragment.Sequence + finalFragment.ReverseOverhang, nil
}

/******************************************************************************
Expand All @@ -337,7 +340,7 @@ func GoldenGate(sequences []Part, cuttingEnzyme Enzyme, methylated bool) (string
newFragments := CutWithEnzyme(sequence, true, cuttingEnzyme, methylated)
fragments = append(fragments, newFragments...)
}
return Ligate(fragments)
return Ligate(fragments, true)
}

// GetBaseRestrictionEnzymes return a basic slice of common enzymes used in Golden Gate Assembly. Eventually, we want to get the data for this map from ftp://ftp.neb.com/pub/rebase
Expand Down
14 changes: 13 additions & 1 deletion lib/clone/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestCutWithEnzymeRegression(t *testing.T) {
func TestCircularLigate(t *testing.T) {
fragment1 := Fragment{"AAAAAA", "GTTG", "CTAT"}
fragment2 := Fragment{"AAAAAA", "CAAC", "ATAG"}
output, err := Ligate([]Fragment{fragment1, fragment2})
output, err := Ligate([]Fragment{fragment1, fragment2}, true)
if err != nil {
t.Errorf("Got error on ligation: %s", err)
}
Expand All @@ -151,6 +151,18 @@ func TestCircularLigate(t *testing.T) {
}
}

func TestLinearLigate(t *testing.T) {
fragment1 := Fragment{"AAAAAA", "GTTG", "CTAT"}
fragment2 := Fragment{"AAAAAA", "ATGC", "ATAG"}
output, err := Ligate([]Fragment{fragment1, fragment2}, false)
if err != nil {
t.Errorf("Got error on ligation: %s", err)
}
if output != "GTTGAAAAAACTATTTTTTTGCAT" {
t.Errorf("Ligation with complementing overhangs should only output 1 valid rotated sequence. Got: %s", output)
}
}

func TestEnzymeManage_GetEnzymeByName_NotFound(t *testing.T) {
enzymeManager := NewEnzymeManager(GetBaseRestrictionEnzymes())
_, err := enzymeManager.GetEnzymeByName("EcoRFake")
Expand Down

0 comments on commit 4fb1185

Please # to comment.