patch the Taxid method

This commit is contained in:
2022-08-23 11:06:51 +02:00
parent 1e58c92086
commit 62968aaa26
2 changed files with 54 additions and 10 deletions

View File

@@ -1,3 +1,13 @@
// A package that defines a BioSequence struct.
//
// BioSequence are used to représente biological DNA sequences.
// The structure stores not only the sequence itself, but also some
// complementaty information. Among them:
// - an identifier
// - a definition
// - the sequence quality scores
// - the features
// - the annotations
package obiseq
import (
@@ -260,7 +270,7 @@ func (s *BioSequence) Count() int {
// Returning the taxid of the sequence.
func (s *BioSequence) Taxid() int {
taxid, ok := s.GetInt("count")
taxid, ok := s.GetInt("taxid")
if !ok {
taxid = 1
@@ -269,6 +279,11 @@ func (s *BioSequence) Taxid() int {
return taxid
}
func (s *BioSequence) SetTaxid(taxid int) {
annot := s.Annotations()
annot["taxid"] = taxid
}
// Setting the id of the BioSequence.
func (s *BioSequence) SetId(id string) {
s.id = id