Merge branch 'master' into taxonomy

This commit is contained in:
Eric Coissac
2024-12-20 20:06:57 +01:00
20 changed files with 286 additions and 54 deletions

View File

@ -12,6 +12,7 @@ package obiseq
import (
"crypto/md5"
"encoding/hex"
"slices"
"sync"
"sync/atomic"
@ -182,6 +183,9 @@ func (s *BioSequence) Copy() *BioSequence {
newSeq.sequence = CopySlice(s.sequence)
newSeq.qualities = CopySlice(s.qualities)
newSeq.feature = CopySlice(s.feature)
if s.revcomp != nil {
newSeq.revcomp = s.revcomp.Copy()
}
if len(s.annotations) > 0 {
s.annot_lock.Lock()
@ -375,6 +379,11 @@ func (s *BioSequence) MD5() [16]byte {
return md5.Sum(s.sequence)
}
func (s *BioSequence) MD5String() string {
md5_hash := s.MD5()
return hex.EncodeToString(md5_hash[:])
}
// SetId sets the id of the BioSequence.
//
// Parameters:

View File

@ -55,8 +55,7 @@ func (sequence *BioSequence) ReverseComplement(inplace bool) *BioSequence {
if !inplace {
original = sequence
sequence.revcomp = sequence.Copy()
sequence = sequence.revcomp
sequence = sequence.Copy()
sequence.revcomp = original
}