context

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 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",
	SuperSpecies: "superspecies",
	SubGenus:     "subgenus",
	Genus:        "genus",
	SuperGenus:   "supergenus",
	SubFamily:    "subfamily",
	Family:       "family",
	SuperFamily:  "superfamily",
	Order:        "order",
	SuperOrder:   "superorder",
	ParvClass:    "parvclass",
	SubTerClass:  "subterclass",
	InfraClass:   "infraclass",
	SubClass:     "subclass",
	Class:        "class",
	SuperClass:   "superclass",
	SubPhylum:    "subphylum",
	Phylum:       "phylum",
	SuperPhylum:  "superphylum",
	SubKingdom:   "subkingdom",
	Kingdom:      "kingdom",
	SuperKingdom: "superkingdom",
	Empire:       "empire",
	Biota:        "biota",
}
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 Context

type Context struct {
	Kingdom, Context                     *Clade
	KingdomPercentage, ContextPercentage float32
}

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
	SuperSpecies
	SubGenus
	Genus
	SuperGenus
	SubFamily
	Family
	SuperFamily
	Order
	SuperOrder
	ParvClass
	SubTerClass
	InfraClass
	SubClass
	Class
	SuperClass
	SubPhylum
	Phylum
	SuperPhylum
	SubKingdom
	Kingdom
	SuperKingdom
	Empire
	Biota
)

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