Rename the Length methods Len to follow GO standart

This commit is contained in:
2022-11-17 11:09:58 +01:00
parent eb32089305
commit 29563aa94e
30 changed files with 134 additions and 130 deletions

View File

@ -31,7 +31,7 @@ func (batch BioSequenceBatch) Slice() obiseq.BioSequenceSlice {
return batch.slice
}
func (batch BioSequenceBatch) Length() int {
func (batch BioSequenceBatch) Len() int {
return len(batch.slice)
}

View File

@ -218,7 +218,7 @@ func (iterator IBioSequenceBatch) Push(batch BioSequenceBatch) {
if batch.IsNil() {
log.Panicln("A Nil batch is pushed on the channel")
}
if batch.Length() == 0 {
if batch.Len() == 0 {
log.Panicln("An empty batch is pushed on the channel")
}
@ -453,7 +453,7 @@ func (iterator IBioSequenceBatch) Count(recycle bool) (int, int, int) {
for _, seq := range batch.Slice() {
variants++
reads += seq.Count()
nucleotides += seq.Length()
nucleotides += seq.Len()
if recycle {
seq.Recycle()

View File

@ -30,7 +30,7 @@ func (iterator IBioSequenceBatch) IMergeSequenceBatch(na string, statsOn []strin
seqs := iterator.Get()
batch.slice = append(batch.slice, seqs.slice.Merge(na, statsOn))
}
if batch.Length() > 0 {
if batch.Len() > 0 {
newIter.Push(batch)
}
}
@ -40,11 +40,10 @@ func (iterator IBioSequenceBatch) IMergeSequenceBatch(na string, statsOn []strin
return newIter
}
func MergePipe(na string, statsOn []string, sizes ...int) Pipeable {
f := func(iterator IBioSequenceBatch) IBioSequenceBatch {
return iterator.IMergeSequenceBatch(na,statsOn,sizes...)
return iterator.IMergeSequenceBatch(na, statsOn, sizes...)
}
return f
}
}

View File

@ -1,9 +1,10 @@
package obiiter
import (
log "github.com/sirupsen/logrus"
"sync"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
)
@ -41,8 +42,7 @@ func (batch PairedBioSequenceBatch) Reorder(newOrder int) PairedBioSequenceBatch
return batch
}
func (batch PairedBioSequenceBatch) Length() int {
func (batch PairedBioSequenceBatch) Len() int {
return len(batch.forward)
}

View File

@ -39,7 +39,7 @@ func (iterator IBioSequenceBatch) Speed(message ...string) IBioSequenceBatch {
for iterator.Next() {
batch := iterator.Get()
l := batch.Length()
l := batch.Len()
newIter.Push(batch)
bar.Add(l)
}