Adds the option --pairing-scale to obipairing

Former-commit-id: c60416708467f5e818e70e08b3c512014b6212f0
This commit is contained in:
2023-12-07 12:28:16 +01:00
parent 008f33aee4
commit 37c3e16d5d
6 changed files with 42 additions and 27 deletions

View File

@@ -10,11 +10,12 @@ var _ForwardFile = ""
var _ReverseFile = ""
var _Delta = 5
var _MinOverlap = 20
var _GapPenality = float64(2.0)
var _GapPenality = 2.0
var _WithoutStats = false
var _MinIdentity = 0.9
var _NoFastAlign = false
var _FastScoreAbs = false
var _PenalityScale = 1.0
func PairingOptionSet(options *getoptions.GetOpt) {
options.StringVar(&_ForwardFile, "forward-reads", "",
@@ -38,6 +39,8 @@ func PairingOptionSet(options *getoptions.GetOpt) {
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.Float64Var(&_PenalityScale, "penality-scale", _PenalityScale,
options.Description("Scale factor applied to the mismatch score and the gap penality (default 1)."))
options.BoolVar(&_WithoutStats, "without-stat", _WithoutStats,
options.Alias("S"),
options.Description("Remove alignment statistics from the produced consensus sequences."))
@@ -85,6 +88,10 @@ func CLIGapPenality() float64 {
return _GapPenality
}
func CLIPenalityScale() float64 {
return _PenalityScale
}
func CLIWithStats() bool {
return !_WithoutStats
}

View File

@@ -106,11 +106,14 @@ func JoinPairedSequence(seqA, seqB *obiseq.BioSequence, inplace bool) *obiseq.Bi
// An obiseq.BioSequence corresponding to the assembling of the both
// input sequence.
func AssemblePESequences(seqA, seqB *obiseq.BioSequence,
gap float64, delta, minOverlap int, minIdentity float64, withStats bool,
gap, scale float64, delta, minOverlap int, minIdentity float64, withStats bool,
inplace bool, fastAlign, fastModeRel bool,
arenaAlign obialign.PEAlignArena) *obiseq.BioSequence {
score, path, fastcount, over, fastscore := obialign.PEAlign(seqA, seqB, gap, fastAlign, delta, fastModeRel, arenaAlign)
score, path, fastcount, over, fastscore := obialign.PEAlign(seqA, seqB,
gap, scale,
fastAlign, delta, fastModeRel,
arenaAlign)
cons, match := obialign.BuildQualityConsensus(seqA, seqB, path, true)
left := path[0]
@@ -210,7 +213,7 @@ func AssemblePESequences(seqA, seqB *obiseq.BioSequence,
// The function returns an iterator over batches of obiseq.Biosequence object.
// each pair of processed sequences produces one sequence in the result iterator.
func IAssemblePESequencesBatch(iterator obiiter.IBioSequence,
gap float64, delta, minOverlap int,
gap, scale float64, delta, minOverlap int,
minIdentity float64, fastAlign, fastModeRel,
withStats bool, sizes ...int) obiiter.IBioSequence {
@@ -241,7 +244,9 @@ func IAssemblePESequencesBatch(iterator obiiter.IBioSequence,
cons := make(obiseq.BioSequenceSlice, len(batch.Slice()))
for i, A := range batch.Slice() {
B := A.PairedWith()
cons[i] = AssemblePESequences(A, B.ReverseComplement(true), gap, delta, minOverlap, minIdentity, withStats, true, fastAlign, fastModeRel, arena)
cons[i] = AssemblePESequences(A, B.ReverseComplement(true),
gap, scale,
delta, minOverlap, minIdentity, withStats, true, fastAlign, fastModeRel, arena)
}
newIter.Push(obiiter.MakeBioSequenceBatch(
batch.Order(),

View File

@@ -13,7 +13,7 @@ import (
)
func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
gap float64, delta, minOverlap int,
gap, scale float64, delta, minOverlap int,
minIdentity float64, fastAlign, fastScoreRel,
withStats bool) obiiter.IBioSequence {
@@ -50,7 +50,8 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
B := A.PairedWith()
consensus := obipairing.AssemblePESequences(
A.Copy(), B.ReverseComplement(false),
gap, delta, minOverlap, minIdentity, withStats, true,
gap, scale,
delta, minOverlap, minIdentity, withStats, true,
fastAlign, fastScoreRel, arena,
)