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

@ -119,8 +119,8 @@ func (pattern ApatPattern) String() string {
return C.GoString(pattern.pointer.pointer.cpat)
}
// Length method returns the length of the matched pattern.
func (pattern ApatPattern) Length() int {
// Len method returns the length of the matched pattern.
func (pattern ApatPattern) Len() int {
return int(pattern.pointer.pointer.patlen)
}
@ -159,7 +159,7 @@ func MakeApatSequence(sequence *obiseq.BioSequence, circular bool, recycle ...Ap
var errno C.int32_t
var errmsg *C.char
var p unsafe.Pointer
seqlen := sequence.Length()
seqlen := sequence.Len()
ic := 0
if circular {
@ -195,7 +195,7 @@ func MakeApatSequence(sequence *obiseq.BioSequence, circular bool, recycle ...Ap
// copy the data into the buffer, by converting it to a Go array
cBuf := (*[1 << 31]byte)(p)
copy(cBuf[:], sequence.Sequence())
cBuf[sequence.Length()] = 0
cBuf[sequence.Len()] = 0
pseqc := C.new_apatseq((*C.char)(p), C.int32_t(ic), C.int32_t(seqlen),
(*C.Seq)(out),
@ -240,8 +240,8 @@ func MakeApatSequence(sequence *obiseq.BioSequence, circular bool, recycle ...Ap
return ApatSequence{recycle[0].pointer}, nil
}
// Length method returns the length of the ApatSequence.
func (sequence ApatSequence) Length() int {
// Len method returns the length of the ApatSequence.
func (sequence ApatSequence) Len() int {
return int(sequence.pointer.pointer.seqlen)
}
@ -283,7 +283,7 @@ func (sequence ApatSequence) Free() {
// match. The third value indicates the number of error detected for this occurrence.
func (pattern ApatPattern) FindAllIndex(sequence ApatSequence, limits ...int) (loc [][3]int) {
begin := 0
length := sequence.Length()
length := sequence.Len()
if len(limits) > 0 {
begin = limits[0]

View File

@ -234,15 +234,15 @@ func _Pcr(seq ApatSequence,
if len(forwardMatches) > 0 {
begin := forwardMatches[0][0]
length := seq.Length() - begin
length := seq.Len() - begin
if opt.pointer.maxLength > 0 {
length = forwardMatches[len(forwardMatches)-1][2] - begin + opt.MaxLength() + reverse.Length()
length = forwardMatches[len(forwardMatches)-1][2] - begin + opt.MaxLength() + reverse.Len()
}
if opt.Circular() {
begin = 0
length = seq.Length() + _MaxPatLen
length = seq.Len() + _MaxPatLen
}
reverseMatches := crev.FindAllIndex(seq, begin, length)
@ -252,13 +252,13 @@ func _Pcr(seq ApatSequence,
posi := fm[0]
if posi < seq.Length() {
if posi < seq.Len() {
erri := fm[2]
for _, rm := range reverseMatches {
posj := rm[0]
if posj < seq.Length() {
if posj < seq.Len() {
posj := rm[1]
errj := rm[2]
length = 0
@ -267,7 +267,7 @@ func _Pcr(seq ApatSequence,
length = rm[0] - fm[1]
} else {
if opt.Circular() {
length = rm[0] + seq.Length() - posi - forward.Length()
length = rm[0] + seq.Len() - posi - forward.Len()
}
}
if length > 0 && // For when primers touch or overlap
@ -307,15 +307,15 @@ func _Pcr(seq ApatSequence,
if forwardMatches != nil {
begin := forwardMatches[0][0]
length := seq.Length() - begin
length := seq.Len() - begin
if opt.pointer.maxLength > 0 {
length = forwardMatches[len(forwardMatches)-1][2] - begin + opt.MaxLength() + reverse.Length()
length = forwardMatches[len(forwardMatches)-1][2] - begin + opt.MaxLength() + reverse.Len()
}
if opt.Circular() {
begin = 0
length = seq.Length() + _MaxPatLen
length = seq.Len() + _MaxPatLen
}
reverseMatches := cfwd.FindAllIndex(seq, begin, length)
@ -325,13 +325,13 @@ func _Pcr(seq ApatSequence,
posi := fm[0]
if posi < seq.Length() {
if posi < seq.Len() {
erri := fm[2]
for _, rm := range reverseMatches {
posj := rm[0]
if posj < seq.Length() {
if posj < seq.Len() {
posj := rm[1]
errj := rm[2]
length = 0
@ -340,7 +340,7 @@ func _Pcr(seq ApatSequence,
length = rm[0] - fm[1]
} else {
if opt.Circular() {
length = rm[0] + seq.Length() - posi - forward.Length()
length = rm[0] + seq.Len() - posi - forward.Len()
}
}
if length > 0 && // For when primers touch or overlap