2022-01-13 23:27:39 +01:00
|
|
|
package obiformats
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2022-02-24 07:08:40 +01:00
|
|
|
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
|
2022-01-13 23:43:01 +01:00
|
|
|
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
|
2022-01-13 23:27:39 +01:00
|
|
|
)
|
|
|
|
|
2022-02-21 19:00:23 +01:00
|
|
|
func ParseGuessedFastSeqHeader(sequence *obiseq.BioSequence) {
|
2022-01-13 23:27:39 +01:00
|
|
|
if strings.HasPrefix(sequence.Definition(), "{") {
|
|
|
|
ParseFastSeqJsonHeader(sequence)
|
|
|
|
} else {
|
|
|
|
ParseFastSeqOBIHeader(sequence)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-24 07:08:40 +01:00
|
|
|
func IParseFastSeqHeaderBatch(iterator obiiter.IBioSequenceBatch,
|
|
|
|
options ...WithOption) obiiter.IBioSequenceBatch {
|
2022-01-13 23:27:39 +01:00
|
|
|
opt := MakeOptions(options)
|
2022-02-24 07:08:40 +01:00
|
|
|
return iterator.MakeIWorker(obiiter.AnnotatorToSeqWorker(opt.ParseFastSeqHeader()),
|
2022-01-13 23:27:39 +01:00
|
|
|
opt.ParallelWorkers(),
|
|
|
|
opt.BufferSize())
|
|
|
|
}
|
|
|
|
|
2022-02-24 07:08:40 +01:00
|
|
|
func IParseFastSeqHeader(iterator obiiter.IBioSequence,
|
|
|
|
options ...WithOption) obiiter.IBioSequence {
|
2022-01-13 23:27:39 +01:00
|
|
|
opt := MakeOptions(options)
|
|
|
|
|
|
|
|
return IParseFastSeqHeaderBatch(iterator.IBioSequenceBatch(opt.BatchSize(),
|
|
|
|
opt.BufferSize()),
|
|
|
|
options...).SortBatches().IBioSequence()
|
|
|
|
}
|