mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-13 02:30:26 +00:00
Merge branch 'master' into taxonomy
This commit is contained in:
@@ -99,6 +99,8 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
|
||||
opts = append(opts, obiformats.OptionsFastSeqHeaderParser(obiformats.ParseGuessedFastSeqHeader))
|
||||
}
|
||||
|
||||
opts = append(opts, obiformats.OptionsReadQualities(obioptions.CLIReadQualities()))
|
||||
|
||||
nworkers := obioptions.CLIReadParallelWorkers()
|
||||
if nworkers < 2 {
|
||||
nworkers = 2
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
)
|
||||
|
||||
func _Abs(x int) int {
|
||||
@@ -112,7 +113,7 @@ func AssemblePESequences(seqA, seqB *obiseq.BioSequence,
|
||||
inplace bool, fastAlign, fastModeRel bool,
|
||||
arenaAlign obialign.PEAlignArena, shifh_buff *map[int]int) *obiseq.BioSequence {
|
||||
|
||||
score, path, fastcount, over, fastscore := obialign.PEAlign(
|
||||
isLeftAlign, score, path, fastcount, over, fastscore := obialign.PEAlign(
|
||||
seqA, seqB,
|
||||
gap, scale,
|
||||
fastAlign, delta, fastModeRel,
|
||||
@@ -143,19 +144,14 @@ func AssemblePESequences(seqA, seqB *obiseq.BioSequence,
|
||||
if aliLength >= minOverlap && identity >= minIdentity {
|
||||
annot["mode"] = "alignment"
|
||||
if withStats {
|
||||
if left < 0 {
|
||||
annot["seq_a_single"] = -left
|
||||
if isLeftAlign {
|
||||
annot["ali_dir"] = "left"
|
||||
annot["seq_a_single"] = obiutils.Abs(left)
|
||||
annot["seq_b_single"] = obiutils.Abs(right)
|
||||
} else {
|
||||
annot["seq_b_single"] = left
|
||||
annot["ali_dir"] = "right"
|
||||
}
|
||||
|
||||
if right < 0 {
|
||||
right = -right
|
||||
annot["seq_a_single"] = right
|
||||
} else {
|
||||
annot["seq_b_single"] = right
|
||||
annot["seq_a_single"] = obiutils.Abs(right)
|
||||
annot["seq_b_single"] = obiutils.Abs(left)
|
||||
}
|
||||
}
|
||||
if inplace {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
var _reorientate = false
|
||||
|
||||
func TagPCROptionSet(options *getoptions.GetOpt) {
|
||||
options.BoolVar(&_reorientate, "reference-db", _reorientate,
|
||||
options.BoolVar(&_reorientate, "reorientate", _reorientate,
|
||||
options.Description("Reverse complemente reads if needed to store all the sequences in "+
|
||||
"the same orientation respectively to forward and reverse primers"))
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
||||
newIter := obiiter.MakeIBioSequence()
|
||||
newIter.MarkAsPaired()
|
||||
|
||||
f := func(iterator obiiter.IBioSequence, wid int) {
|
||||
f := func(iterator obiiter.IBioSequence) {
|
||||
arena := obialign.MakePEAlignArena(150, 150)
|
||||
shifts := make(map[int]int)
|
||||
|
||||
@@ -89,46 +89,51 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
||||
|
||||
forward_match := annot["obimultiplex_forward_match"].(string)
|
||||
forward_mismatches := annot["obimultiplex_forward_error"].(int)
|
||||
forward_tag := annot["obimultiplex_forward_tag"].(string)
|
||||
|
||||
reverse_match := annot["obimultiplex_reverse_match"].(string)
|
||||
reverse_mismatches := annot["obimultiplex_reverse_error"].(int)
|
||||
reverse_tag := annot["obimultiplex_reverse_tag"].(string)
|
||||
|
||||
sample := annot["sample"].(string)
|
||||
experiment := annot["experiment"].(string)
|
||||
|
||||
aanot := A.Annotations()
|
||||
banot := B.Annotations()
|
||||
|
||||
if value, ok := annot["obimultiplex_forward_tag"]; ok {
|
||||
forward_tag := value.(string)
|
||||
aanot["obimultiplex_forward_tag"] = forward_tag
|
||||
banot["obimultiplex_forward_tag"] = forward_tag
|
||||
}
|
||||
|
||||
if value, ok := annot["obimultiplex_reverse_tag"]; ok {
|
||||
reverse_tag := value.(string)
|
||||
aanot["obimultiplex_reverse_tag"] = reverse_tag
|
||||
banot["obimultiplex_reverse_tag"] = reverse_tag
|
||||
}
|
||||
|
||||
aanot["obimultiplex_direction"] = direction
|
||||
|
||||
aanot["obimultiplex_forward_match"] = forward_match
|
||||
aanot["obimultiplex_forward_mismatches"] = forward_mismatches
|
||||
aanot["obimultiplex_forward_tag"] = forward_tag
|
||||
|
||||
aanot["obimultiplex_reverse_match"] = reverse_match
|
||||
aanot["obimultiplex_reverse_mismatches"] = reverse_mismatches
|
||||
aanot["obimultiplex_reverse_tag"] = reverse_tag
|
||||
|
||||
aanot["sample"] = sample
|
||||
aanot["experiment"] = experiment
|
||||
|
||||
banot := B.Annotations()
|
||||
banot["obimultiplex_direction"] = direction
|
||||
|
||||
banot["obimultiplex_forward_match"] = forward_match
|
||||
banot["obimultiplex_forward_mismatches"] = forward_mismatches
|
||||
banot["obimultiplex_forward_tag"] = forward_tag
|
||||
|
||||
banot["obimultiplex_reverse_match"] = reverse_match
|
||||
banot["obimultiplex_reverse_mismatches"] = reverse_mismatches
|
||||
banot["obimultiplex_reverse_tag"] = reverse_tag
|
||||
|
||||
banot["sample"] = sample
|
||||
banot["experiment"] = experiment
|
||||
|
||||
if CLIReorientate() && direction == "reverse" {
|
||||
B.ReverseComplement(true)
|
||||
A.ReverseComplement(true)
|
||||
B.PairTo(A)
|
||||
batch.Slice()[i] = B
|
||||
}
|
||||
@@ -162,9 +167,9 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
||||
|
||||
newIter.Add(nworkers)
|
||||
for i := 1; i < nworkers; i++ {
|
||||
go f(iterator.Split(), i)
|
||||
go f(iterator.Split())
|
||||
}
|
||||
go f(iterator, 0)
|
||||
go f(iterator)
|
||||
|
||||
go func() {
|
||||
newIter.WaitAndClose()
|
||||
|
||||
Reference in New Issue
Block a user