mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds code for the --length option of obiannotate
This commit is contained in:
@ -55,6 +55,16 @@ func AddTaxonAtRankWorker(taxonomy *obitax.Taxonomy, ranks ...string) obiseq.Seq
|
||||
return f
|
||||
}
|
||||
|
||||
func AddSeqLengthWorker() obiseq.SeqWorker {
|
||||
f := func(s *obiseq.BioSequence) *obiseq.BioSequence {
|
||||
s.SetAttribute("seq_length", s.Len())
|
||||
return s
|
||||
}
|
||||
|
||||
return f
|
||||
|
||||
}
|
||||
|
||||
func CLIAnnotationWorker() obiseq.SeqWorker {
|
||||
var annotator obiseq.SeqWorker
|
||||
annotator = nil
|
||||
@ -80,6 +90,11 @@ func CLIAnnotationWorker() obiseq.SeqWorker {
|
||||
annotator = annotator.ChainWorkers(w)
|
||||
}
|
||||
|
||||
if CLIHasSetLengthFlag() {
|
||||
w := AddSeqLengthWorker()
|
||||
annotator = annotator.ChainWorkers(w)
|
||||
}
|
||||
|
||||
return annotator
|
||||
}
|
||||
|
||||
|
@ -128,3 +128,7 @@ func CLIHasTaxonAtRank() bool {
|
||||
func CLITaxonAtRank() []string {
|
||||
return _taxonAtRank
|
||||
}
|
||||
|
||||
func CLIHasSetLengthFlag() bool {
|
||||
return _setSeqLength
|
||||
}
|
Reference in New Issue
Block a user