context

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RankStr = map[Rank]string{
	Empty:      "empty",
	Unknown:    "unknown",
	SubSpecies: "subspecies",
	Species:    "species",
	Genus:      "genus",
	Family:     "family",
	Order:      "order",
	Class:      "class",
	Phylum:     "phylum",
	Kingdom:    "kingdom",
}
View Source
var StrRank = func() map[string]Rank {
	res := make(map[string]Rank)
	for k, v := range RankStr {
		res[v] = k
	}
	return res
}()

Functions

func AddRank

func AddRank(cs []Clade)

Types

type Clade

type Clade struct {
	ID, Name, RankStr string
	Rank
}

type CladesDist added in v0.4.2

type CladesDist struct {
	NamesNum   int
	Name       string
	Percentage float32
}

type Context

type Context struct {
	NamesNum                             int
	Kingdom, Context                     Clade
	KingdomPercentage, ContextPercentage float32
	Kingdoms                             []CladesDist
}

func New added in v0.4.1

func New(
	h []Hierarch,
	threshold float32,
) Context

New takes several items that include bio-clasification and returns back the kingdom where most of items belong to (if rank 'kingdom' is provided), percentage of how many items belong to that kingdom, and the highest ranking clade that includes a certain percentage of species. The percentage is provided via threshold parameter.

The algorithm assumes that all items belong to the same classification tree and that classification does not skip clades from item to item.

type Hierarch

type Hierarch interface {
	// Clades method produces a slice of clades that represent a path in a
	// hierarchy.
	Clades() []Clade
}

An interface that allows to produce a normalized verion of a hierarchy as a slice of clades, ordered accorting from more general to more specific clades.

type Rank

type Rank int
const (
	Empty Rank = iota
	Unknown
	SubSpecies
	Species
	Genus
	Family
	Order
	Class
	Phylum
	Kingdom
)

func NewRank

func NewRank(s string) Rank

func (Rank) Index

func (r Rank) Index() int

func (Rank) String

func (r Rank) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL