Small change to increase efficiency (a little)

Former-commit-id: fa54c9bf82b8ba60653255ab2a5f671619dcfdcb
This commit is contained in:
2023-05-05 13:33:15 +02:00
parent 3778ae9266
commit e9574bae07
2 changed files with 44 additions and 35 deletions

View File

@ -48,7 +48,8 @@ func IndexSequence(seqidx int,
obiutils.Reverse(*pseq, true)
// score := make([]int, len(references))
mindiff := make([]int, len(*pseq))
/* nseq := make([]int, len(*pseq))
/*
nseq := make([]int, len(*pseq))
nali := make([]int, len(*pseq))
nok := make([]int, len(*pseq))
nfast := make([]int, len(*pseq))
@ -56,14 +57,20 @@ func IndexSequence(seqidx int,
*/lseq := sequence.Len()
mini := -1
wordmin := 0
for i, ancestor := range *pseq {
for _, order := range ow {
if lca[order] == ancestor {
// nseq[i]++
wordmin := 0
if mini != -1 {
wordmin = obiutils.MaxInt(lseq-3-mini*4, 0)
wordmin = obiutils.MaxInt(sequence.Len(), references[order].Len()) - 3 - 4*mini
}
if cw[order] < wordmin {
break
}
lcs, alilength := -1, -1
errs := int(1e9)
if mini != -1 && mini <= 1 {
@ -74,14 +81,13 @@ func IndexSequence(seqidx int,
// nfastok[i]++
}
} else {
if cw[order] >= wordmin {
// nali[i]++
lcs, alilength = obialign.FastLCSScore(sequence, references[order], mini, &matrix)
if lcs >= 0 {
// nok[i]++
errs = alilength - lcs
}
}
}
if mini == -1 || errs < mini {
mini = errs
@ -106,7 +112,8 @@ func IndexSequence(seqidx int,
}
}
/* log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), obitag_index)
/*
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), obitag_index)
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nseq)
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfast)
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfastok)

View File

@ -45,13 +45,17 @@ func FindClosests(sequence *obiseq.BioSequence,
for _, order := range o {
ref := references[order]
score := int(1e9)
if maxe != -1 {
wordmin = obiutils.MaxInt(sequence.Len(), ref.Len()) - 4*maxe
wordmin = obiutils.MaxInt(sequence.Len(), ref.Len()) - 3 - 4*maxe
}
if cw[order] < wordmin {
break
}
lcs, alilength := -1, -1
score := int(1e9)
if maxe == 0 || maxe == 1 {
d, _, _, _ := obialign.D1Or0(sequence, references[order])
if d >= 0 {
@ -60,13 +64,11 @@ func FindClosests(sequence *obiseq.BioSequence,
lcs = alilength - score
}
} else {
if cw[order] >= wordmin {
lcs, alilength = obialign.FastLCSScore(sequence, references[order], maxe, &matrix)
if lcs >= 0 {
score = alilength - lcs
}
}
}
if maxe == -1 || score < maxe {
bests = bests[:0]