From e17d1fbca6c55f6b39e7310d6e66d8642e821795 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 17 Oct 2022 21:32:24 +0200 Subject: [PATCH] Patch the error message stored in sequences by obimultiplex --- pkg/obingslibrary/match.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/obingslibrary/match.go b/pkg/obingslibrary/match.go index 1ee2590..7afd418 100644 --- a/pkg/obingslibrary/match.go +++ b/pkg/obingslibrary/match.go @@ -246,7 +246,6 @@ func (match *DemultiplexMatch) ExtractBarcode(sequence *obiseq.BioSequence, inpl } } - if !match.IsDirect { sequence.ReverseComplement(true) } @@ -277,19 +276,19 @@ func (match *DemultiplexMatch) ExtractBarcode(sequence *obiseq.BioSequence, inpl annot["reverse_tag"] = match.ReverseTag } - if match.Error != nil { - annot["demultiplex_error"] = fmt.Sprintf("%v", match.Error) - } - - if match.Pcr != nil { - annot["sample"] = match.Pcr.Sample - annot["experiment"] = match.Pcr.Experiment - for k, val := range match.Pcr.Annotations { - annot[k] = val + if match.Error == nil { + if match.Pcr != nil { + annot["sample"] = match.Pcr.Sample + annot["experiment"] = match.Pcr.Experiment + for k, val := range match.Pcr.Annotations { + 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") } } else { - annot["demultiplex_error"] = "cannot assign the sequence to a sample" - match.Error = errors.New("cannot assign the sequence to a sample") + annot["demultiplex_error"] = fmt.Sprintf("%v", match.Error) } return sequence, match.Error