Add obisuperkmer command implementation and tests

This commit adds the implementation of the obisuperkmer command, including:

- The main command in cmd/obitools/obisuperkmer/
- The package implementation in pkg/obitools/obisuperkmer/
- Automated tests in obitests/obitools/obisuperkmer/
- Documentation for the implementation and tests

The obisuperkmer command extracts super k-mers from DNA sequences, following the standard OBITools architecture. It includes proper CLI option handling, validation of parameters, and integration with the OBITools pipeline system.

Tests cover basic functionality, parameter validation, output format, metadata preservation, and file I/O operations.
This commit is contained in:
Eric Coissac
2026-02-07 13:53:13 +01:00
parent 00c8be6b48
commit 7a979ba77f
11 changed files with 1755 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package main
import (
"os"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obisuperkmer"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
)
func main() {
// Generate option parser
optionParser := obioptions.GenerateOptionParser(
"obisuperkmer",
"extract super k-mers from sequence files",
obisuperkmer.OptionSet)
// Parse command-line arguments
_, args := optionParser(os.Args)
// Read input sequences
sequences, err := obiconvert.CLIReadBioSequences(args...)
obiconvert.OpenSequenceDataErrorMessage(args, err)
// Extract super k-mers
superkmers := obisuperkmer.CLIExtractSuperKmers(sequences)
// Write output sequences
obiconvert.CLIWriteBioSequences(superkmers, true)
// Wait for pipeline completion
obiutils.WaitForLastPipe()
}