From 8895381c922a04e2ef550effb60147ce549ad65d Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Wed, 7 Jun 2023 17:43:32 +0200 Subject: [PATCH] Correct a bug when sequence length is shorter than kmer size in debruijngraph Former-commit-id: 56cd670d24065d8774abdcbf685ff4a13e7c4132 --- pkg/obikmer/debruijn.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/obikmer/debruijn.go b/pkg/obikmer/debruijn.go index a739855..6042a9b 100644 --- a/pkg/obikmer/debruijn.go +++ b/pkg/obikmer/debruijn.go @@ -361,12 +361,13 @@ func (graph *DeBruijnGraph) Push(sequence *obiseq.BioSequence) { init = append(init, key&graph.kmermask) } - f(0, key) + if sequence.Len() > graph.kmersize { + f(0, key) - for _, idx := range init { - graph.append(s[graph.kmersize:], idx) + for _, idx := range init { + graph.append(s[graph.kmersize:], idx) + } } - } func (graph *DeBruijnGraph) Gml() string {