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"
|
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 {
|
type BioSequenceClassifier struct {
|
||||||
Code func(*BioSequence) int
|
Code func(*BioSequence) int
|
||||||
Value func(int) string
|
Value func(int) string
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package obiseq
|
package obiseq
|
||||||
|
|
||||||
|
// A method that concatenates two BioSequences.
|
||||||
func (sequence *BioSequence) Join(seq2 *BioSequence, inplace bool) *BioSequence {
|
func (sequence *BioSequence) Join(seq2 *BioSequence, inplace bool) *BioSequence {
|
||||||
|
|
||||||
if !inplace {
|
if !inplace {
|
||||||
|
@ -30,6 +30,7 @@ func (sequence *BioSequence) HasStatsOn(key string) bool {
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A function that takes a BioSequence and a key and returns a StatsOnValues.
|
||||||
func (sequence *BioSequence) StatsOn(key string, na string) StatsOnValues {
|
func (sequence *BioSequence) StatsOn(key string, na string) StatsOnValues {
|
||||||
mkey := StatsOnSlotName(key)
|
mkey := StatsOnSlotName(key)
|
||||||
annotations := sequence.Annotations()
|
annotations := sequence.Annotations()
|
||||||
@ -75,6 +76,7 @@ func (sequence *BioSequence) StatsOn(key string, na string) StatsOnValues {
|
|||||||
return stats
|
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 {
|
func (sequence *BioSequence) StatsPlusOne(key string, toAdd *BioSequence, na string) bool {
|
||||||
sval := na
|
sval := na
|
||||||
annotations := sequence.Annotations()
|
annotations := sequence.Annotations()
|
||||||
@ -122,10 +124,7 @@ func (stats StatsOnValues) Merge(toMerged StatsOnValues) StatsOnValues {
|
|||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Merging two sequences.
|
||||||
|
|
||||||
Merges two sequences
|
|
||||||
*/
|
|
||||||
func (sequence *BioSequence) Merge(tomerge *BioSequence, na string, inplace bool, statsOn ...string) *BioSequence {
|
func (sequence *BioSequence) Merge(tomerge *BioSequence, na string, inplace bool, statsOn ...string) *BioSequence {
|
||||||
if !inplace {
|
if !inplace {
|
||||||
sequence = sequence.Copy()
|
sequence = sequence.Copy()
|
||||||
|
Reference in New Issue
Block a user