From 57e0966d3570dde95d95e4aa75c472c1aca009eb Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Tue, 23 Aug 2022 11:11:36 +0200 Subject: [PATCH] Adds some documentation --- pkg/obiseq/class.go | 10 ++++++++++ pkg/obiseq/join.go | 1 + pkg/obiseq/merge.go | 7 +++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/obiseq/class.go b/pkg/obiseq/class.go index c9dc060..8ccb95d 100644 --- a/pkg/obiseq/class.go +++ b/pkg/obiseq/class.go @@ -9,6 +9,16 @@ import ( log "github.com/sirupsen/logrus" ) +// Defines an object able to classify a sequence in classes defined by an integer index. +// +// The first function is the classifier itself. It takes a BioSequence and returns +// an integer. The integer is the class of the BioSequence. +// +// The second function is the classifier's value function. It takes an integer and +// returns a string. The string is the original value used to define the class of the sequence. +// +// Moreover a third function resets the classifier, and fourth one +// returns a clone of the classifier. type BioSequenceClassifier struct { Code func(*BioSequence) int Value func(int) string diff --git a/pkg/obiseq/join.go b/pkg/obiseq/join.go index f13f75e..02a40b9 100644 --- a/pkg/obiseq/join.go +++ b/pkg/obiseq/join.go @@ -1,5 +1,6 @@ package obiseq +// A method that concatenates two BioSequences. func (sequence *BioSequence) Join(seq2 *BioSequence, inplace bool) *BioSequence { if !inplace { diff --git a/pkg/obiseq/merge.go b/pkg/obiseq/merge.go index ff17067..6a49094 100644 --- a/pkg/obiseq/merge.go +++ b/pkg/obiseq/merge.go @@ -30,6 +30,7 @@ func (sequence *BioSequence) HasStatsOn(key string) bool { return ok } +// A function that takes a BioSequence and a key and returns a StatsOnValues. func (sequence *BioSequence) StatsOn(key string, na string) StatsOnValues { mkey := StatsOnSlotName(key) annotations := sequence.Annotations() @@ -75,6 +76,7 @@ func (sequence *BioSequence) StatsOn(key string, na string) StatsOnValues { return stats } +// Adding the count of the sequence to the count of the key in the stats. func (sequence *BioSequence) StatsPlusOne(key string, toAdd *BioSequence, na string) bool { sval := na annotations := sequence.Annotations() @@ -122,10 +124,7 @@ func (stats StatsOnValues) Merge(toMerged StatsOnValues) StatsOnValues { return stats } -/* - - Merges two sequences -*/ +// Merging two sequences. func (sequence *BioSequence) Merge(tomerge *BioSequence, na string, inplace bool, statsOn ...string) *BioSequence { if !inplace { sequence = sequence.Copy()