mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds an error message when no sample can be associated
This commit is contained in:
@ -155,8 +155,7 @@ func (marker *Marker) Match(sequence obiseq.BioSequence) *DemultiplexMatch {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := fmt.Errorf("cannot locates reverse priming site")
|
m.Error = fmt.Errorf("cannot locates reverse priming site")
|
||||||
m.Error = err
|
|
||||||
|
|
||||||
return &m
|
return &m
|
||||||
}
|
}
|
||||||
@ -211,8 +210,8 @@ func (marker *Marker) Match(sequence obiseq.BioSequence) *DemultiplexMatch {
|
|||||||
return &m
|
return &m
|
||||||
}
|
}
|
||||||
|
|
||||||
err := fmt.Errorf("cannot locates forward priming site")
|
m.Error = fmt.Errorf("cannot locates forward priming site")
|
||||||
m.Error = err
|
|
||||||
return &m
|
return &m
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,11 +231,17 @@ func (match *DemultiplexMatch) ExtractBarcode(sequence obiseq.BioSequence, inpla
|
|||||||
|
|
||||||
if match.ForwardMatch != "" && match.ReverseMatch != "" {
|
if match.ForwardMatch != "" && match.ReverseMatch != "" {
|
||||||
var err error
|
var err error
|
||||||
sequence, err = sequence.Subsequence(match.BarcodeStart, match.BarcodeEnd, false)
|
|
||||||
|
|
||||||
|
if match.BarcodeStart < match.BarcodeEnd {
|
||||||
|
sequence, err = sequence.Subsequence(match.BarcodeStart, match.BarcodeEnd, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("cannot extract sub sequence %d..%d %v", match.BarcodeStart, match.BarcodeEnd, *match)
|
log.Fatalf("cannot extract sub sequence %d..%d %v", match.BarcodeStart, match.BarcodeEnd, *match)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
annot := sequence.Annotations()
|
||||||
|
annot["demultiplex_error"] = "read correponding to a primer dimer"
|
||||||
|
return sequence, errors.New("read correponding to a primer dimer")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !match.IsDirect {
|
if !match.IsDirect {
|
||||||
@ -244,6 +249,7 @@ func (match *DemultiplexMatch) ExtractBarcode(sequence obiseq.BioSequence, inpla
|
|||||||
}
|
}
|
||||||
|
|
||||||
annot := sequence.Annotations()
|
annot := sequence.Annotations()
|
||||||
|
|
||||||
if annot == nil {
|
if annot == nil {
|
||||||
log.Fatalf("nil annot %v", sequence)
|
log.Fatalf("nil annot %v", sequence)
|
||||||
}
|
}
|
||||||
@ -278,6 +284,9 @@ func (match *DemultiplexMatch) ExtractBarcode(sequence obiseq.BioSequence, inpla
|
|||||||
for k, val := range match.Pcr.Annotations {
|
for k, val := range match.Pcr.Annotations {
|
||||||
annot[k] = val
|
annot[k] = val
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
annot["demultiplex_error"] = "cannot assign the sequence to a sample"
|
||||||
|
match.Error = errors.New("cannot assign the sequence to a sample")
|
||||||
}
|
}
|
||||||
|
|
||||||
return sequence, match.Error
|
return sequence, match.Error
|
||||||
|
Reference in New Issue
Block a user