mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds some documentation
This commit is contained in:
@ -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
|
||||
|
@ -1,5 +1,6 @@
|
||||
package obiseq
|
||||
|
||||
// A method that concatenates two BioSequences.
|
||||
func (sequence *BioSequence) Join(seq2 *BioSequence, inplace bool) *BioSequence {
|
||||
|
||||
if !inplace {
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user