From 8a98210103a9b0f23847a207adbf69048e55a5aa Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 14 Aug 2023 15:21:30 +0200 Subject: [PATCH] A small bug in logging and API documentation Former-commit-id: 1ab4534581987586741db13d3453db52973524fe --- pkg/obiformats/dispatcher.go | 2 +- pkg/obiformats/fastseq_header.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/obiformats/dispatcher.go b/pkg/obiformats/dispatcher.go index fa45b69..e626c16 100644 --- a/pkg/obiformats/dispatcher.go +++ b/pkg/obiformats/dispatcher.go @@ -57,7 +57,7 @@ func WriterDispatcher(prototypename string, info, err := os.Stat(directory) switch { case !os.IsNotExist(err) && !info.IsDir(): - log.Fatalln("Cannot Create the directory %s", directory) + log.Fatalf("Cannot Create the directory %s", directory) case os.IsNotExist(err): os.Mkdir(directory, 0755) } diff --git a/pkg/obiformats/fastseq_header.go b/pkg/obiformats/fastseq_header.go index 29da3c3..77b5415 100644 --- a/pkg/obiformats/fastseq_header.go +++ b/pkg/obiformats/fastseq_header.go @@ -7,14 +7,26 @@ import ( "git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq" ) +// ParseGuessedFastSeqHeader parses the guessed fast sequence header. +// +// The function takes a pointer to a BioSequence object as its parameter. +// It determines whether the sequence definition starts with "{" or not. +// If it does, it calls the ParseFastSeqJsonHeader function. +// If it doesn't, it calls the ParseFastSeqOBIHeader function. func ParseGuessedFastSeqHeader(sequence *obiseq.BioSequence) { if strings.HasPrefix(sequence.Definition(), "{") { + // Sequence definition starts with "{" ParseFastSeqJsonHeader(sequence) } else { + // Sequence definition does not start with "{" ParseFastSeqOBIHeader(sequence) } } +// IParseFastSeqHeaderBatch is a function that processes a batch of biosequences and returns an iterator of biosequences. +// +// It takes an iterator of biosequences as the first parameter and accepts optional options as variadic arguments. +// The function returns an iterator of biosequences. func IParseFastSeqHeaderBatch(iterator obiiter.IBioSequence, options ...WithOption) obiiter.IBioSequence { opt := MakeOptions(options)