mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-10 17:50:26 +00:00
Reduce memory allocation events
Former-commit-id: fbdb2afc857b02adc2593e2278d3bd838e99b0b2
This commit is contained in:
@@ -53,10 +53,7 @@ func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||
}
|
||||
|
||||
nworkers := obioptions.CLIParallelWorkers() / 4
|
||||
if nworkers < 2 {
|
||||
nworkers = 2
|
||||
}
|
||||
nworkers := obioptions.CLIWriteParallelWorkers()
|
||||
|
||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
||||
opts = append(opts, obiformats.OptionsBatchSize(obioptions.CLIBatchSize()))
|
||||
|
||||
@@ -55,6 +55,8 @@ func JoinPairedSequence(seqA, seqB *obiseq.BioSequence, inplace bool) *obiseq.Bi
|
||||
seqA = seqA.Copy()
|
||||
}
|
||||
|
||||
seqA.Grow(seqB.Len() + 10)
|
||||
|
||||
seqA.WriteString("..........")
|
||||
seqA.Write(seqB.Sequence())
|
||||
|
||||
@@ -108,13 +110,16 @@ func JoinPairedSequence(seqA, seqB *obiseq.BioSequence, inplace bool) *obiseq.Bi
|
||||
func AssemblePESequences(seqA, seqB *obiseq.BioSequence,
|
||||
gap, scale float64, delta, minOverlap int, minIdentity float64, withStats bool,
|
||||
inplace bool, fastAlign, fastModeRel bool,
|
||||
arenaAlign obialign.PEAlignArena) *obiseq.BioSequence {
|
||||
arenaAlign obialign.PEAlignArena, shifh_buff *map[int]int) *obiseq.BioSequence {
|
||||
|
||||
score, path, fastcount, over, fastscore := obialign.PEAlign(seqA, seqB,
|
||||
score, path, fastcount, over, fastscore := obialign.PEAlign(
|
||||
seqA, seqB,
|
||||
gap, scale,
|
||||
fastAlign, delta, fastModeRel,
|
||||
arenaAlign)
|
||||
cons, match := obialign.BuildQualityConsensus(seqA, seqB, path, true)
|
||||
arenaAlign, shifh_buff,
|
||||
)
|
||||
|
||||
cons, match := obialign.BuildQualityConsensus(seqA, seqB, path, true, arenaAlign)
|
||||
|
||||
left := path[0]
|
||||
right := 0
|
||||
@@ -238,6 +243,7 @@ func IAssemblePESequencesBatch(iterator obiiter.IBioSequence,
|
||||
|
||||
f := func(iterator obiiter.IBioSequence, wid int) {
|
||||
arena := obialign.MakePEAlignArena(150, 150)
|
||||
shifts := make(map[int]int)
|
||||
|
||||
for iterator.Next() {
|
||||
batch := iterator.Get()
|
||||
@@ -246,7 +252,7 @@ func IAssemblePESequencesBatch(iterator obiiter.IBioSequence,
|
||||
B := A.PairedWith()
|
||||
cons[i] = AssemblePESequences(A, B.ReverseComplement(true),
|
||||
gap, scale,
|
||||
delta, minOverlap, minIdentity, withStats, true, fastAlign, fastModeRel, arena)
|
||||
delta, minOverlap, minIdentity, withStats, true, fastAlign, fastModeRel, arena, &shifts)
|
||||
}
|
||||
newIter.Push(obiiter.MakeBioSequenceBatch(
|
||||
batch.Order(),
|
||||
|
||||
@@ -37,6 +37,7 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
||||
f := func(iterator obiiter.IBioSequence, wid int) {
|
||||
arena := obialign.MakePEAlignArena(150, 150)
|
||||
var err error
|
||||
shifts := make(map[int]int)
|
||||
|
||||
for iterator.Next() {
|
||||
batch := iterator.Get()
|
||||
@@ -46,7 +47,7 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
||||
A.Copy(), B.ReverseComplement(false),
|
||||
gap, scale,
|
||||
delta, minOverlap, minIdentity, withStats, true,
|
||||
fastAlign, fastScoreRel, arena,
|
||||
fastAlign, fastScoreRel, arena, &shifts,
|
||||
)
|
||||
|
||||
consensus, err = ngsfilter.ExtractBarcode(consensus, true)
|
||||
|
||||
Reference in New Issue
Block a user