From 0fa147f02fdc09049795755ca23ad9ddf3cc408a Mon Sep 17 00:00:00 2001 From: Koeng101 Date: Mon, 1 Apr 2024 10:30:58 -0700 Subject: [PATCH] Updates megamash to use int instead of uint for minimal count in case of -1 (#73) * Updates megamash to use int instead of uint for minimal count in case of -1 --- README.md | 1 + lib/align/megamash/megamash.go | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4230a79..b4f5456 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,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] +- Updated megamash to use int instead of uint for minimal Kmer counts (so you can use -1) [#73](https://github.com/Koeng101/dnadesign/pull/73) - Added bcftools to external [#72](https://github.com/Koeng101/dnadesign/pull/72) - Fixed bug in PCR where certain matching primers wouldn't create any amplicons [#71](https://github.com/Koeng101/dnadesign/pull/71) - Updated seqhash2 to use base58 rather than base64 [#69](https://github.com/Koeng101/dnadesign/pull/69) diff --git a/lib/align/megamash/megamash.go b/lib/align/megamash/megamash.go index 3873d0c..d07ab4f 100644 --- a/lib/align/megamash/megamash.go +++ b/lib/align/megamash/megamash.go @@ -33,20 +33,20 @@ func StandardizedDNA(sequence string) string { var ( DefaultKmerSize uint = 16 - DefaultMinimalKmerCount uint = 10 + DefaultMinimalKmerCount int = 10 DefaultScoreThreshold float64 = 0.5 ) type MegamashMap struct { Kmers map[string]string - IdentifierToKmerCount map[string]uint + IdentifierToKmerCount map[string]int KmerSize uint - KmerMinimalCount uint + KmerMinimalCount int Threshold float64 } // NewMegamashMap creates a megamash map that can be searched against. -func NewMegamashMap(sequences []fasta.Record, kmerSize uint, kmerMinimalCount uint, threshold float64) (MegamashMap, error) { +func NewMegamashMap(sequences []fasta.Record, kmerSize uint, kmerMinimalCount int, threshold float64) (MegamashMap, error) { var megamashMap MegamashMap megamashMap.KmerSize = kmerSize megamashMap.KmerMinimalCount = kmerMinimalCount @@ -81,7 +81,7 @@ func NewMegamashMap(sequences []fasta.Record, kmerSize uint, kmerMinimalCount ui } } // Check for minimal kmerCount - identifierToCount := make(map[string]uint) + identifierToCount := make(map[string]int) for _, fastaRecord := range sequences { identifierToCount[fastaRecord.Identifier] = 0 }