mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Refactoring codes for removing buffer size options. An some other changes...
Former-commit-id: 10b57cc1a27446ade3c444217341e9651e89cdce
This commit is contained in:
@@ -278,3 +278,28 @@ func (s *BioSequence) Clear() {
|
||||
s.sequence = s.sequence[0:0]
|
||||
}
|
||||
|
||||
func (s *BioSequence) Composition() map[byte]int {
|
||||
|
||||
a := 0
|
||||
c := 0
|
||||
g := 0
|
||||
t := 0
|
||||
other := 0
|
||||
for _, char := range s.sequence {
|
||||
switch char {
|
||||
case 'a':
|
||||
a++
|
||||
case 'c':
|
||||
c++
|
||||
case 'g':
|
||||
g++
|
||||
case 't':
|
||||
t++
|
||||
default:
|
||||
other++
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return map[byte]int{'a': a, 'c': c, 'g': g, 't': t, 'o': other}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user