mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 03:50:39 +00:00
Add automatic garbage collection on ApatPattern
This commit is contained in:
@@ -12,6 +12,7 @@ var _Delta = 5
|
||||
var _MinOverlap = 20
|
||||
var _GapPenality = float64(2.0)
|
||||
var _WithoutStats = false
|
||||
var _MinIdentity = 0.9
|
||||
|
||||
func PairingOptionSet(options *getoptions.GetOpt) {
|
||||
options.StringSliceVar(&_ForwardFiles, "forward-reads",
|
||||
@@ -22,16 +23,19 @@ func PairingOptionSet(options *getoptions.GetOpt) {
|
||||
1, 1000,
|
||||
options.Alias("R"),
|
||||
options.Description("The file names containing the reverse reads"))
|
||||
options.IntVar(&_Delta, "delta", 5,
|
||||
options.IntVar(&_Delta, "delta", _Delta,
|
||||
options.Alias("D"),
|
||||
options.Description("Length added to the fast detected overlap for the precise alignement (default 5)."))
|
||||
options.IntVar(&_MinOverlap, "min-overlap", 20,
|
||||
options.Description("Length added to the fast detected overlap for the precise alignement"))
|
||||
options.IntVar(&_MinOverlap, "min-overlap", _MinOverlap,
|
||||
options.Alias("O"),
|
||||
options.Description("Minimum ovelap between both the reads to consider the aligment (default 20)."))
|
||||
options.Float64Var(&_GapPenality, "gap-penality", 2,
|
||||
options.Description("Minimum ovelap between both the reads to consider the aligment"))
|
||||
options.Float64Var(&_MinIdentity, "min-identity", _MinIdentity,
|
||||
options.Alias("O"),
|
||||
options.Description("Minimum identity between ovelaped regions of the reads to consider the aligment"))
|
||||
options.Float64Var(&_GapPenality, "gap-penality", _GapPenality,
|
||||
options.Alias("G"),
|
||||
options.Description("Gap penality expressed as the multiply factor applied to the mismatch score between two nucleotides with a quality of 40 (default 2)."))
|
||||
options.BoolVar(&_WithoutStats, "without-stat", false,
|
||||
options.BoolVar(&_WithoutStats, "without-stat", _WithoutStats,
|
||||
options.Alias("S"),
|
||||
options.Description("Remove alignment statistics from the produced consensus sequences."))
|
||||
}
|
||||
@@ -65,6 +69,10 @@ func MinOverlap() int {
|
||||
return _MinOverlap
|
||||
}
|
||||
|
||||
func MinIdentity() float64 {
|
||||
return _MinIdentity
|
||||
}
|
||||
|
||||
func GapPenality() float64 {
|
||||
return _GapPenality
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func JoinPairedSequence(seqA, seqB obiseq.BioSequence, inplace bool) obiseq.BioS
|
||||
// input sequence.
|
||||
//
|
||||
func AssemblePESequences(seqA, seqB obiseq.BioSequence,
|
||||
gap float64, delta, overlapMin int, withStats bool,
|
||||
gap float64, delta, minOverlap int, minIdentity float64,withStats bool,
|
||||
inplace bool,
|
||||
arenaAlign obialign.PEAlignArena) obiseq.BioSequence {
|
||||
|
||||
@@ -119,8 +119,9 @@ func AssemblePESequences(seqA, seqB obiseq.BioSequence,
|
||||
}
|
||||
lcons := cons.Length()
|
||||
aliLength := lcons - _Abs(left) - _Abs(right)
|
||||
identity := float64(match)/float64(aliLength)
|
||||
|
||||
if aliLength >= overlapMin {
|
||||
if aliLength >= minOverlap && identity >= minIdentity {
|
||||
if withStats {
|
||||
annot := cons.Annotations()
|
||||
annot["mode"] = "alignment"
|
||||
@@ -203,7 +204,7 @@ func AssemblePESequences(seqA, seqB obiseq.BioSequence,
|
||||
// each pair of processed sequences produces one sequence in the result iterator.
|
||||
//
|
||||
func IAssemblePESequencesBatch(iterator obiseq.IPairedBioSequenceBatch,
|
||||
gap float64, delta, minOverlap int, withStats bool, sizes ...int) obiseq.IBioSequenceBatch {
|
||||
gap float64, delta, minOverlap int, minIdentity float64, withStats bool, sizes ...int) obiseq.IBioSequenceBatch {
|
||||
|
||||
nworkers := runtime.NumCPU() * 3 / 2
|
||||
buffsize := iterator.BufferSize()
|
||||
@@ -246,7 +247,7 @@ func IAssemblePESequencesBatch(iterator obiseq.IPairedBioSequenceBatch,
|
||||
processed := 0
|
||||
for i, A := range batch.Forward() {
|
||||
B := batch.Reverse()[i]
|
||||
cons[i] = AssemblePESequences(A, B, gap, delta, minOverlap, withStats, true, arena)
|
||||
cons[i] = AssemblePESequences(A, B, gap, delta, minOverlap, minIdentity, withStats, true, arena)
|
||||
if i%59 == 0 {
|
||||
bar.Add(59)
|
||||
processed += 59
|
||||
|
||||
Reference in New Issue
Block a user