mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Small change to increase efficiency (a little)
Former-commit-id: fa54c9bf82b8ba60653255ab2a5f671619dcfdcb
This commit is contained in:
@ -48,7 +48,8 @@ func IndexSequence(seqidx int,
|
|||||||
obiutils.Reverse(*pseq, true)
|
obiutils.Reverse(*pseq, true)
|
||||||
// score := make([]int, len(references))
|
// score := make([]int, len(references))
|
||||||
mindiff := make([]int, len(*pseq))
|
mindiff := make([]int, len(*pseq))
|
||||||
/* nseq := make([]int, len(*pseq))
|
/*
|
||||||
|
nseq := make([]int, len(*pseq))
|
||||||
nali := make([]int, len(*pseq))
|
nali := make([]int, len(*pseq))
|
||||||
nok := make([]int, len(*pseq))
|
nok := make([]int, len(*pseq))
|
||||||
nfast := make([]int, len(*pseq))
|
nfast := make([]int, len(*pseq))
|
||||||
@ -56,14 +57,20 @@ func IndexSequence(seqidx int,
|
|||||||
*/lseq := sequence.Len()
|
*/lseq := sequence.Len()
|
||||||
|
|
||||||
mini := -1
|
mini := -1
|
||||||
|
wordmin := 0
|
||||||
|
|
||||||
for i, ancestor := range *pseq {
|
for i, ancestor := range *pseq {
|
||||||
for _, order := range ow {
|
for _, order := range ow {
|
||||||
if lca[order] == ancestor {
|
if lca[order] == ancestor {
|
||||||
// nseq[i]++
|
// nseq[i]++
|
||||||
wordmin := 0
|
|
||||||
if mini != -1 {
|
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
|
lcs, alilength := -1, -1
|
||||||
errs := int(1e9)
|
errs := int(1e9)
|
||||||
if mini != -1 && mini <= 1 {
|
if mini != -1 && mini <= 1 {
|
||||||
@ -74,14 +81,13 @@ func IndexSequence(seqidx int,
|
|||||||
// nfastok[i]++
|
// nfastok[i]++
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if cw[order] >= wordmin {
|
|
||||||
// nali[i]++
|
// nali[i]++
|
||||||
lcs, alilength = obialign.FastLCSScore(sequence, references[order], mini, &matrix)
|
lcs, alilength = obialign.FastLCSScore(sequence, references[order], mini, &matrix)
|
||||||
if lcs >= 0 {
|
if lcs >= 0 {
|
||||||
// nok[i]++
|
// nok[i]++
|
||||||
errs = alilength - lcs
|
errs = alilength - lcs
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if mini == -1 || errs < mini {
|
if mini == -1 || errs < mini {
|
||||||
mini = errs
|
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(), nseq)
|
||||||
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfast)
|
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfast)
|
||||||
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfastok)
|
log.Println(sequence.Id(), tseq.Taxid(), tseq.ScientificName(), tseq.Rank(), nfastok)
|
||||||
|
@ -45,13 +45,17 @@ func FindClosests(sequence *obiseq.BioSequence,
|
|||||||
|
|
||||||
for _, order := range o {
|
for _, order := range o {
|
||||||
ref := references[order]
|
ref := references[order]
|
||||||
|
score := int(1e9)
|
||||||
|
|
||||||
if maxe != -1 {
|
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
|
lcs, alilength := -1, -1
|
||||||
score := int(1e9)
|
|
||||||
if maxe == 0 || maxe == 1 {
|
if maxe == 0 || maxe == 1 {
|
||||||
d, _, _, _ := obialign.D1Or0(sequence, references[order])
|
d, _, _, _ := obialign.D1Or0(sequence, references[order])
|
||||||
if d >= 0 {
|
if d >= 0 {
|
||||||
@ -60,13 +64,11 @@ func FindClosests(sequence *obiseq.BioSequence,
|
|||||||
lcs = alilength - score
|
lcs = alilength - score
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if cw[order] >= wordmin {
|
|
||||||
lcs, alilength = obialign.FastLCSScore(sequence, references[order], maxe, &matrix)
|
lcs, alilength = obialign.FastLCSScore(sequence, references[order], maxe, &matrix)
|
||||||
if lcs >= 0 {
|
if lcs >= 0 {
|
||||||
score = alilength - lcs
|
score = alilength - lcs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if maxe == -1 || score < maxe {
|
if maxe == -1 || score < maxe {
|
||||||
bests = bests[:0]
|
bests = bests[:0]
|
||||||
|
Reference in New Issue
Block a user