Skip to content

Commit

Permalink
lint fix. (#445)
Browse files Browse the repository at this point in the history
* lint fix to use string interpolation.

* more string interpolation.

* more string interpolation.
  • Loading branch information
TimothyStiles authored Sep 5, 2024
1 parent e339726 commit 8c1d5c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion io/slow5/slow5_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func testParseReadsHelper(t *testing.T, fileTarget string, errorMessage string)
}
}
if len(targetErr) == 0 {
t.Errorf(errorMessage)
t.Errorf("Test failed: %s", errorMessage)
}
}

Expand Down
12 changes: 6 additions & 6 deletions seqhash/seqhash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,33 @@ func TestHash(t *testing.T) {
// Test circular double stranded hashing
seqhash, _ := Hash("TTAGCCCAT", "DNA", true, true)
if seqhash != "v1_DCD_a376845b679740014f3eb501429b45e592ecc32a6ba8ba922cbe99217f6e9287" {
t.Errorf("Circular double stranded hashing failed. Expected v1_DCD_a376845b679740014f3eb501429b45e592ecc32a6ba8ba922cbe99217f6e9287, got: " + seqhash)
t.Errorf("Circular double stranded hashing failed. Expected v1_DCD_a376845b679740014f3eb501429b45e592ecc32a6ba8ba922cbe99217f6e9287, got: %s", seqhash)
}
// Test circular single stranded hashing
seqhash, _ = Hash("TTAGCCCAT", "DNA", true, false)
if seqhash != "v1_DCS_ef79b6e62394e22a176942dfc6a5e62eeef7b5281ffcb2686ecde208ec836ba4" {
t.Errorf("Circular single stranded hashing failed. Expected v1_DCS_ef79b6e62394e22a176942dfc6a5e62eeef7b5281ffcb2686ecde208ec836ba4, got: " + seqhash)
t.Errorf("Circular single stranded hashing failed. Expected v1_DCS_ef79b6e62394e22a176942dfc6a5e62eeef7b5281ffcb2686ecde208ec836ba4, got: %s", seqhash)
}
// Test linear double stranded hashing
seqhash, _ = Hash("TTAGCCCAT", "DNA", false, true)
if seqhash != "v1_DLD_c2c9fc44df72035082a152e94b04492182331bc3be2f62729d203e072211bdbf" {
t.Errorf("Linear double stranded hashing failed. Expected v1_DLD_c2c9fc44df72035082a152e94b04492182331bc3be2f62729d203e072211bdbf, got: " + seqhash)
t.Errorf("Linear double stranded hashing failed. Expected v1_DLD_c2c9fc44df72035082a152e94b04492182331bc3be2f62729d203e072211bdbf, got: %s", seqhash)
}
// Test linear single stranded hashing
seqhash, _ = Hash("TTAGCCCAT", "DNA", false, false)
if seqhash != "v1_DLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967" {
t.Errorf("Linear single stranded hashing failed. Expected v1_DLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967, got: " + seqhash)
t.Errorf("Linear single stranded hashing failed. Expected v1_DLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967, got: %s", seqhash)
}

// Test RNA Seqhash
seqhash, _ = Hash("TTAGCCCAT", "RNA", false, false)
if seqhash != "v1_RLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967" {
t.Errorf("Linear single stranded hashing failed. Expected v1_RLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967, got: " + seqhash)
t.Errorf("Linear single stranded hashing failed. Expected v1_RLS_063ea37d1154351639f9a48546bdae62fd8a3c18f3d3d3061060c9a55352d967, got: %s", seqhash)
}
// Test Protein Seqhash
seqhash, _ = Hash("MGC*", "PROTEIN", false, false)
if seqhash != "v1_PLS_922ec11f5227ce77a42f07f565a7a1a479772b5cf3f1f6e93afc5ecbc0fd5955" {
t.Errorf("Linear single stranded hashing failed. Expected v1_PLS_922ec11f5227ce77a42f07f565a7a1a479772b5cf3f1f6e93afc5ecbc0fd5955, got: " + seqhash)
t.Errorf(`Linear single stranded hashing failed. Expected v1_PLS_922ec11f5227ce77a42f07f565a7a1a479772b5cf3f1f6e93afc5ecbc0fd5955, got: %s`, seqhash)
}
}

Expand Down
8 changes: 4 additions & 4 deletions synthesis/fix/synthesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ func BenchmarkCds(b *testing.B) {
for _, cutSite := range []string{"GAAGAC", "GGTCTC", "GCGATG", "CGTCTC", "GCTCTTC", "CACCTGC"} {
if strings.Contains(optimizedSeq, cutSite) {
fmt.Println(changes)
b.Errorf("phusion" + " contains " + cutSite)
b.Errorf("phusion contains %s", cutSite)
}
if strings.Contains(transform.ReverseComplement(optimizedSeq), cutSite) {
fmt.Println(changes)
b.Errorf("phusion" + " reverse complement contains " + cutSite)
b.Errorf("phusion reverse complement contains %s", cutSite)
}
}
}
Expand Down Expand Up @@ -84,10 +84,10 @@ func TestCds(t *testing.T) {

for _, cutSite := range []string{"GAAGAC", "GGTCTC", "GCGATG", "CGTCTC", "GCTCTTC", "CACCTGC"} {
if strings.Contains(optimizedSeq, cutSite) {
t.Errorf("phusion" + " contains " + cutSite)
t.Errorf("phusion contains %s", cutSite)
}
if strings.Contains(transform.ReverseComplement(optimizedSeq), cutSite) {
t.Errorf("phusion" + " reverse complement contains " + cutSite)
t.Errorf("phusion reverse complement contains %s", cutSite)
}
}

Expand Down
14 changes: 7 additions & 7 deletions synthesis/fragment/fragment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func TestFragment(t *testing.T) {

_, _, err := Fragment(gene, 90, 110, []string{})
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
}

Expand All @@ -18,7 +18,7 @@ func TestUnfragmentable(t *testing.T) {
polyA := "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
_, _, err := Fragment(polyA, 40, 80, []string{})
if err == nil {
t.Errorf("polyA should fail to fragment")
t.Error("polyA should fail to fragment")
}
}

Expand All @@ -27,12 +27,12 @@ func TestFragmentSizes(t *testing.T) {
lacZ := "ATGACCATGATTACGCCAAGCTTGCATGCCTGCAGGTCGACTCTAGAGGATCCCCGGGTACCGAGCTCGAATTCACTGGCCGTCGTTTTACAACGTCGTGACTGGGAAAACCCTGGCGTTACCCAACTTAATCGCCTTGCAGCACATCCCCCTTTCGCCAGCTGGCGTAATAGCGAAGAGGCCCGCACCGATCGCCCTTCCCAACAGTTGCGCAGCCTGAATGGCGAATGGCGCCTGATGCGGTATTTTCTCCTTACGCATCTGTGCGGTATTTCACACCGCATATGGTGCACTCTCAGTACAATCTGCTCTGATGCCGCATAG"
_, _, err := Fragment(lacZ, 105, 95, []string{})
if err == nil {
t.Errorf("Fragment should fail when minFragmentSize > maxFragmentSize")
t.Error("Fragment should fail when minFragmentSize > maxFragmentSize")
}

_, _, err = Fragment(lacZ, 7, 95, []string{})
if err == nil {
t.Errorf("Fragment should fail when minFragmentSize < 8")
t.Error("Fragment should fail when minFragmentSize < 8")
}
}

Expand All @@ -51,7 +51,7 @@ func TestLongFragment(t *testing.T) {
gene := "GGAGGGTCTCAATGCTGGACGATCGCAAATTCAGCGAACAGGAGCTGGTCCGTCGCAACAAATACAAAACGCTGGTCGAGCAAAACAAAGACCCGTACAAGATTACGAACTGGAAACGCAATACCACCCTGCTGAAACTGAATGAGAAATACAAAGACTATAGCAAGGAGGACCTGTTGAACCTGAATCAAGAACTGGTCGTTGTTGCAGGTCGTATCAAACTGTATCGTGAAGCCGGTAAAAAAGCTGCCTTTGTGAACATTGATGATCAAGACTCCTCTATTCAGTTGTACGTGCGCCTGGATGAGATCGGTGATCAGAGCTTCGAGGATTTCCGCAATTTCGACCTGGGTGACATCATTGGTGTTAAAGGTATCATGATGCGCACCGACCACGGCGAGTTGAGCATCCGTTGTAAGGAAGTCGTGCTGCTGAGCAAGGCCCTGCGTCCGCTGCCGGATAAACACGCGGGCATTCAGGATATTGAGGAAAAGTACCGCCGTCGCTATGTGGACCTGATTATGAATCACGACGTGCGCAAGACGTTCCAGGCGCGTACCAAGATCATTCGTACCTTGCAAAACTTTCTGGATAATAAGGGTTACATGGAGGTCGAAACCCCGATCCTGCATAGCCTGAAGGGTGGCGCGAGCGCGAAACCGTTTATTACCCACTACAATGTGCTGAATACGGATGTGTATCTGCGTATCGCGACCGAGCTGCACCTGAAACGCCTGATTGTTGGCGGTTTCGAGGGTGTGTATGAGATCGGTCGCATCTTTCGCAATGAAGGTATGTCCACGCGTCACAATCCGGAATTCACGTCTATCGAACTGTATGTCGCCTATGAGGACATGTTCTTTTTGATGGATCTGACCGAAGAGATTTTTCGCGTTTGTAATGCCGCAGTCAACAGCTCCAGCATCATTGAGTATAACAACGTGAAAATTGACCTGAGCAAGCCGTTTAAGCGCCTGCATATGGTTGACGGTATTAAACAGGTGACCGGCGTCGACTTCTGGCAGGAGATGACGGTCCAACAGGCTCTGGAGCTGGCCAAAAAGCATAAAGTGCACGTTGAAAAACATCAAGAGTCTGTTGGTCACATTATCAATTTGTTCTATGAGGAGTTCGTGGAGTCCACGATTGTTGAGCCGACGTTCGTGTACGGTCACCCGAAGGAAATCTCTCCGCTGGCTAAGAGCAATCCGTCTGACCCGCGTTTCACGGACCGTTTCGAGCTGTTCATTCTGGGTCGTGAGTATGCGAATGCGTTTAGCGAGCTGAATGACCCGATTGACCAGTACGAACGCTTCAAGGCTCAGATTGAGGAGGAAAGCAAGGGCAACGATGAAGCCAACGACATGGACATTGATTTCATCGAGGCTCTGGAACACGCCATGCCGCCGACCGCGGGTATTGGTATCGGCATTGATCGCTTGGTTATGCTGCTGACGAATAGCGAATCCATCAAAGACGTGCTGTTGTTCCCGCAAATGAAGCCGCGCGAATGAAGAGCTTAGAGACCCGCT"
frags, _, err := Fragment(gene, 79, 94, []string{})
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
for _, frag := range frags {
if len(frag) > 94 {
Expand All @@ -72,7 +72,7 @@ func TestCheckLongRegresssion(t *testing.T) {
}
}
if foundGTCT {
t.Errorf("Should not have found GTCT since it is the reverse complement of AGAC")
t.Error("Should not have found GTCT since it is the reverse complement of AGAC")
}
}

Expand All @@ -92,6 +92,6 @@ func TestFragmentWithOverhangs(t *testing.T) {

_, _, err := FragmentWithOverhangs(gene, 90, 110, []string{}, defaultOverhangs)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
}

0 comments on commit 8c1d5c0

Please sign in to comment.